Azure SQL database provisioning after initial deployment
- Dominant language
- C#
- Stars
- 6.3k
- Forks
- 991
- Avg merge
- 2d 15h
- Merged PRs (30d)
- 196
Description
### Is there an existing issue for this?
- [x] I have searched the existing issues
### Describe the bug
I have seen related issues https://github.com/dotnet/aspire/issues/3101
but this doesn't actually indicate where the issue is fixed.
I have this provisioning code:
```
var az = builder.AddAzureSqlServer("sqlserver")
.ConfigureInfrastructure(infra =>
{
var azureResources = infra.GetProvisionableResources();
var azureDb = azureResources.OfType().Single();
azureDb.Sku = new SqlSku() { Name = "GP_S_Gen5_1" };
});
var db = az.AddDatabase("db");
app.WithReference(db).WaitFor(db);
```
which worked when I initially published. Some time later I added a redis instance to the orchestration. I assume this triggered provisioning again, because I suddenly got failure message on Publish related to the SQL resources.
I established that using .RunAsExisting() on az would use the existing instance of the SQL Server.
However the AddDatabase call still fails and despite some searching, I can't find the correct way to configure a similar "use existing" implementation.
The provisioning logic is not obvious to me. I have seen CosmosDB / and Az Table storage publish in an idempotent fashion, without the UseExisting
semantics.
Aspire and package versions as below:
```
Exe
net8.0
enable
enable
9078373a-0567-401e-90e7-7c7415112564
```
### Expected Behavior
_No response_
### Steps To Reproduce
_No response_
### Exceptions (if any)
None
### .NET Version info
.Net 8
### Anything else?
I'm using VS 2022 - aspire publish
Aspire and package versions as below:
```
Exe
net8.0
enable
enable
9078373a-0567-401e-90e7-7c7415112564
```
Contributor guide
Assessment
This issue has not been assessed yet.