Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the Azure SDK dependency injection code snippets to migrate from the Azure.AI.OpenAI package (version 2.1.0) to the OpenAI package (version 2.7.0). The changes affect multiple example projects demonstrating dependency injection patterns with different application builders.
- Replaces
Azure.AI.OpenAIwithOpenAIpackage and updates client usage patterns - Introduces
OpenAIResponseClientwithBearerTokenPolicyfor Azure authentication - Adds environment variable validation for
AZURE_OPENAI_ENDPOINT
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| docs/azure/sdk/snippets/dependency-injection/WebApplicationBuilder/WebApplicationBuilder.csproj | Replaces Azure.AI.OpenAI package reference with OpenAI package |
| docs/azure/sdk/snippets/dependency-injection/WebApplicationBuilder/Program.cs | Updates OpenAI client registration to use new OpenAI package with custom authentication |
| docs/azure/sdk/snippets/dependency-injection/HostBuilder/Program.cs | Updates OpenAI client registration to use new OpenAI package with custom authentication |
| docs/azure/sdk/snippets/dependency-injection/HostBuilder/HostBuilder.csproj | Replaces Azure.AI.OpenAI package reference with OpenAI package |
| docs/azure/sdk/snippets/dependency-injection/HostApplicationBuilder/Program.cs | Updates OpenAI client registration to use new OpenAI package with custom authentication |
| docs/azure/sdk/snippets/dependency-injection/HostApplicationBuilder/HostApplicationBuilder.csproj | Replaces Azure.AI.OpenAI package reference with OpenAI package |
| docs/azure/sdk/snippets/dependency-injection/Directory.Packages.props | Updates central package version management from Azure.AI.OpenAI 2.1.0 to OpenAI 2.7.0 |
| docs/azure/sdk/snippets/authentication/Directory.Packages.props | Updates central package version management from Azure.AI.OpenAI 2.1.0 to OpenAI 2.7.0 |
docs/azure/sdk/snippets/dependency-injection/WebApplicationBuilder/Program.cs
Outdated
Show resolved
Hide resolved
docs/azure/sdk/snippets/dependency-injection/HostBuilder/Program.cs
Outdated
Show resolved
Hide resolved
docs/azure/sdk/snippets/dependency-injection/HostApplicationBuilder/Program.cs
Outdated
Show resolved
Hide resolved
docs/azure/sdk/snippets/dependency-injection/WebApplicationBuilder/WebApplicationBuilder.csproj
Show resolved
Hide resolved
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
scottaddie
reviewed
Dec 11, 2025
docs/azure/sdk/snippets/dependency-injection/HostApplicationBuilder/Program.cs
Outdated
Show resolved
Hide resolved
docs/azure/sdk/snippets/dependency-injection/HostApplicationBuilder/Program.cs
Outdated
Show resolved
Hide resolved
docs/azure/sdk/snippets/dependency-injection/HostBuilder/Program.cs
Outdated
Show resolved
Hide resolved
docs/azure/sdk/snippets/dependency-injection/HostBuilder/Program.cs
Outdated
Show resolved
Hide resolved
docs/azure/sdk/snippets/dependency-injection/WebApplicationBuilder/Program.cs
Outdated
Show resolved
Hide resolved
docs/azure/sdk/snippets/dependency-injection/WebApplicationBuilder/Program.cs
Outdated
Show resolved
Hide resolved
Co-authored-by: Scott Addie <10702007+scottaddie@users.noreply.github.com>
scottaddie
reviewed
Dec 11, 2025
docs/azure/sdk/snippets/dependency-injection/HostApplicationBuilder/Program.cs
Show resolved
Hide resolved
docs/azure/sdk/snippets/dependency-injection/HostBuilder/Program.cs
Outdated
Show resolved
Hide resolved
docs/azure/sdk/snippets/dependency-injection/WebApplicationBuilder/Program.cs
Show resolved
Hide resolved
Co-authored-by: Scott Addie <10702007+scottaddie@users.noreply.github.com>
christothes
reviewed
Dec 11, 2025
docs/azure/sdk/snippets/authentication/Directory.Packages.props
Outdated
Show resolved
Hide resolved
gewarren
approved these changes
Dec 11, 2025
scottaddie
reviewed
Dec 12, 2025
Member
scottaddie
left a comment
There was a problem hiding this comment.
These changes will successfully upgrade the code to use v2.8.0 of the OpenAI package
docs/azure/sdk/snippets/authentication/Directory.Packages.props
Outdated
Show resolved
Hide resolved
docs/azure/sdk/snippets/dependency-injection/HostApplicationBuilder/Program.cs
Outdated
Show resolved
Hide resolved
docs/azure/sdk/snippets/dependency-injection/HostBuilder/Program.cs
Outdated
Show resolved
Hide resolved
docs/azure/sdk/snippets/dependency-injection/WebApplicationBuilder/Program.cs
Outdated
Show resolved
Hide resolved
docs/azure/sdk/snippets/dependency-injection/Directory.Packages.props
Outdated
Show resolved
Hide resolved
Co-authored-by: Scott Addie <10702007+scottaddie@users.noreply.github.com>
scottaddie
approved these changes
Dec 12, 2025
docs/azure/sdk/snippets/dependency-injection/HostBuilder/Program.cs
Outdated
Show resolved
Hide resolved
docs/azure/sdk/snippets/dependency-injection/HostApplicationBuilder/Program.cs
Outdated
Show resolved
Hide resolved
docs/azure/sdk/snippets/dependency-injection/WebApplicationBuilder/Program.cs
Outdated
Show resolved
Hide resolved
Co-authored-by: Scott Addie <10702007+scottaddie@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Describe your changes here.
Fixes #Issue_Number (if available)
Internal previews