© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3mo ago•
2 replies
Tandy

✅ Aspire EF Core Migrations - Deployment to Azure?

intermediate
I've configured a .NET worker service to handle EF Core migrations based on https://aspire.dev/integrations/databases/efcore/migrations It works well in development. But how should I model the
AppHost
AppHost
resource so that I can deploy it to Azure? What's the best practice? I currently have it deploying as an Azure Container App, but it's not stopping after migrations are finished. I think it might be more appropriate to configure it as an Azure Container App Job. Is there another approach to consider?

var migrations = builder.AddProject<Projects.Catalog_MigrationService>(ServiceConstants.ServiceNames.CatalogDatabaseMigrations)
    .WithReference(database)
    .WaitFor(database)
    .PublishAsAzureContainerApp((module, app) =>
    {
        app.Template.Scale.MinReplicas = 0;
        app.Template.Scale.MaxReplicas = 1;
    });
var migrations = builder.AddProject<Projects.Catalog_MigrationService>(ServiceConstants.ServiceNames.CatalogDatabaseMigrations)
    .WithReference(database)
    .WaitFor(database)
    .PublishAsAzureContainerApp((module, app) =>
    {
        app.Template.Scale.MinReplicas = 0;
        app.Template.Scale.MaxReplicas = 1;
    });
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Aspire + EF Core
C#CC# / help
3y ago
❔ EF Core migrations
C#CC# / help
4y ago
Migrating to EF Core migrations
C#CC# / help
17mo ago
EF-Core migrations issue
C#CC# / help
2y ago