fINTERACTIVE FIELD GUIDES
SDKs and exchange20 / 30

Azure Identity SDKs

Supported Azure Identity client libraries consume the injected environment variables and projected token to authenticate without application-managed secrets.

Learning status: Not practiced

Use the Azure Identity client library for the language of the workload. DefaultAzureCredential can select Workload ID in the supported library versions; WorkloadIdentityCredential can be used directly when the application is specifically configured for this flow.

LanguagePackageTypical credential
.NETAzure.IdentityDefaultAzureCredential or WorkloadIdentityCredential
JavaScript / TypeScript@azure/identityDefaultAzureCredential or WorkloadIdentityCredential
Pythonazure-identityDefaultAzureCredential or WorkloadIdentityCredential
Javacom.azure:azure-identityDefaultAzureCredential or WorkloadIdentityCredential
Gogithub.com/Azure/azure-sdk-for-go/sdk/azidentityNewDefaultAzureCredential or NewWorkloadIdentityCredential
C++azure-identity-cppDefaultAzureCredential

Use a current supported package version. Microsoft Learn's Workload ID overview lists ecosystem-specific minimum versions; those minimums can change, so check the current page before pinning a version.

Example with JavaScript:

import { DefaultAzureCredential } from "@azure/identity";
import { SecretClient } from "@azure/keyvault-secrets";

const credential = new DefaultAzureCredential();
const client = new SecretClient("https://<vault-name>.vault.azure.net", credential);

The SDK uses the webhook-injected variables and reads AZURE_FEDERATED_TOKEN_FILE. Do not pass a client secret or hard-code the token file path.

Source: Azure Identity client libraries for AKS Workload ID.