Skip to content

Commit 21dfbdf

Browse files
authored
Fixes #3059. Removes obsolete API. (#3116)
1 parent 6b392db commit 21dfbdf

13 files changed

+89
-17
lines changed

docs/azureai/azureai-openai-integration.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: .NET Aspire Azure OpenAI integration (Preview)
33
description: Learn how to use the .NET Aspire Azure OpenAI integration.
4-
ms.date: 04/03/2025
4+
ms.date: 04/15/2025
55
---
66

77
# .NET Aspire Azure OpenAI integration (Preview)
@@ -53,17 +53,17 @@ The preceding code adds an Azure OpenAI resource named `openai` to the app host
5353
5454
### Add an Azure OpenAI deployment resource
5555

56-
To add an Azure OpenAI deployment resource, call the <xref:Aspire.Hosting.AzureOpenAIExtensions.AddDeployment(Aspire.Hosting.ApplicationModel.IResourceBuilder{Aspire.Hosting.ApplicationModel.AzureOpenAIResource},Aspire.Hosting.ApplicationModel.AzureOpenAIDeployment)> method:
56+
To add an Azure OpenAI deployment resource, call the <xref:Aspire.Hosting.AzureOpenAIExtensions.AddDeployment(Aspire.Hosting.ApplicationModel.IResourceBuilder{Aspire.Hosting.ApplicationModel.AzureOpenAIResource},System.String,System.String,System.String)> method:
5757

5858
```csharp
5959
var builder = DistributedApplication.CreateBuilder(args);
6060

6161
var openai = builder.AddAzureOpenAI("openai");
62+
6263
openai.AddDeployment(
63-
new AzureOpenAIDeployment(
64-
name: "preview",
65-
modelName: "gpt-4.5-preview",
66-
modelVersion: "2025-02-27"));
64+
name: "preview",
65+
modelName: "gpt-4.5-preview",
66+
modelVersion: "2025-02-27");
6767

6868
builder.AddProject<Projects.ExampleProject>()
6969
.WithReference(openai)
@@ -77,7 +77,7 @@ The preceding code:
7777
- Adds an Azure OpenAI resource named `openai`.
7878
- Adds an Azure OpenAI deployment resource named `preview` with a model name of `gpt-4.5-preview`. The model name must correspond to an [available model](/azure/ai-services/openai/concepts/models) in the Azure OpenAI service.
7979

80-
### Generated provisioning Bicep
80+
### Provisioning-generated Bicep
8181

8282
If you're new to [Bicep](/azure/azure-resource-manager/bicep/overview), it's a domain-specific language for defining Azure resources. With .NET Aspire, you don't need to write Bicep by-hand, instead the provisioning APIs generate Bicep for you. When you publish your app, the generated Bicep provisions an Azure OpenAI resource with standard defaults.
8383

docs/azureai/azureai-search-document-integration.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ The preceding code adds an Azure AI Search resource named `search` to the app ho
5151
> [!IMPORTANT]
5252
> When you call <xref:Aspire.Hosting.AzureSearchExtensions.AddAzureSearch*>, it implicitly calls <xref:Aspire.Hosting.AzureProvisionerExtensions.AddAzureProvisioning(Aspire.Hosting.IDistributedApplicationBuilder)>—which adds support for generating Azure resources dynamically during app startup. The app must configure the appropriate subscription and location. For more information, see Local provisioning: Configuration
5353
54-
#### Generated provisioning Bicep
54+
#### Provisioning-generated Bicep
5555

5656
If you're new to [Bicep](/azure/azure-resource-manager/bicep/overview), it's a domain-specific language for defining Azure resources. With .NET Aspire, you don't need to write Bicep by hand; instead, the provisioning APIs generate Bicep for you. When you publish your app, the generated Bicep is output alongside the manifest file. When you add an Azure AI Search resource, Bicep is generated to provision the search service with appropriate defaults.
5757

docs/caching/includes/azure-redis-app-host.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ The preceding call to `AddAzureRedis` configures the Redis server resource to be
4444
> [!TIP]
4545
> When you call <xref:Aspire.Hosting.AzureRedisExtensions.AddAzureRedis*>, it implicitly calls <xref:Aspire.Hosting.AzureProvisionerExtensions.AddAzureProvisioning*>—which adds support for generating Azure resources dynamically during app startup. The app must configure the appropriate subscription and location. For more information, see [Local provisioning: Configuration](../../azure/local-provisioning.md#configuration).
4646
47-
#### Generated provisioning Bicep
47+
#### Provisioning-generated Bicep
4848

4949
If you're new to [Bicep](/azure/azure-resource-manager/bicep/overview), it's a domain-specific language for defining Azure resources. With .NET Aspire, you don't need to write Bicep by-hand, instead the provisioning APIs generate Bicep for you. When you publish your app, the generated Bicep is output alongside the manifest file. When you add an Azure Cache for Redis resource, the following Bicep is generated:
5050

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
---
2+
title: "Breaking change - AzureOpenAIDeployment obsolete"
3+
description: "Learn about the breaking change in .NET Aspire 9.2 where Azure OpenAI deployments are now modeled as .NET Aspire child resources."
4+
ms.date: 4/15/2025
5+
ai-usage: ai-assisted
6+
ms.custom: https://github.com/dotnet/docs-aspire/issues/3059
7+
---
8+
9+
# AzureOpenAIDeployment obsolete
10+
11+
In .NET Aspire 9.2, Azure OpenAI deployments are modeled as .NET Aspire child resources instead of simple objects. This change aligns with the design of other [hosting integrations](../../fundamentals/integrations-overview.md#hosting-integrations) and enables referencing deployments using <xref:Aspire.Hosting.ResourceBuilderExtensions.WithReference*>. As a result, the previous APIs for adding deployments are now obsolete.
12+
13+
## Version introduced
14+
15+
.NET Aspire 9.2
16+
17+
## Previous behavior
18+
19+
Previously, deployments were added as simple objects using the <xref:Aspire.Hosting.ApplicationModel.AzureOpenAIDeployment> class. For example:
20+
21+
```csharp
22+
var builder = DistributedApplication.CreateBuilder(args);
23+
24+
var openAI = builder.AddAzureOpenAI(openAIName);
25+
26+
openAI.AddDeployment(new AzureOpenAIDeployment("chat", "gpt-4o-mini", "2024-07-18"))
27+
.AddDeployment(new AzureOpenAIDeployment("embedding", "text-embedding-3-small", "1"));
28+
```
29+
30+
## New behavior
31+
32+
Deployments are modeled as .NET Aspire child resources and are added using the new overloads. For example, consider the following code:
33+
34+
```csharp
35+
var builder = DistributedApplication.CreateBuilder(args);
36+
37+
var openAI = builder.AddAzureOpenAI(openAIName);
38+
39+
var chatModel = openAI.AddDeployment("chat", "gpt-4o-mini", "2024-07-18");
40+
var embeddingModel = openAI.AddDeployment("embedding", "text-embedding-3-small", "1");
41+
```
42+
43+
## Type of breaking change
44+
45+
This is a [source incompatible](../categories.md#source-compatibility) change.
46+
47+
## Reason for change
48+
49+
Modeling deployments as Aspire resources allows them to be referenced by other resources via `.WithReference`. This design eliminates the need to hard-code model names in .NET applications and enables configuration-based deployment name resolution. It also ensures consistency with other hosting integrations.
50+
51+
## Recommended action
52+
53+
Update your code to use the new overloads for adding deployments. Replace calls to the obsolete APIs with the new pattern. For example:
54+
55+
**Before:**
56+
57+
```csharp
58+
openAI.AddDeployment(new AzureOpenAIDeployment("chat", "gpt-4o-mini", "2024-07-18"));
59+
```
60+
61+
**After:**
62+
63+
```csharp
64+
var chatModel = openAI.AddDeployment("chat", "gpt-4o-mini", "2024-07-18");
65+
```
66+
67+
## Affected APIs
68+
69+
- <xref:Aspire.Hosting.AzureOpenAIExtensions.AddDeployment*>

docs/compatibility/9.2/index.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Breaking changes in .NET Aspire 9.2
33
titleSuffix: ""
44
description: Navigate to the breaking changes in .NET Aspire 9.2.
5-
ms.date: 04/02/2025
5+
ms.date: 04/15/2025
66
---
77

88
# Breaking changes in .NET Aspire 9.2
@@ -19,6 +19,7 @@ If you're migrating an app to .NET Aspire 9.2, the breaking changes listed here
1919
| Title | Type of change | Introduced version |
2020
|--|--|--|
2121
| [AzureContainerApps infrastructure creates managed identity per container app](managed-identity-per-app.md) | Behavioral change | 9.2 |
22+
| [AzureOpenAIDeployment obsolete](azure-openaideployment-obsolete.md) | Source incompatible | 9.2 |
2223
| [KeyVault default role assignment changing from KeyVaultAdministrator to KeyVaultSecretsUser](keyvault-role-assignment-changes.md) | Behavioral change | 9.2 |
2324
| [Role Assignments separated from Azure resource bicep](generated-bicep-updates.md) | Behavioral change | 9.2 |
2425
| [With authentication API creates keyvault resource in the app model](withauthentication-changes.md) | Behavioral change | 9.2 |

docs/compatibility/toc.yml

+2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ items:
1515
items:
1616
- name: Azure Container Apps managed identity changes
1717
href: 9.2/managed-identity-per-app.md
18+
- name: Azure OpenAI deployment obsolete APIs
19+
href: 9.2/azure-openaideployment-obsolete.md
1820
- name: KeyVault default role assignment changes
1921
href: 9.2/keyvault-role-assignment-changes.md
2022
- name: Role Assignments is separate bicep

docs/database/includes/cosmos-app-host.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ When you add an <xref:Aspire.Hosting.AzureCosmosDBResource> to the app host, it
4545
> [!IMPORTANT]
4646
> When you call <xref:Aspire.Hosting.AzureCosmosExtensions.AddAzureCosmosDB*>, it implicitly calls <xref:Aspire.Hosting.AzureProvisionerExtensions.AddAzureProvisioning*>—which adds support for generating Azure resources dynamically during app startup. The app must configure the appropriate subscription and location. For more information, see [Local provisioning: Configuration](../../azure/local-provisioning.md#configuration).
4747
48-
#### Generated provisioning Bicep
48+
#### Provisioning-generated Bicep
4949

5050
If you're new to [Bicep](/azure/azure-resource-manager/bicep/overview), it's a domain-specific language for defining Azure resources. With .NET Aspire, you don't need to write Bicep by-hand, instead the provisioning APIs generate Bicep for you. When you publish your app, the generated Bicep is output alongside the manifest file. When you add an Azure Cosmos DB resource, the following Bicep is generated:
5151

docs/database/includes/postgresql-flexible-server.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ The preceding call to `AddAzurePostgresFlexibleServer` configures the PostgresSQ
5656
> [!TIP]
5757
> When you call <xref:Aspire.Hosting.AzurePostgresExtensions.AddAzurePostgresFlexibleServer*>, it implicitly calls <xref:Aspire.Hosting.AzureProvisionerExtensions.AddAzureProvisioning*>—which adds support for generating Azure resources dynamically during app startup. The app must configure the appropriate subscription and location. For more information, see [Local provisioning: Configuration](../../azure/local-provisioning.md#configuration).
5858
59-
#### Generated provisioning Bicep
59+
#### Provisioning-generated Bicep
6060

6161
If you're new to [Bicep](/azure/azure-resource-manager/bicep/overview), it's a domain-specific language for defining Azure resources. With .NET Aspire, you don't need to write Bicep by hand, because the provisioning APIs generate Bicep for you. When you publish your app, the generated Bicep is output alongside the manifest file. When you add an Azure PostgreSQL resource, the following Bicep is generated:
6262

docs/messaging/azure-event-hubs-integration.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ When you add an Azure Event Hubs resource to the app host, it exposes other usef
5959
> [!IMPORTANT]
6060
> When you call <xref:Aspire.Hosting.AzureEventHubsExtensions.AddAzureEventHubs*>, it implicitly calls <xref:Aspire.Hosting.AzureProvisionerExtensions.AddAzureProvisioning(Aspire.Hosting.IDistributedApplicationBuilder)>—which adds support for generating Azure resources dynamically during app startup. The app must configure the appropriate subscription and location. For more information, see [Local provisioning: Configuration](../azure/local-provisioning.md#configuration)
6161
62-
#### Generated provisioning Bicep
62+
#### Provisioning-generated Bicep
6363

6464
If you're new to [Bicep](/azure/azure-resource-manager/bicep/overview), it's a domain-specific language for defining Azure resources. With .NET Aspire, you don't need to write Bicep by-hand, instead the provisioning APIs generate Bicep for you. When you publish your app, the generated Bicep is output alongside the manifest file. When you add an Azure Event Hubs resource, the following Bicep is generated:
6565

docs/messaging/azure-service-bus-integration.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ When you add an <xref:Aspire.Hosting.Azure.AzureServiceBusResource> to the app h
5656
> [!IMPORTANT]
5757
> When you call <xref:Aspire.Hosting.AzureServiceBusExtensions.AddAzureServiceBus*>, it implicitly calls <xref:Aspire.Hosting.AzureProvisionerExtensions.AddAzureProvisioning*>—which adds support for generating Azure resources dynamically during app startup. The app must configure the appropriate subscription and location. For more information, see [Configuration](../azure/local-provisioning.md#configuration).
5858
59-
#### Generated provisioning Bicep
59+
#### Provisioning-generated Bicep
6060

6161
If you're new to Bicep, it's a domain-specific language for defining Azure resources. With .NET Aspire, you don't need to write Bicep by-hand, instead the provisioning APIs generate Bicep for you. When you publish your app, the generated Bicep is output alongside the manifest file. When you add an Azure Service Bus resource, the following Bicep is generated:
6262

docs/messaging/azure-web-pubsub-integration.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ messagesHub.AddEventHandler(
9393

9494
The preceding code adds a worker service project named `worker` with an external HTTP endpoint. The hub named `messages` resource is added to the `web-pubsub` resource, and an event handler is added to the `messagesHub` resource. The event handler URL is set to the worker service's external HTTP endpoint. For more information, see [Azure Web PubSub event handlers](/azure/azure-web-pubsub/howto-develop-eventhandler).
9595

96-
#### Generated provisioning Bicep
96+
#### Provisioning-generated Bicep
9797

9898
When you publish your app, .NET Aspire provisioning APIs generate Bicep alongside the manifest file. Bicep is a domain-specific language for defining Azure resources. For more information, see [Bicep Overview](/azure/azure-resource-manager/bicep/overview).
9999

docs/real-time/azure-signalr-scenario.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ This architecture allows the `webapp` project to communicate with the `api` proj
6969
> [!IMPORTANT]
7070
> Calling `AddAzureSignalR` implicitly enables Azure provisioning support. Ensure your app host is configured with the appropriate Azure subscription and location. For more information, see [Local provisioning: Configuration](../azure/local-provisioning.md#configuration).
7171
72-
### Generated provisioning Bicep
72+
### Provisioning-generated Bicep
7373

7474
When you add an Azure SignalR Service resource, .NET Aspire generates provisioning infrastructure using [Bicep](/azure/azure-resource-manager/bicep/overview). The generated Bicep includes defaults for location, SKU, and role assignments:
7575

docs/security/azure-security-key-vault-integration.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ The <xref:Aspire.Hosting.ResourceBuilderExtensions.WithReference%2A> method conf
5555
> [!TIP]
5656
> When you call <xref:Aspire.Hosting.AzureKeyVaultResourceExtensions.AddAzureKeyVault*>, it implicitly calls <xref:Aspire.Hosting.AzureProvisionerExtensions.AddAzureProvisioning*>, which adds support for generating Azure resources dynamically during app startup. The app must configure the appropriate subscription and location. For more information, see [Local provisioning: Configuration](../azure/local-provisioning.md#configuration).
5757
58-
#### Generated provisioning Bicep
58+
#### Provisioning-generated Bicep
5959

6060
If you're new to [Bicep](/azure/azure-resource-manager/bicep/overview), it's a domain-specific language for defining Azure resources. With .NET Aspire, you don't need to write Bicep by-hand, instead the provisioning APIs generate Bicep for you. When you publish your app, the generated Bicep is output alongside the manifest file. When you add an Azure Key Vault resource, the following Bicep is generated:
6161

0 commit comments

Comments
 (0)