Skip to content

Commit 4f8368b

Browse files
authored
Add breaking change documentation for AddAzureOpenAI role defaulting to CognitiveServicesOpenAIUser. Fixes #3936 (#4042)
1 parent 616aa67 commit 4f8368b

File tree

3 files changed

+55
-0
lines changed

3 files changed

+55
-0
lines changed
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
---
2+
title: "Breaking change - AddAzureOpenAI defaults to CognitiveServicesOpenAIUser instead of CognitiveServicesOpenAIContributor"
3+
description: "Learn about the breaking change in .NET Aspire 9.4 where AddAzureOpenAI defaults to a lower privilege role."
4+
ms.date: 7/11/2025
5+
ai-usage: ai-assisted
6+
ms.custom: https://github.com/dotnet/docs-aspire/issues/3936
7+
---
8+
9+
# AddAzureOpenAI defaults to CognitiveServicesOpenAIUser instead of CognitiveServicesOpenAIContributor
10+
11+
In .NET Aspire 9.4, the default role assigned to applications using `AddAzureOpenAI` was changed from `CognitiveServicesOpenAIContributor` to `CognitiveServicesOpenAIUser`. This change improves security by assigning a lower privilege role by default, ensuring applications only have the permissions necessary for inference tasks.
12+
13+
## Version introduced
14+
15+
.NET Aspire 9.4
16+
17+
## Previous behavior
18+
19+
Previously, applications referencing an Azure OpenAI account were assigned as the `CognitiveServicesOpenAIContributor` role by default. This role allowed applications to manage OpenAI deployments, which is a higher privilege than typically required for inference tasks.
20+
21+
## New behavior
22+
23+
Applications referencing an Azure OpenAI account are now assigned the `CognitiveServicesOpenAIUser` role by default. This role provides permissions for inference tasks without allowing management of OpenAI deployments. If higher privileges are required, you can configure the necessary roles using the `WithRoleAssignments` API.
24+
25+
Example:
26+
27+
```csharp
28+
using Azure.Provisioning.CognitiveServices;
29+
30+
var openai = builder.AddAzureOpenAI("openai");
31+
32+
builder.AddProject<Projects.ApiService>("api")
33+
.WithRoleAssignments(openai, CognitiveServicesBuiltInRole.CognitiveServicesOpenAIContributor);
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 `CognitiveServicesOpenAIContributor` role provides excessive privileges for most applications, as managing OpenAI deployments isn't typically required. Assigning the `CognitiveServicesOpenAIUser` role by default enhances security by limiting permissions to inference tasks. For applications requiring higher privileges, roles can be explicitly configured using the <xref:Aspire.Hosting.AzureOpenAIExtensions.WithRoleAssignments*> API.
43+
44+
For more information, see [GitHub PR #10293](https://github.com/dotnet/aspire/pull/10293).
45+
46+
## Recommended action
47+
48+
If your application requires higher privileges than the `CognitiveServicesOpenAIUser` role, explicitly configure the necessary roles using the `WithRoleAssignments` API. See the [New behavior](#new-behavior) section for an example of how to do this.
49+
50+
## Affected APIs
51+
52+
- `Aspire.Hosting.AzureOpenAIExtensions.AddAzureOpenAI`

docs/compatibility/9.4/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.4, the breaking changes listed here
1818

1919
| Title | Type of change | Introduced version |
2020
|--|--|--|
21+
| [AddAzureOpenAI defaults to CognitiveServicesOpenAIUser role](add-azure-openai-default-changes.md) | Behavioral change | 9.4 |
2122
| [Azure Storage APIs renamed and refactored](azure-storage-apis-renamed.md) | Binary incompatible, source incompatible | 9.4 |
2223
| [BicepSecretOutputReference and GetSecretOutput are now obsolete](getsecretoutput-deprecated.md) | Binary incompatible, source incompatible | 9.4 |
2324
| [Deprecating various known parameters in AzureBicepResource](azure-bicep-parameters-deprecated.md) | Source incompatible, behavioral change | 9.4 |

docs/compatibility/toc.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ items:
1313
- name: Breaking changes in 9.4
1414
expanded: true
1515
items:
16+
- name: AddAzureOpenAI defaults to CognitiveServicesOpenAIUser role
17+
href: 9.4/add-azure-openai-default-changes.md
1618
- name: Azure Storage APIs renamed and refactored
1719
href: 9.4/azure-storage-apis-renamed.md
1820
- name: BicepSecretOutputReference and GetSecretOutput are now obsolete

0 commit comments

Comments
 (0)