In Aspire 8, I had this code to provision an Azure SQL Server & Database:
var sqlDatabase = builder.AddSqlServer("sql-server")
.WithDataVolume()
.PublishAsAzureSqlDatabase((_, _, _, sqlDatabases) =>
{
foreach (var db in sqlDatabases)
{
db.Properties.Sku = new SqlSku("S0") { Tier = "Standard" };
}
})
.AddDatabase("evadexdb");
Upgrading to .NET 9.0-rc, and Aspire, I changed this code in accordance to the What's New docs:
builder.Services.Configure<AzureResourceOptions>(options => options.ProvisioningContext.PropertyResolvers.Insert(0, new AspireV8ResourceNamePropertyResolver()));
var sqlDatabase = builder.AddAzureSqlServer("sql-server")
.RunAsContainer(x => x.WithLifetime(ContainerLifetime.Persistent))
.AddDatabase("evadexdb");
However, this has changed the naming on sql-server to sql_server, which is not a valid Azure SQL server name. azd provision returns this (version 1.10.3):
ERROR: deployment failed: error deploying infrastructure: deploying to subscription:
Deployment Error Details:
InvalidServerName: The server name 'sql_serverxr4o3alsj2qhw' cannot be empty or null. The server name can only be made up of lowercase letters 'a'-'z', the numbers 0-9 and the hyphen. The hyphen may not lead or trail in the server name. Please fix the server name and retry. Please contact Microsoft support if the issue persists.
TraceID: 489[42](https://github.com/PhantomSecurityGroup/EvadeX.Web/actions/runs/11490357271/job/31981252826#step:10:43)d2d159dc8f50fab7182f10d0124
Error: Process completed with exit code 1.
Taking a look at the different bison files generated:
Is there an existing issue for this?
Describe the bug
In Aspire 8, I had this code to provision an Azure SQL Server & Database:
Upgrading to .NET 9.0-rc, and Aspire, I changed this code in accordance to the What's New docs:
However, this has changed the naming on
sql-server
tosql_server
, which is not a valid Azure SQL server name.azd provision
returns this (version 1.10.3):Taking a look at the different bison files generated:
Aspire 8
Aspire 9 (w/ new Azure SQL API)
Expected Behavior
The previous name in Azure was
sql-serverxr4o3alsj2qhw
and should remain that, notsql_serverxr4o3alsj2qhw
.Steps To Reproduce
No response
Exceptions (if any)
No response
.NET Version info
Anything else?
Using the deprecated API resolves the issue.