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

@@ -192,6 +192,12 @@ Function GenerateResourcesAndImage {
# Resource group names may contain special characters, that are not allowed in the storage account name
$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
@@ -268,4 +274,4 @@ Function GenerateResourcesAndImage {
-var "install_password=$($InstallPassword)" `
-var "allowed_inbound_ip_addresses=$($AgentIp)" `
$builderScriptPath
}
}