Aspire Azure SQL deployment bug

This week, I was updating my Aspire applications after the latest release and I ran into a deployment bug for my test deployments. I could no longer deploy the database to Azure SQL. I got the following error:

Deployment Error Details: ProvisioningDisabled: 
    Cannot update paid database to free database. 

The error is caused by the latest Azure changes and the Aspire updates. To fix, I need to disable the free database due to the Azure location and also switch to a DTU model.

Existing code

The existing code was just using the defaults.

var sqlServer = builder.AddAzureSqlServer("sqlserver");

var database = sqlServer.AddDatabase("database", "IdpSwiyuPasskeysSts");

The fix

I set the deployment target and disabled the free limit by setting the UseFreeLimit property.

var sqlServer = builder.AddAzureSqlServer("sqlserver")
        .ConfigureInfrastructure(infra =>
        {
            var resources = infra.GetProvisionableResources();

            var dbRes = resources.OfType<Azure.Provisioning.Sql.SqlDatabase>()
                  .Single();

            dbRes.Sku = new Azure.Provisioning.Sql.SqlSku()
            {
                Tier = "Basic",
                Name = "Basic",
                Capacity = 5
            }; 

            dbRes.UseFreeLimit = false;
        });

var database = sqlServer.AddDatabase("database", "IdpSwiyuPasskeysSts");

Conclusion

I don’t know exactly which changes caused this bug, but now I can continue to deploy and test.

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.