asp.netazure.net-coredotnet-aspireazure-azd

Azure "azd up" removes custom domain from deployed Containerapp. How can I keep it?


I have a very simple dotnet core webapp that I want to deploy to azure containerapps with Aspire and azd

This is my AppHost's Program.cs

using Aspire.Hosting;

var builder = DistributedApplication.CreateBuilder(args);

builder.AddProject<Projects.Frontend>("frontend")
    .WithExternalHttpEndpoints();

builder.Build().Run();

now I configured the project with azd init to use the AppHost for deployment and used azd up to deploy the project to Azure.

After azd up the app is available at https://frontend.***.germanywestcentral.azurecontainerapps.io/

Now I use the azure portal to edit my container (Home Resource Groups > rg-myall-dev > frontend) and used Settings > Custom Domains to add a custom domain to my frontend.

That works great so far and the app is available at www.mycompany.tld

However, the next time I use azd up the custom domain is gone (it really is missing under custom domains) and the app is only available at https://frontend.***.germanywestcentral.azurecontainerapps.io/ again.

I haven't found a way to set the domain in the azd config or the AppHost's Program.cs

How can I keep my custom domain after deployment or set the custom domain during deployment?


Solution

  • You can persist custom domains between deployments using the following configuration settings:

    azd config set alpha.aca.persistDomains on
    

    See link for more details