Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handling of duplicate names - "The specified name 'appconfigolttwmle7kgse' is already in use #2954

Closed
christiannagel opened this issue Mar 16, 2024 · 6 comments
Labels
area-app-model Issues pertaining to the APIs in Aspire.Hosting, e.g. DistributedApplication area-samples

Comments

@christiannagel
Copy link

Using an Azure App Configuration resource with Azure provisioning

var builder = DistributedApplication.CreateBuilder(args);

builder.AddAzureProvisioning();

var appConfig = builder.AddAzureAppConfiguration("appconfig");

I had the error in the logs of Azure App Configuration that the name appconfigolttwmle7kgse is already in use, and the deployment failed. This resource name is not in my subscription but used somewhere in Azure.

Now with .NET Aspire I expect that many run into this issue when names need to be globally unique.

I think there should be a better way to handle this, such as

  • Retry with a different name (I think this would be the best option)
  • Error information not just in the logs of this resource, and directing the user to resolve this
  • A guidance not to use "appconfig" with the name of Azure App Config resources: then it is more unlikely to get a duplicate name

Version:
aspire 8.0.0-preview.5.24162.5/8.0.100

@dotnet-issue-labeler dotnet-issue-labeler bot added the area-app-model Issues pertaining to the APIs in Aspire.Hosting, e.g. DistributedApplication label Mar 16, 2024
@mitchdenny
Copy link
Member

Thanks for letting us know about this @christiannagel .

Naming collisions are definitely something to be aware of and the guidance of not naming everything appconfig (or whatever makes sense for the resource you are working with).

The problem with trying another random value is that you now need to keep track of that so that you don't use another random value next time you deploy.

This is a problem in regular ARM/Bicep based deployments as well. The solution I've used in those circumstances is to have a name override parameter which is used in that environment to replace the name of that particular resource when a conflict does arise.

We can probably do something similar here.

@mitchdenny
Copy link
Member

I think the action here is producing a sample on how to get past this issue using the CDK callbacks.

@mitchdenny mitchdenny added this to the preview 6 (Apr) milestone Mar 16, 2024
@davidfowl
Copy link
Member

@mitchdenny is tihs docs?

@mitchdenny
Copy link
Member

mitchdenny commented Apr 8, 2024

Yeah I think this is docs. You've gotta be unlucky but it will definitely happen from time to time (its more common for role assignment IDs). FWIW, you can override the name using the CDK callback - but using something other than appconfig is a good starting point.

var appConfig = builder.AddAzureAppConfiguration("appConfig", (resource, construct, store) =>
{
    store.AssignProperty(p => p.Name, "'myaltname'");
});

@mitchdenny
Copy link
Member

@christiannagel just to answer why we wouldn't do your "best option" above. If you randomly change the name when there is a conflict, if you go to redeploy the same apphost to the same RG at a later stage and the appconfig resource has been removed then you'll end up in a confused state. It is always better for these things to be deterministic.

@mitchdenny
Copy link
Member

Filing a doc suggestion for this: dotnet/docs-aspire#681

@github-actions github-actions bot locked and limited conversation to collaborators May 17, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-app-model Issues pertaining to the APIs in Aspire.Hosting, e.g. DistributedApplication area-samples
Projects
None yet
Development

No branches or pull requests

3 participants