Skip to content

Commit 66248ac

Browse files
authored
Fixes #3386, adds breaking changes content for Azure SQL Server admin user-assigned managed id. (#3391)
1 parent 535bef6 commit 66248ac

File tree

3 files changed

+62
-0
lines changed

3 files changed

+62
-0
lines changed
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
---
2+
title: "Breaking change - AddAzureSqlServer assigns a dedicated user-assigned managed identity as the administrator"
3+
description: "Learn about the breaking change in .NET Aspire 9.3 where Azure SQL Server instances are assigned dedicated user managed identities as administrators."
4+
ms.date: 5/12/2025
5+
ai-usage: ai-assisted
6+
ms.custom: https://github.com/dotnet/docs-aspire/issues/3386
7+
---
8+
9+
# AddAzureSqlServer assigns a dedicated user-assigned managed identity as the administrator
10+
11+
In .NET Aspire 9.3, Azure SQL Server instances are now assigned dedicated user managed identities as administrators. This change resolves issues with overlapping managed identities when using multiple app containers. Additionally, app containers and local users are granted the `db_owner` role for database access.
12+
13+
## Version introduced
14+
15+
.NET Aspire 9.3
16+
17+
## Previous behavior
18+
19+
In Aspire 9.2, each container app was assigned its own managed identity as the administrator. However, when multiple app containers were used, the second container would overwrite the administrator role of the first, causing access issues.
20+
21+
## New behavior
22+
23+
In Aspire 9.3, each Azure SQL Server instance is assigned a dedicated user managed identity as its administrator. App containers using these SQL Server instances are granted the `db_owner` role during deployment. If an application isn't deployed as an app container, the current Entra ID user account is also added as a `db_owner` in the database, enabling data management.
24+
25+
To prevent automatic configuration, the <xref:Aspire.Hosting.ExistingAzureResourceExtensions.AsExisting*> method can be used on the Azure SQL Server resource. Existing instances aren't reconfigured.
26+
27+
## Type of breaking change
28+
29+
This is a [behavioral change](../categories.md#behavioral-change).
30+
31+
## Reason for change
32+
33+
This change resolves a limitation where multiple app containers caused conflicts in administrator assignments for Azure SQL Server instances. It ensures each instance has a dedicated administrator and improves role assignment consistency.
34+
35+
## Recommended action
36+
37+
No recommended action is required if the new behavior aligns with your requirements. However, if you prefer the previous behavior, you can use the `AsExisting` method to prevent automatic configuration of the Azure SQL Server instance. For example:
38+
39+
```csharp
40+
var builder = DistributedApplication.CreateBuilder();
41+
42+
var existingSqlServerName = builder.AddParameter("existingSqlServerName");
43+
var existingSqlServerResourceGroup = builder.AddParameter("existingSqlServerResourceGroup");
44+
45+
var sql = builder.AddAzureSqlServer("sql")
46+
.AsExisting(existingSqlServerName, existingSqlServerResourceGroup);
47+
48+
// Use the existing SQL Server using WithReference...
49+
50+
builder.Build().Run();
51+
```
52+
53+
## Affected APIs
54+
55+
- <xref:Aspire.Hosting.AzureContainerAppContainerExtensions.PublishAsAzureContainerApp``1(Aspire.Hosting.ApplicationModel.IResourceBuilder{``0},System.Action{Aspire.Hosting.Azure.AzureResourceInfrastructure,Azure.Provisioning.AppContainers.ContainerApp})>
56+
- <xref:Aspire.Hosting.AzureContainerAppExecutableExtensions.PublishAsAzureContainerApp``1(Aspire.Hosting.ApplicationModel.IResourceBuilder{``0},System.Action{Aspire.Hosting.Azure.AzureResourceInfrastructure,Azure.Provisioning.AppContainers.ContainerApp})>
57+
- <xref:Aspire.Hosting.AzureContainerAppExtensions.AddAzureContainerAppsInfrastructure(Aspire.Hosting.IDistributedApplicationBuilder)>
58+
- <xref:Aspire.Hosting.AzureContainerAppProjectExtensions.PublishAsAzureContainerApp``1(Aspire.Hosting.ApplicationModel.IResourceBuilder{``0},System.Action{Aspire.Hosting.Azure.AzureResourceInfrastructure,Azure.Provisioning.AppContainers.ContainerApp})>
59+
- <xref:Aspire.Hosting.SqlServerBuilderExtensions.AddSqlServer(Aspire.Hosting.IDistributedApplicationBuilder,System.String,Aspire.Hosting.ApplicationModel.IResourceBuilder{Aspire.Hosting.ApplicationModel.ParameterResource},System.Nullable{System.Int32})>

docs/compatibility/9.3/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ If you're migrating an app to .NET Aspire 9.3, the breaking changes listed here
1818

1919
| Title | Type of change | Introduced version |
2020
|--|--|--|
21+
| [AddAzureSqlServer assigns a dedicated user-assigned managed identity as the administrator](azure-sql-server-default-uami-admin.md) | Behavioral change | 9.3 |
2122
| [Change the default SKU used for creating a new Azure SQL database](azure-sql-server-default-sku-changes.md) | Behavioral change | 9.3 |
2223
| [Remove publisher APIs](remove-publisher-apis.md) | Binary incompatible, source incompatible, and behavioral change | 9.3 |
2324
| [With health checks changes in .NET Aspire 9.3](with-health-checks-changes.md) | Binary and source incompatible | 9.3 |

docs/compatibility/toc.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ items:
1919
href: 9.3/azure-sql-server-default-sku-changes.md
2020
- name: Removal of publisher APIs
2121
href: 9.3/remove-publisher-apis.md
22+
- name: Azure SQL Server default user-assigned managed identity admin changes
23+
href: 9.3/azure-sql-server-default-uami-admin.md
2224
- name: .NET Aspire 9.2
2325
expanded: false
2426
items:

0 commit comments

Comments
 (0)