Limit storageaccount name length to 24 characters (#5396)

* Limit storageaccount name length to 24 characters

* Check if the length of storageAccountName is more than 24
This commit is contained in:
Teemu Tapanila
2022-04-13 11:57:22 +03:00
committed by GitHub
parent 4f62f8e999
commit 5da7f5bd60

View File

@@ -193,6 +193,12 @@ Function GenerateResourcesAndImage {
$storageAccountName = $storageAccountName.Replace("-", "").Replace("_", "").Replace("(", "").Replace(")", "").ToLower()
$storageAccountName += "001"
# Storage Account Name can only be 24 characters long
if ($storageAccountName.Length -gt 24){
$storageAccountName = $storageAccountName.Substring(0, 24)
}
New-AzStorageAccount -ResourceGroupName $ResourceGroupName -AccountName $storageAccountName -Location $AzureLocation -SkuName "Standard_LRS" -AllowBlobPublicAccess $AllowBlobPublicAccess -EnableHttpsTrafficOnly $EnableHttpsTrafficOnly
if ([string]::IsNullOrEmpty($AzureClientId)) {