Today we are announcing General Availability of Aspire on Azure App Service, making it easier to take distributed applications from local development to a fully managed production environment on Azure App Service. With the Aspire.Hosting.Azure.AppService package, you can define your hosting environment in code and deploy to App Service using the same AppHost model you already use for orchestration.
Aspire brings a code-first model for building, running, and deploying distributed applications, with AppHost as the place where services, dependencies, and topology are declared. On Azure App Service, this means developers can keep the familiar Aspire programming model while using a fully managed platform for hosting, security patching and scaling. You can read more about the benefits of Aspire here.
If you’re new to Aspire on App Service, the fastest path is our Quickstart, which walks you through creating an Aspire starter app and deploying it to App Service.
This release adds Deployment Slots support so you can adopt safer deployment patterns (staging → validate → swap). Here is a code snippet showing you how to add a slot.
var builder = DistributedApplication.CreateBuilder(args);
builder.AddAzureAppServiceEnvironment("<appsvc64>")
.WithDeploymentSlot("dev");
var apiService = builder.AddProject<Projects.AspireApp64_ApiService>("apiservice")
.WithHttpHealthCheck("/health")
.WithExternalHttpEndpoints();
builder.AddProject<Projects.AspireApp64_Web>("webfrontend")
.WithExternalHttpEndpoints()
.WithHttpHealthCheck("/health")
.WithReference(apiService)
.WaitFor(apiService);
builder.Build().Run();
- If the production slot does not already exist, this creates both the production slot and the staging slot with identical code.
- If the production slot already exists, the deployment goes only to the staging slot.
Note:
Scaling: Manual scaling is supported (via AppHost code or the Azure portal), and you can also setup rule-based scaling. Automatic scaling is not yet supported in the current experience
Learn more about the configuration options for Aspire on App Service here.
We’d love for you to try Aspire on App Service and tell us what you’re building - your feedback helps shape what we ship next.