-
Notifications
You must be signed in to change notification settings - Fork 720
Description
When deploying an Azure Functions app using the default/implicit Azure Storage account, the name used is too long and isn't getting a unique string in Azure. The storage account name needs to be unique across all of Azure.
var funcApp = builder.AddAzureFunctionsProject<Projects.AzureFunctionsEndToEnd_Functions>("funcapp")
.WithExternalHttpEndpoints()
.WithReference(eventHubs)
.WithReference(blob)
.WithReference(queue);Produces the following bicep:
resource defaultazfuncstorage2380b 'Microsoft.Storage/storageAccounts@2024-01-01' = {
name: take('defaultazfuncstorage2380b${uniqueString(resourceGroup().id)}', 24)
kind: 'StorageV2'
location: location
sku: {
name: 'Standard_GRS'
}
properties: {
accessTier: 'Hot'
allowSharedKeyAccess: false
minimumTlsVersion: 'TLS1_2'
networkAcls: {
defaultAction: 'Allow'
}
}
tags: {
'aspire-resource-name': 'defaultazfuncstorage2380b'
}
}Note this line: name: take('defaultazfuncstorage2380b${uniqueString(resourceGroup().id)}', 24)
We are already over the 24 char limit with our default name + 5 SHA chars from the AppHost path.
If 2 developers are working on the same app in the same file location (ex. C:\git), when they deploy to separate resource groups, the Storage account is going to conflict because they both will try to use defaultazfuncstorage2380 as the name. This is the same if you are deploying the same app twice from a GitHub Action or Azure Devops pipeline.
We should make the prefix shorter to allow for more unique characters to come from the uniqueString portion.