dotnet / aspire

Tools, templates, and packages to accelerate building observable, production-ready apps
https://learn.microsoft.com/dotnet/aspire
MIT License
3.91k stars 476 forks source link

How to Disable Local Provisioning #6623

Closed aligneddev closed 2 weeks ago

aligneddev commented 2 weeks ago

Is there an existing issue for this?

Is your feature request related to a problem? Please describe the problem.

I want to use .Net Aspire, but I already have existing Azure resources that we've created with Terraform.

The Microsoft CoPilot points me to https://learn.microsoft.com/en-us/dotnet/aspire/deployment/azure/local-provisioning and says I can add this to my settings file.

"Azure": { "Provisioning": { "Enabled": false }, "SubscriptionId": "", "ResourceGroup": "", "Location": "" },

Aspire starts, but fails with "Missing subscription configuration" in the dashboard logs.

If I enter real values, it still tries to provision.

Provisioning AppConfig... Deploying AppConfig to rg-cus-appconfig Error provisioning AppConfig. Azure.RequestFailedException: The template deployment failed with error: 'Authorization failed

using Microsoft.Extensions.Configuration;

var builder = DistributedApplication.CreateBuilder(args);

var appConfig = builder.AddAzureAppConfiguration("AppConfig");
builder.AddProject<Projects.ApiService>("apiservice")
    .WithReference(appConfig);
builder.Build().Run();

dotnet user-secrets set ConnectionString:AppConfig ""

Describe the solution you'd like

Can I just disable auto provisioning with an appsettings (as CoPilot suggests, but it isn't documented)?

Additional context

No response

davidfowl commented 2 weeks ago

To use an existing resource, you would skip all of this and directly use AddConnectionString.