Add next-gen config + DI tab to local-development-dev-accounts#54371
Draft
alexwolfmsft wants to merge 4 commits into
Draft
Add next-gen config + DI tab to local-development-dev-accounts#54371alexwolfmsft wants to merge 4 commits into
alexwolfmsft wants to merge 4 commits into
Conversation
Add a preview-tab for the Azure.Identity configuration and dependency injection pattern alongside the existing Microsoft.Extensions.Azure flow. Wires AddSecretClient against Azure.Security.KeyVault.Secrets 4.12.0-beta.1 via VersionOverride, suppresses SCME0002, and adds a KeyVaultSecrets appsettings.json section bound by the new snippet region.
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a second, preview “Azure.Identity configuration and dependency injection” tab to the local development authentication article, alongside the existing Microsoft.Extensions.Azure flow, and updates the associated snippet project to compile with the preview registration pattern.
Changes:
- Updated
local-development-dev-accounts.mdto introduce two DI registration patterns (stable vs. preview) and addedai-usagefrontmatter. - Updated the
local-dev-accountsnippet project to suppressSCME0002, reference a preview Key Vault package, and add a new snippet region forAddSecretClient. - Added a matching
KeyVaultSecretsconfiguration section in the snippet’sappsettings.json.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| docs/azure/sdk/authentication/local-development-dev-accounts.md | Adds the new preview tab content and references the new snippet region. |
| docs/azure/sdk/snippets/authentication/local-dev-account/Program.cs | Adds a next-gen registration helper and snippet region for AddSecretClient. |
| docs/azure/sdk/snippets/authentication/local-dev-account/LocalDevAccount.csproj | Suppresses SCME0002 and references a preview Key Vault Secrets package via VersionOverride. |
| docs/azure/sdk/snippets/authentication/local-dev-account/appsettings.json | Adds KeyVaultSecrets configuration used by the new registration snippet. |
Comment on lines
+77
to
+78
| - **Microsoft.Extensions.Azure (stable)** — register clients with `AddAzureClients` and pass a `TokenCredential` to `UseCredential` in code. Use this pattern for production apps today. | ||
| - **Azure.Identity configuration and DI (preview)** — bind clients and their credentials to a section of `appsettings.json`. No `TokenCredential` instance is constructed in code. Tracked by [azure-sdk-for-net#55491](https://github.com/Azure/azure-sdk-for-net/issues/55491). |
|
|
||
| The package pulls in a compatible prerelease of `Azure.Identity` transitively. | ||
|
|
||
| 1. In `appsettings.json`, add a section that describes the client endpoint and credential. The section name is arbitrary — you reference it by name when you register the client: |
|
|
||
| :::code language="csharp" source="../snippets/authentication/local-dev-account/Program.cs" id="snippet_NextGenAddSecretClient"::: | ||
|
|
||
| The credential is resolved from the `Credential` subsection automatically — no `TokenCredential` instance is constructed in code. |
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
Adds a preview tab for the Azure.Identity configuration and dependency injection pattern alongside the existing Microsoft.Extensions.Azure flow in docs/azure/sdk/authentication/local-development-dev-accounts.md. The next-gen pattern is tracked by
Azure/azure-sdk-for-net#55491and ships service-specific extensions likeAddSecretClientthat bind clients (and their credentials) to anappsettings.jsonsection, with noTokenCredentialconstructed in code.Changes
Article — local-development-dev-accounts.md
ms.datebumped to06/12/2026; addedai-usage: ai-assisted.### Implement the codeblock under "Authenticate to Azure services from your app" with two###-level tabs:AddAzureClients+UseCredentialwalkthrough, unchanged.SCME0002callout with the<NoWarn>snippet, then steps fordotnet package add --prerelease, theKeyVaultSecretsappsettings.jsonschema (with the full list of supportedCredentialSourcevalues), and thebuilder.AddSecretClient("KeyVaultSecrets")registration. Closing note explains the fallback to genericbuilder.AddAzureClient<T, TSettings>for libraries that haven't shipped service-specific extensions yet.Snippet project — docs/azure/sdk/snippets/authentication/local-dev-account/
<NoWarn>$(NoWarn);SCME0002</NoWarn>in thePropertyGroup.<PackageReference Include="Azure.Security.KeyVault.Secrets" VersionOverride="4.12.0-beta.1" />— per-project override so the sharedDirectory.Packages.propsstays on the stable 4.11.0 line for the five sibling snippet projects.using Azure.Security.KeyVault.Secrets;.registerUsingNextGen(WebApplicationBuilder)function with asnippet_NextGenAddSecretClientregion containingbuilder.AddSecretClient("KeyVaultSecrets");.WebApplication.CreateBuilderflow so the snippet compiles in context.KeyVaultSecretssection withVaultUriandCredential.CredentialSource.Validation
dotnet buildonLocalDevAccount.csproj→ 0 errors, 0 warnings.snippet_NextGenAddSecretClient) match the new:::codereference in the article.#implement-the-code, so removing that heading is safe.AI usage
This PR was authored with AI assistance using GitHub Copilot. The
ai-usage: ai-assistedfrontmatter field was added accordingly.Open considerations
Azure.Security.KeyVault.Secrets 4.12.0-beta.1) and theSCME0002diagnostic will both need a revisit once the APIs stabilize. The "rolling out incrementally" note in the next-gen tab should also be revisited as more service libraries adopt the pattern.Internal previews