-
Notifications
You must be signed in to change notification settings - Fork 743
Description
Is there an existing issue for this?
- I have searched the existing issues
Describe the bug
Most of the names generated for azure resources do something like take(name + uniqueString, maxLength) which means it's not unique if name is longer than maxLength.
This is particularly bad, because you only find out about this when you do a new deployment of the project, and it might be too late to change the name if the first deployment is used in production.
I suggest the generated name be more like take(name, maxLength - 13) + uniqueString. There's still potential for a conflict within a project (because they'll have the same uniqueString), but this will be figured out on the first deployment before it's being relied upon.
This was discussed in #12652, but I didn't get a conclusive answer where this should be fixed, so I'm raising it here as a starting point.
This is related to #5756 cc @eerhardt
The most likely to hit this is storage accounts with their 24 char limit, but ServiceBus namespaces and SQL servers are also candidates in our project at least.
Expected Behavior
I expect to be able to deploy a second instance of my project to a separate resource group without conflict.
Steps To Reproduce
add
builder.AddAzureStorage("namegreaterthan24charslong")and try to deploy it to two different resource groups in Azure.
Exceptions (if any)
No response
.NET Version info
No response
Anything else?
<PackageVersion Include="Aspire.Azure.Messaging.ServiceBus" Version="9.5.1" />
<PackageVersion Include="Aspire.Azure.Storage.Blobs" Version="9.5.1" />
<PackageVersion Include="Aspire.Hosting.AppHost" Version="9.5.1" />
<PackageVersion Include="Aspire.Hosting.Azure.AppContainers" Version="9.5.1" />
<PackageVersion Include="Aspire.Hosting.Azure.ApplicationInsights" Version="9.5.1" />
<PackageVersion Include="Aspire.Hosting.Azure.ServiceBus" Version="9.5.1" />
<PackageVersion Include="Aspire.Hosting.Azure.Sql" Version="9.5.1" />
<PackageVersion Include="Aspire.Hosting.Azure.Storage" Version="9.5.1" />
<PackageVersion Include="Aspire.Hosting.NodeJs" Version="9.5.1" />
<PackageVersion Include="Aspire.Hosting.Testing" Version="9.5.1" />
<PackageVersion Include="Aspire.Microsoft.Data.SqlClient" Version="9.5.1" />