Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve Azure Identity credential env var docs #47889

Merged
merged 6 commits into from
Jan 21, 2025
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -48,6 +48,9 @@ public T Value
/// <summary>
/// The ID of the tenant to which the credential will authenticate by default. If not specified, the credential will authenticate to any requested tenant, and will default to the tenant to which the chosen authentication method was originally authenticated.
/// </summary>
/// <remarks>
/// Defaults to the value of environment variable <c>AZURE_TENANT_ID</c>.
/// </remarks>
public string TenantId
{
get => _tenantId.Value;
@@ -81,12 +84,10 @@ public string TenantId
}

/// <summary>
/// The tenant ID of the user to authenticate, in the case the <see cref="DefaultAzureCredential"/> authenticates through, the
/// The tenant id of the user to authenticate, in the case the <see cref="DefaultAzureCredential"/> authenticates through, the
/// <see cref="InteractiveBrowserCredential"/>. The default is null and will authenticate users to their default tenant.
/// The value can also be set by setting the environment variable AZURE_TENANT_ID.
/// </summary>
/// <remarks>
/// This value can alternatively be set via environment variable <c>AZURE_TENANT_ID</c>.
/// </remarks>
[EditorBrowsable(EditorBrowsableState.Never)]
public string InteractiveBrowserTenantId
{
@@ -126,12 +127,10 @@ public string SharedTokenCacheTenantId
}

/// <summary>
/// The tenant ID of the user to authenticate, in the case the <see cref="DefaultAzureCredential"/> authenticates through, the
/// The tenant id of the user to authenticate, in the case the <see cref="DefaultAzureCredential"/> authenticates through, the
/// <see cref="VisualStudioCredential"/>. The default is null and will authenticate users to their default tenant.
/// The value can also be set by setting the environment variable AZURE_TENANT_ID.
/// </summary>
/// <remarks>
/// This value can alternatively be set via environment variable <c>AZURE_TENANT_ID</c>.
/// </remarks>
[EditorBrowsable(EditorBrowsableState.Never)]
public string VisualStudioTenantId
{
@@ -150,10 +149,8 @@ public string VisualStudioTenantId
/// <summary>
/// The tenant ID of the user to authenticate, in the case the <see cref="DefaultAzureCredential"/> authenticates through, the
/// <see cref="VisualStudioCodeCredential"/>. The default is null and will authenticate users to their default tenant.
/// The value can also be set by setting the environment variable AZURE_TENANT_ID.
/// </summary>
/// <remarks>
/// This value can alternatively be set via environment variable <c>AZURE_TENANT_ID</c>.
/// </remarks>
[EditorBrowsable(EditorBrowsableState.Never)]
public string VisualStudioCodeTenantId
{
@@ -175,7 +172,7 @@ public string VisualStudioCodeTenantId
/// If no value is specified for <see cref="TenantId"/>, this option will have no effect on that authentication method, and the credential will acquire tokens for any requested tenant when using that method.
/// </summary>
/// <remarks>
/// This value can alternatively be set via environment variable <c>AZURE_ADDITIONALLY_ALLOWED_TENANTS</c>.
/// Defaults to the value of environment variable <c>AZURE_ADDITIONALLY_ALLOWED_TENANTS</c>.
/// </remarks>
public IList<string> AdditionallyAllowedTenants { get; internal set; } = EnvironmentVariables.AdditionallyAllowedTenants;

@@ -186,7 +183,7 @@ public string VisualStudioCodeTenantId
/// <remarks>
/// If multiple accounts are found in the shared token cache and no value is specified, or the specified value matches no accounts in
/// the cache, the SharedTokenCacheCredential won't be used for authentication.
/// This value can alternatively be set via environment variable <c>AZURE_USERNAME</c>.
/// Defaults to the value of environment variable <c>AZURE_USERNAME</c>.
/// </remarks>
public string SharedTokenCacheUsername { get; set; } = EnvironmentVariables.Username;

@@ -199,7 +196,7 @@ public string VisualStudioCodeTenantId
/// Specifies the client ID of the application the workload identity will authenticate.
/// </summary>
/// <remarks>
/// This value can alternatively be set via environment variable <c>AZURE_CLIENT_ID</c>.
/// Defaults to the value of environment variable <c>AZURE_CLIENT_ID</c>.
/// </remarks>
public string WorkloadIdentityClientId { get; set; } = EnvironmentVariables.ClientId;

@@ -208,7 +205,7 @@ public string VisualStudioCodeTenantId
/// </summary>
/// <remarks>
/// If neither the <see cref="ManagedIdentityClientId"/> nor the <see cref="ManagedIdentityResourceId"/> property is set, then a system-assigned managed identity is used.
/// This value can alternatively be set via environment variable <c>AZURE_CLIENT_ID</c>.
/// Defaults to the value of environment variable <c>AZURE_CLIENT_ID</c>.
/// </remarks>
public string ManagedIdentityClientId { get; set; } = EnvironmentVariables.ClientId;

@@ -226,13 +223,13 @@ public string VisualStudioCodeTenantId
public TimeSpan? CredentialProcessTimeout { get; set; } = TimeSpan.FromSeconds(30);

/// <summary>
/// Specifies whether the <see cref="EnvironmentCredential"/> will be excluded from the authentication flow. Setting to true disables reading
/// Specifies whether the <see cref="EnvironmentCredential"/> will be excluded from the authentication flow. Setting to <c>true</c> disables reading
/// authentication details from the process' environment variables.
/// </summary>
public bool ExcludeEnvironmentCredential { get; set; }

/// <summary>
/// Specifies whether the <see cref="WorkloadIdentityCredential"/> will be excluded from the authentication flow. Setting to true disables reading
/// Specifies whether the <see cref="WorkloadIdentityCredential"/> will be excluded from the authentication flow. Setting to <c>true</c> disables reading
/// authentication details from the process' environment variables.
/// </summary>
public bool ExcludeWorkloadIdentityCredential { get; set; }
@@ -250,7 +247,7 @@ public string VisualStudioCodeTenantId

/// <summary>
/// Specifies whether the <see cref="SharedTokenCacheCredential"/> will be excluded from the <see cref="DefaultAzureCredential"/> authentication flow.
/// Setting to <c>true</c> disables single sign on authentication with development tools which write to the shared token cache.
/// Setting to <c>true</c> disables single sign-on authentication with development tools which write to the shared token cache.
/// The default is <c>true</c>.
/// </summary>
public bool ExcludeSharedTokenCacheCredential { get; set; } = true;
Original file line number Diff line number Diff line change
@@ -41,7 +41,7 @@ public class EnvironmentCredentialOptions : TokenCredentialOptions, ISupportsDis
internal bool SendCertificateChain { get; set; } = EnvironmentVariables.ClientSendCertificateChain;

/// <summary>
/// The username of the user account the credeential will authenticate. This value defaults to the value of the environment variable AZURE_USERNAME.
/// The username of the user account the credential will authenticate. This value defaults to the value of the environment variable AZURE_USERNAME.
/// </summary>
internal string Username { get; set; } = EnvironmentVariables.Username;

@@ -67,8 +67,10 @@ public class EnvironmentCredentialOptions : TokenCredentialOptions, ISupportsDis
/// Specifies tenants in addition to the specified <see cref="TenantId"/> for which the credential may acquire tokens.
/// Add the wildcard value "*" to allow the credential to acquire tokens for any tenant the logged in account can access.
/// If no value is specified for <see cref="TenantId"/>, this option will have no effect on that authentication method, and the credential will acquire tokens for any requested tenant when using that method.
/// This value defaults to the value of the environment variable AZURE_ADDITIONALLY_ALLOWED_TENANTS.
/// </summary>
/// <remarks>
/// Defaults to the value of environment variable <c>AZURE_ADDITIONALLY_ALLOWED_TENANTS</c>.
/// </remarks>
public IList<string> AdditionallyAllowedTenants { get; internal set; } = EnvironmentVariables.AdditionallyAllowedTenants;
}
}
Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@ namespace Azure.Identity
public class UsernamePasswordCredentialOptions : TokenCredentialOptions, ISupportsTokenCachePersistenceOptions, ISupportsDisableInstanceDiscovery, ISupportsAdditionallyAllowedTenants
{
/// <summary>
/// Specifies the <see cref="TokenCachePersistenceOptions"/> to be used by the credential. If not options are specified, the token cache will not be persisted to disk.
/// Specifies the <see cref="TokenCachePersistenceOptions"/> to be used by the credential. If no options are specified, the token cache will not be persisted to disk.
/// </summary>
public TokenCachePersistenceOptions TokenCachePersistenceOptions { get; set; }

Original file line number Diff line number Diff line change
@@ -13,18 +13,27 @@ namespace Azure.Identity
public class WorkloadIdentityCredentialOptions : TokenCredentialOptions, ISupportsDisableInstanceDiscovery, ISupportsAdditionallyAllowedTenants
{
/// <summary>
/// The tenant ID of the service principal. Defaults to the value of the environment variable AZURE_TENANT_ID.
/// The tenant ID of the service principal.
/// </summary>
/// <remarks>
/// Defaults to the value of environment variable <c>AZURE_TENANT_ID</c>.
/// </remarks>
public string TenantId { get; set; } = EnvironmentVariables.TenantId;

/// <summary>
/// The client (application) ID of the service principal. Defaults to the value of the environment variable AZURE_CLIENT_ID.
/// The client (application) ID of the service principal.
/// </summary>
/// <remarks>
/// Defaults to the value of environment variable <c>AZURE_CLIENT_ID</c>.
/// </remarks>
public string ClientId { get; set; } = EnvironmentVariables.ClientId;

/// <summary>
/// The path to a file containing the workload identity token. Defaults to the value of the environment variable AZURE_FEDERATED_TOKEN_FILE.
/// The path to a file containing the workload identity token.
/// </summary>
/// <remarks>
/// Defaults to the value of environment variable <c>AZURE_FEDERATED_TOKEN_FILE</c>.
/// </remarks>
public string TokenFilePath { get; set; } = EnvironmentVariables.AzureFederatedTokenFile;

/// <inheritdoc />
@@ -34,8 +43,10 @@ public class WorkloadIdentityCredentialOptions : TokenCredentialOptions, ISuppor
/// Specifies tenants in addition to the specified <see cref="TenantId"/> for which the credential may acquire tokens.
/// Add the wildcard value "*" to allow the credential to acquire tokens for any tenant the logged in account can access.
/// If no value is specified for <see cref="TenantId"/>, this option will have no effect, and the credential will acquire tokens for any requested tenant.
/// Defaults to the value of the environment variable AZURE_ADDITIONALLY_ALLOWED_TENANTS.
/// </summary>
/// <remarks>
/// Defaults to the value of environment variable <c>AZURE_ADDITIONALLY_ALLOWED_TENANTS</c>.
/// </remarks>
public IList<string> AdditionallyAllowedTenants { get; internal set; } = EnvironmentVariables.AdditionallyAllowedTenants;

internal CredentialPipeline Pipeline { get; set; }