Azure / Azure/azure-quickstart-templates
$StorageContainerName may contains space
- Dominant language
- Bicep
- Stars
- 14.9k
- Forks
- 16.2k
- Avg merge
- 6d 21h
- Merged PRs (30d)
- 6
Description
https://github.com/Azure/azure-quickstart-templates/blob/master/Deploy-AzTemplate.ps1
### Issue Details
Deploy-AzTemplate.ps1 contains next code:
```
[string] $ResourceGroupName = (Split-Path $ArtifactStagingDirectory -Leaf),
[switch] $UploadArtifacts,
[string] $StorageAccountName,
[string] $StorageContainerName = $ResourceGroupName.ToLowerInvariant() + '-stageartifacts',
```
If $ArtifactStagingDirectory contains one or more spaces deploy script will try to create a container with spaces that are not allowed by Azure and results in the following error:

### Repro steps
1. .\Deploy-AZTemplate.ps1 -ArtifactStagingDirectory '.\Azure Policies\VM Onboarding\' -UploadArtifacts -TemplateFile '.\Azure Policies\VM Onboarding\azuredeploy.json' -TemplateParametersFile '.\Azure Policies\VM Onboarding\newdev.parameters.json'
### Fix propose:
Adding .Replace(" ","-") in line 11
` [string] $StorageContainerName = $ResourceGroupName.ToLowerInvariant().Replace(" ","-") + '-stageartifacts',`
Contributor guide
No contributing guide indexed for this repository
Research direction
Open Deploy-AzTemplate.ps1 and inspect the $StorageContainerName default near the parameter declarations. Reproduce the issue with the supplied -ArtifactStagingDirectory command using spaces, then verify that deployment succeeds and the resulting storage container name complies with Azure naming rules.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure, powershell
- Domain
- cloud, devops
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100