Skip to content

Commit 87f8a7c

Browse files
committed
Fixes #2899
1 parent 1efed33 commit 87f8a7c

File tree

5 files changed

+64
-2
lines changed

5 files changed

+64
-2
lines changed

docs/compatibility/9.2/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,4 @@ If you're migrating an app to .NET Aspire 9.2, the breaking changes listed here
2020
|--|--|--|
2121
| [WithCommand obsolete and new overload with CommandOptions](withcommand-obsolete.md) | Source incompatible | 9.2 |
2222
| [With authentication API creates keyvault resource in the app model](withauthentication-changes.md) | Behavioral change | 9.2 |
23+
| [KeyVault default role assignment changing from KeyVaultAdministrator to KeyVaultSecretsUser](keyvault-role-assignment-changes.md) | Behavioral change | 9.2 |
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
---
2+
title: "Breaking change - KeyVault default role assignment changing from KeyVaultAdministrator to KeyVaultSecretsUser"
3+
description: "Learn about the breaking change in .NET Aspire 9.2 where the default role for Azure KeyVault applications changes to KeyVaultSecretsUser."
4+
ms.date: 03/27/2025
5+
ai-usage: ai-assisted
6+
ms.custom: https://github.com/dotnet/docs-aspire/issues/2899
7+
---
8+
9+
# KeyVault default role assignment changing from KeyVaultAdministrator to KeyVaultSecretsUser
10+
11+
In .NET Aspire 9.2, the default role assigned to applications referencing Azure KeyVault has changed from <xref:Azure.Provisioning.KeyVault.KeyVaultBuiltInRole.KeyVaultAdministrator> to <xref:Azure.Provisioning.KeyVault.KeyVaultBuiltInRole.KeyVaultSecretsUser>. This change enhances security by limiting default privileges to only reading secrets. Applications requiring higher privileges must explicitly configure them.
12+
13+
## Version introduced
14+
15+
.NET Aspire 9.2
16+
17+
## Previous behavior
18+
19+
Previously, applications referencing Azure KeyVault were automatically granted the `KeyVaultAdministrator` role, which allowed full management of KeyVault settings.
20+
21+
## New behavior
22+
23+
Applications referencing Azure KeyVault are now granted the `KeyVaultSecretsUser` role by default, which restricts access to reading secrets. If higher privileges are required, they can be configured using the `WithRoleAssignments` API.
24+
25+
Example:
26+
27+
```csharp
28+
using Azure.Provisioning.KeyVault;
29+
30+
var kv = builder.AddAzureKeyVault("kv");
31+
32+
builder.AddProject<Projects.ApiService>("api")
33+
.WithRoleAssignments(kv, KeyVaultBuiltInRole.KeyVaultContributor);
34+
```
35+
36+
## Type of breaking change
37+
38+
This is a [behavioral change](../categories.md#behavioral-change).
39+
40+
## Reason for change
41+
42+
The `KeyVaultAdministrator` role provides excessive privileges for most applications, as they typically only need to read secrets. Assigning the `KeyVaultSecretsUser` role by default improves security by adhering to the principle of least privilege.
43+
44+
## Recommended action
45+
46+
If your application requires higher privileges than the `KeyVaultSecretsUser` role, explicitly configure the necessary roles using the `WithRoleAssignments` API. For example:
47+
48+
```csharp
49+
using Azure.Provisioning.KeyVault;
50+
51+
var kv = builder.AddAzureKeyVault("kv");
52+
53+
builder.AddProject<Projects.ApiService>("api")
54+
.WithRoleAssignments(kv, KeyVaultBuiltInRole.KeyVaultContributor);
55+
```
56+
57+
## Affected APIs
58+
59+
- <xref:Aspire.Hosting.AzureKeyVaultResourceExtensions.AddAzureKeyVault*>

docs/compatibility/9.2/withauthentication-changes.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ In .NET Aspire 9.2, calling `WithAccessKeyAuthentication` or `WithPasswordAuthen
3030

3131
## Type of breaking change
3232

33-
This is a [behavioral change](../../categories.md#behavioral-change).
33+
This is a [behavioral change](../categories.md#behavioral-change).
3434

3535
## Reason for change
3636

docs/compatibility/9.2/withcommand-obsolete.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ The only required parameters are the `name`, `displayName`, and `executeCommand`
8181

8282
## Type of breaking change
8383

84-
This is a [source incompatible](../../categories.md#source-compatibility) change.
84+
This is a [source incompatible](../categories.md#source-compatibility) change.
8585

8686
## Reason for change
8787

docs/compatibility/toc.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ items:
1717
href: 9.2/withcommand-obsolete.md
1818
- name: With authentication APIs include semantic changes
1919
href: 9.2/withauthentication-changes.md
20+
- name: KeyVault default role assignment changes
21+
href: 9.2/keyvault-role-assignment-changes.md
2022
- name: .NET Aspire 9.1
2123
expanded: false
2224
items:

0 commit comments

Comments
 (0)