Skip to content

Conversation

@scottaddie
Copy link
Member

@scottaddie scottaddie commented Nov 5, 2025

Add a code sample showing how to pass the env var to the DAC ctor


Internal previews

📄 File 🔗 Preview link
docs/azure/sdk/authentication/credential-chains.md docs/azure/sdk/authentication/credential-chains

Copilot AI review requested due to automatic review settings November 5, 2025 19:33
@dotnetrepoman dotnetrepoman bot added this to the November 2025 milestone Nov 5, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds a code example demonstrating the use of the DefaultAzureCredential constructor overload that accepts an environment variable name. The documentation is updated to provide a concrete code sample for readers.

  • Adds a new code snippet (snippet_DacEnvVar) showing how to use the constructor overload with DefaultEnvironmentVariableName.
  • Updates the markdown documentation to reference this new snippet in two locations where the constructor overload is mentioned.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
docs/azure/sdk/snippets/authentication/credential-chains/Program.cs Adds new code snippet demonstrating DefaultAzureCredential constructor with environment variable parameter
docs/azure/sdk/authentication/credential-chains.md Updates documentation date and adds references to new code snippet in two sections discussing environment variable usage

> The `AZURE_TOKEN_CREDENTIALS` environment variable supports individual credential names in `Azure.Identity` package versions 1.15.0 and later.
To ensure the environment variable is defined and set to a supported string, use constructor overload <xref:Azure.Identity.DefaultAzureCredential.%23ctor(System.String,Azure.Identity.DefaultAzureCredentialOptions)?displayProperty=name>.
To ensure the environment variable is defined and set to a supported string, use constructor overload <xref:Azure.Identity.DefaultAzureCredential.%23ctor(System.String,Azure.Identity.DefaultAzureCredentialOptions)?displayProperty=name>:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we validate the environment variable value no matter which approach you take. Should we reword this so that it says something like - "DefaultAzureCredential will validate the value set for the enviornmnent variable and will throw if validation fails."

@scottaddie scottaddie marked this pull request as draft November 6, 2025 16:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants