[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill-microsoft-azure-identity-py":3,"mdc--2n1z3l-key":42,"related-repo-microsoft-azure-identity-py":4103,"related-org-microsoft-azure-identity-py":4212},{"slug":4,"name":4,"fn":5,"description":6,"org":7,"tags":11,"stars":25,"repoUrl":26,"updatedAt":27,"license":28,"forks":29,"topics":30,"repo":37,"sourceUrl":40,"mdContent":41},"azure-identity-py","authenticate with Azure Identity SDK","Azure Identity SDK for Python authentication with Microsoft Entra ID. Use for DefaultAzureCredential, managed identity, service principals, and token caching.\nTriggers: \"azure-identity\", \"DefaultAzureCredential\", \"authentication\", \"managed identity\", \"service principal\", \"credential\".\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},"microsoft","Microsoft","https:\u002F\u002Fpexgzepcugksgbtrxkhf.supabase.co\u002Fstorage\u002Fv1\u002Fobject\u002Fpublic\u002Forg-logos\u002Fmicrosoft.png",[12,16,19,22],{"name":13,"slug":14,"type":15},"Azure","azure","tag",{"name":17,"slug":18,"type":15},"Python","python",{"name":20,"slug":21,"type":15},"Authentication","authentication",{"name":23,"slug":24,"type":15},"Entra ID","entra-id",2804,"https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fskills","2026-07-18T05:14:24.994882","MIT",315,[31,32,14,33,34,35,36],"agent-skills","agents","foundry","mcp","sdk","skills",{"repoUrl":26,"stars":25,"forks":29,"topics":38,"description":39},[31,32,14,33,34,35,36],"Skills, MCP servers, Custom Agents, Agents.md for SDKs to ground Coding Agents","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fskills\u002Ftree\u002FHEAD\u002F.github\u002Fplugins\u002Fazure-sdk-python\u002Fskills\u002Fazure-identity-py","---\nname: azure-identity-py\ndescription: |\n  Azure Identity SDK for Python authentication with Microsoft Entra ID. Use for DefaultAzureCredential, managed identity, service principals, and token caching.\n  Triggers: \"azure-identity\", \"DefaultAzureCredential\", \"authentication\", \"managed identity\", \"service principal\", \"credential\".\nlicense: MIT\nmetadata:\n  author: Microsoft\n  version: \"1.0.0\"\n  package: azure-identity\n---\n\n# Azure Identity library for Python\n\nAuthentication library for Azure SDK clients using Microsoft Entra ID.\n\nUse this skill when:\n- An app needs to authenticate to Azure services from Python\n- You need `DefaultAzureCredential` for local dev + Azure deployment\n- You need `ManagedIdentityCredential` for Azure-hosted workloads\n- You need service principal auth with secret or certificate\n- You need direct token acquisition with `get_token()`\n- You need to troubleshoot credential chain failures\n\n## Installation\n\n```bash\npip install azure-identity\n```\n\nFor VS Code or broker-based desktop auth:\n\n```bash\npip install azure-identity-broker\n```\n\n## Python Version\n\n`azure-identity` supports Python 3.9+.\n\n## Environment Variables\n\n```bash\n# Service principal with client secret\nAZURE_TENANT_ID=\u003Cyour-tenant-id>\nAZURE_CLIENT_ID=\u003Cyour-client-id>\nAZURE_CLIENT_SECRET=\u003Cyour-client-secret>\n\n# Service principal with certificate\nAZURE_TENANT_ID=\u003Cyour-tenant-id>\nAZURE_CLIENT_ID=\u003Cyour-client-id>\nAZURE_CLIENT_CERTIFICATE_PATH=\u002Fpath\u002Fto\u002Fcert.pem\nAZURE_CLIENT_CERTIFICATE_PASSWORD=\u003Coptional-password>\n\n# Authority (sovereign clouds)\nAZURE_AUTHORITY_HOST=login.microsoftonline.com  # Default; or login.chinacloudapi.cn, login.microsoftonline.us\n\n# User-assigned managed identity\nAZURE_CLIENT_ID=\u003Cmanaged-identity-client-id>\n\n# Credential selection (new)\nAZURE_TOKEN_CREDENTIALS=dev|prod|\u003Ccredential-name>  # Optional, restricts DAC chain\n```\n\n## Authentication & Lifecycle\n\n> **🔑 Two rules apply to every code sample below:**\n>\n> 1. **Prefer `DefaultAzureCredential`.** It works locally (Azure CLI \u002F VS Code \u002F Developer CLI) and in Azure (managed identity, workload identity) with no code change. Avoid connection strings, account\u002FAPI keys — they bypass Entra audit and rotation.\n>    - Local dev: `DefaultAzureCredential` works as-is.\n>    - Production: set `AZURE_TOKEN_CREDENTIALS=prod` (or `AZURE_TOKEN_CREDENTIALS=\u003Cspecific_credential>`) to constrain the credential chain to production-safe credentials.\n> 2. **Wrap credentials and clients in context managers** when they own token caches \u002F transports:\n>    - Sync: `with DefaultAzureCredential() as credential:`\n>    - Async: `async with DefaultAzureCredential() as credential:` (from `azure.identity.aio`)\n>\n> Snippets may abbreviate this setup, but production code should always follow both rules.\n\n### DefaultAzureCredential\n\nThe recommended credential for most scenarios. Tries multiple authentication methods in order:\n\n```python\nfrom azure.identity import DefaultAzureCredential\nfrom azure.storage.blob import BlobServiceClient\n\n# Works in local dev AND production without code changes\ncredential = DefaultAzureCredential()\n\nwith BlobServiceClient(\n    account_url=\"https:\u002F\u002F\u003Caccount>.blob.core.windows.net\",\n    credential=credential\n) as client:\n    containers = list(client.list_containers())\n```\n\n### Credential Chain Order\n\nSee [DefaultAzureCredential overview](https:\u002F\u002Faka.ms\u002Fazsdk\u002Fpython\u002Fidentity\u002Fcredential-chains#defaultazurecredential-overview) for the current credential chain order and defaults.\n\n### Customizing DefaultAzureCredential\n\n```python\n# Exclude credentials you don't need\ncredential = DefaultAzureCredential(\n    exclude_environment_credential=True,\n    exclude_shared_token_cache_credential=True,\n    managed_identity_client_id=\"\u003Cuser-assigned-mi-client-id>\"  # For user-assigned MI (also accepts object ID or resource ID)\n)\n\n# Enable interactive browser (disabled by default)\ncredential = DefaultAzureCredential(\n    exclude_interactive_browser_credential=False\n)\n\n# Set subprocess timeout for CLI-based credentials (default: 10s)\ncredential = DefaultAzureCredential(process_timeout=30)\n\n# Require AZURE_TOKEN_CREDENTIALS env var to be set\ncredential = DefaultAzureCredential(require_envvar=True)\n```\n\n### Exclude Parameters\n\n| Parameter | Default | Effect |\n|-----------|---------|--------|\n| `exclude_environment_credential` | False | Skip env-var-based auth |\n| `exclude_workload_identity_credential` | False | Skip Kubernetes workload identity |\n| `exclude_managed_identity_credential` | False | Skip managed identity |\n| `exclude_shared_token_cache_credential` | False | Skip shared token cache |\n| `exclude_visual_studio_code_credential` | False | Skip VS Code credential |\n| `exclude_cli_credential` | False | Skip Azure CLI |\n| `exclude_powershell_credential` | False | Skip Azure PowerShell |\n| `exclude_developer_cli_credential` | False | Skip Azure Developer CLI |\n| `exclude_interactive_browser_credential` | **True** | Skip interactive browser |\n| `exclude_broker_credential` | False | Skip WAM broker |\n\n## get_bearer_token_provider\n\nHelper that wraps a credential into a callable returning a bearer token string. Essential for OpenAI SDK and other non-Azure-SDK clients:\n\n```python\nfrom azure.identity import DefaultAzureCredential, get_bearer_token_provider\n\ncredential = DefaultAzureCredential()\ntoken_provider = get_bearer_token_provider(\n    credential, \"https:\u002F\u002Fcognitiveservices.azure.com\u002F.default\"\n)\n\n# Use with OpenAI SDK\nfrom openai import AzureOpenAI\n\nwith AzureOpenAI(\n    azure_endpoint=\"https:\u002F\u002F\u003Cresource>.openai.azure.com\u002F\",\n    azure_ad_token_provider=token_provider,\n    api_version=\"2024-10-21\",\n) as client:\n    # response = client.chat.completions.create(...)\n    ...\n```\n\n## Credential Types\n\n### Credential Chains\n\n| Credential | Use Case |\n|------------|----------|\n| `DefaultAzureCredential` | Most scenarios — auto-detects environment |\n| `ChainedTokenCredential` | Custom credential chain with explicit ordering |\n\n### Azure-Hosted Applications\n\n| Credential | Use Case |\n|------------|----------|\n| `EnvironmentCredential` | Auth via AZURE_CLIENT_SECRET \u002F AZURE_CLIENT_CERTIFICATE_PATH env vars |\n| `ManagedIdentityCredential` | Azure VMs, App Service, Functions, AKS, Arc, Service Fabric |\n| `WorkloadIdentityCredential` | Kubernetes with Microsoft Entra Workload ID |\n\n### Service Principals\n\n| Credential | Use Case |\n|------------|----------|\n| `ClientSecretCredential` | Service principal with client secret |\n| `CertificateCredential` | Service principal with PEM\u002FPKCS12 certificate |\n| `ClientAssertionCredential` | Service principal with signed JWT assertion |\n| `AzurePipelinesCredential` | Azure Pipelines with workload identity federation |\n| `OnBehalfOfCredential` | Middle-tier on-behalf-of flow (delegated user identity) |\n\n### User Authentication\n\n| Credential | Use Case |\n|------------|----------|\n| `InteractiveBrowserCredential` | Interactive browser OAuth sign-in |\n| `DeviceCodeCredential` | Headless\u002FSSH device code flow |\n| `AuthorizationCodeCredential` | Previously obtained authorization code |\n\n### Developer Tools\n\n| Credential | Use Case |\n|------------|----------|\n| `AzureCliCredential` | `az login` |\n| `AzureDeveloperCliCredential` | `azd auth login` |\n| `AzurePowerShellCredential` | `Connect-AzAccount` |\n| `VisualStudioCodeCredential` | VS Code Azure Resources extension |\n\n## Specific Credential Examples\n\n### ManagedIdentityCredential\n\nFor Azure-hosted resources (VMs, App Service, Functions, AKS):\n\n```python\nfrom azure.identity import ManagedIdentityCredential\n\n# System-assigned managed identity\ncredential = ManagedIdentityCredential()\n\n# User-assigned managed identity (client_id, object_id, or resource_id)\ncredential = ManagedIdentityCredential(\n    client_id=\"\u003Cuser-assigned-mi-client-id>\"\n)\n# Also valid:\n# credential = ManagedIdentityCredential(object_id=\"\u003Cobject-id>\")\n# credential = ManagedIdentityCredential(resource_id=\"\u003Cresource-id>\")\n```\n\n### ClientSecretCredential\n\n```python\nimport os\nfrom azure.identity import ClientSecretCredential\n\ncredential = ClientSecretCredential(\n    tenant_id=os.environ[\"AZURE_TENANT_ID\"],\n    client_id=os.environ[\"AZURE_CLIENT_ID\"],\n    client_secret=os.environ[\"AZURE_CLIENT_SECRET\"],\n)\n```\n\n### CertificateCredential\n\n> **Note:** The class is `CertificateCredential`, NOT `ClientCertificateCredential`.\n\n```python\nfrom azure.identity import CertificateCredential\n\n# From file path\ncredential = CertificateCredential(\n    tenant_id=\"\u003Ctenant-id>\",\n    client_id=\"\u003Cclient-id>\",\n    certificate_path=\"\u002Fpath\u002Fto\u002Fcert.pem\",\n)\n\n# From bytes with password\ncredential = CertificateCredential(\n    tenant_id=\"\u003Ctenant-id>\",\n    client_id=\"\u003Cclient-id>\",\n    certificate_data=cert_bytes,\n    password=\"\u003Ccert-password>\",\n    send_certificate_chain=True,  # Required for SNI auth\n)\n```\n\n### AzureCliCredential\n\n```python\nfrom azure.identity import AzureCliCredential\n\ncredential = AzureCliCredential()\n# With tenant restriction\ncredential = AzureCliCredential(tenant_id=\"\u003Ctenant-id>\")\n```\n\n### ChainedTokenCredential\n\nCustom credential chain:\n\n```python\nfrom azure.identity import (\n    ChainedTokenCredential,\n    ManagedIdentityCredential,\n    AzureCliCredential,\n)\n\n# Try managed identity first, fall back to CLI\ncredential = ChainedTokenCredential(\n    ManagedIdentityCredential(client_id=\"\u003Cuser-assigned-mi-client-id>\"),\n    AzureCliCredential(),\n)\n```\n\n### WorkloadIdentityCredential\n\nFor Azure Kubernetes Service with workload identity:\n\n```python\nfrom azure.identity import WorkloadIdentityCredential\n\n# Reads from AZURE_TENANT_ID, AZURE_CLIENT_ID, AZURE_FEDERATED_TOKEN_FILE\ncredential = WorkloadIdentityCredential()\n\n# Or explicit configuration\ncredential = WorkloadIdentityCredential(\n    tenant_id=\"\u003Ctenant-id>\",\n    client_id=\"\u003Cclient-id>\",\n    token_file_path=\"\u002Fvar\u002Frun\u002Fsecrets\u002Fazure\u002Ftokens\u002Fazure-identity-token\",\n)\n```\n\n### DeviceCodeCredential\n\nFor headless devices (IoT, SSH, CLI tools):\n\n```python\nfrom azure.identity import DeviceCodeCredential\n\ncredential = DeviceCodeCredential()\n# Prints device code prompt to stdout by default\n\n# With custom prompt callback\ndef prompt_callback(verification_uri, user_code, expires_on):\n    print(f\"Go to {verification_uri} and enter code {user_code}\")\n\ncredential = DeviceCodeCredential(\n    client_id=\"\u003Cclient-id>\",\n    prompt_callback=prompt_callback,\n)\n```\n\n### InteractiveBrowserCredential\n\nFor interactive OAuth browser sign-in:\n\n```python\nfrom azure.identity import InteractiveBrowserCredential\n\ncredential = InteractiveBrowserCredential()\n\n# With specific tenant and client\ncredential = InteractiveBrowserCredential(\n    tenant_id=\"\u003Ctenant-id>\",\n    client_id=\"\u003Cclient-id>\",\n)\n```\n\n### OnBehalfOfCredential\n\nFor middle-tier services propagating user identity:\n\n```python\nfrom azure.identity import OnBehalfOfCredential\n\ncredential = OnBehalfOfCredential(\n    tenant_id=\"\u003Ctenant-id>\",\n    client_id=\"\u003Cclient-id>\",\n    client_secret=\"\u003Cclient-secret>\",\n    user_assertion=\"\u003Caccess-token-from-client>\",\n)\n```\n\n### AzurePipelinesCredential\n\nFor Azure DevOps pipelines with workload identity federation:\n\n```python\nimport os\nfrom azure.identity import AzurePipelinesCredential\n\ncredential = AzurePipelinesCredential(\n    tenant_id=\"\u003Ctenant-id>\",\n    client_id=\"\u003Cclient-id>\",\n    service_connection_id=\"\u003Cservice-connection-id>\",\n    system_access_token=os.environ[\"SYSTEM_ACCESSTOKEN\"],\n)\n```\n\n## Getting Tokens Directly\n\n```python\nfrom azure.identity import DefaultAzureCredential\n\nwith DefaultAzureCredential() as credential:\n    # Get token for a specific scope\n    token = credential.get_token(\"https:\u002F\u002Fmanagement.azure.com\u002F.default\")\n    print(f\"Token expires: {token.expires_on}\")\n\n    # For Azure Database for PostgreSQL\n    token = credential.get_token(\"https:\u002F\u002Fossrdbms-aad.database.windows.net\u002F.default\")\n```\n\n## Async Credentials\n\nAsync credentials are in `azure.identity.aio`. Always close them or use `async with`:\n\n```python\nfrom azure.identity.aio import DefaultAzureCredential\nfrom azure.storage.blob.aio import BlobServiceClient\n\nasync def main():\n    # Preferred: use async context manager for both credential and client\n    async with DefaultAzureCredential() as credential:\n        async with BlobServiceClient(\n            account_url=\"https:\u002F\u002F\u003Caccount>.blob.core.windows.net\",\n            credential=credential,\n        ) as client:\n            # ... async operations\n            pass\n```\n\n> The async `get_bearer_token_provider` is at `azure.identity.aio.get_bearer_token_provider`.\n\n## Sovereign Clouds\n\nUse `AzureAuthorityHosts` or the `AZURE_AUTHORITY_HOST` env var:\n\n```python\nfrom azure.identity import DefaultAzureCredential, AzureAuthorityHosts\n\n# Azure Government\ncredential = DefaultAzureCredential(authority=AzureAuthorityHosts.AZURE_GOVERNMENT)\n\n# Azure China\ncredential = DefaultAzureCredential(authority=AzureAuthorityHosts.AZURE_CHINA)\n```\n\n| Constant | Authority |\n|----------|-----------|\n| `AzureAuthorityHosts.AZURE_PUBLIC_CLOUD` | `login.microsoftonline.com` (default) |\n| `AzureAuthorityHosts.AZURE_GOVERNMENT` | `login.microsoftonline.us` |\n| `AzureAuthorityHosts.AZURE_CHINA` | `login.chinacloudapi.cn` |\n\n## Persistent Token Caching\n\nOpt-in disk-based caching with `TokenCachePersistenceOptions`:\n\n```python\nfrom azure.identity import DefaultAzureCredential, TokenCachePersistenceOptions\n\ncredential = DefaultAzureCredential(\n    cache_persistence_options=TokenCachePersistenceOptions()\n)\n\n# Allow unencrypted fallback (NOT recommended for production)\ncredential = DefaultAzureCredential(\n    cache_persistence_options=TokenCachePersistenceOptions(allow_unencrypted_storage=True)\n)\n```\n\nStorage: Windows (DPAPI), macOS (Keychain), Linux (Keyring).\n\n## Multi-Tenant Support\n\nAllow token acquisition for additional tenants beyond the configured one:\n\n```python\nfrom azure.identity import ClientSecretCredential\n\ncredential = ClientSecretCredential(\n    tenant_id=\"\u003Chome-tenant>\",\n    client_id=\"\u003Cclient-id>\",\n    client_secret=\"\u003Csecret>\",\n    additionally_allowed_tenants=[\"\u003Cother-tenant>\", \"*\"],  # \"*\" allows any tenant\n)\n```\n\n## Error Handling\n\n```python\nfrom azure.identity import DefaultAzureCredential, CredentialUnavailableError\nfrom azure.core.exceptions import ClientAuthenticationError\n\nwith DefaultAzureCredential() as credential:\n    try:\n        token = credential.get_token(\"https:\u002F\u002Fmanagement.azure.com\u002F.default\")\n    except CredentialUnavailableError:\n        # No credential in the chain could attempt authentication\n        pass\n    except ClientAuthenticationError as e:\n        # Authentication was attempted but failed\n        # e.message contains details from each credential in the chain\n        pass\n```\n\n## Logging\n\nEnable authentication logging for debugging:\n\n```python\nimport logging\n\n# Enable verbose Azure Identity logging\nlogging.basicConfig(level=logging.DEBUG)\nlogger = logging.getLogger(\"azure.identity\")\nlogger.setLevel(logging.DEBUG)\n```\n\n```bash\n# Or via environment variable\nAZURE_LOG_LEVEL=debug\n```\n\n## Credential Selection Matrix\n\n| Environment | Recommended Credential |\n|-------------|------------------------|\n| Local Development | `DefaultAzureCredential` (uses Azure CLI) |\n| Azure App Service | `DefaultAzureCredential` (uses Managed Identity) |\n| Azure Functions | `DefaultAzureCredential` (uses Managed Identity) |\n| Azure Kubernetes Service | `WorkloadIdentityCredential` |\n| Azure VMs | `DefaultAzureCredential` (uses Managed Identity) |\n| CI\u002FCD Pipeline | `EnvironmentCredential` or `AzurePipelinesCredential` |\n| Desktop App | `InteractiveBrowserCredential` |\n| CLI \u002F Headless Tool | `DeviceCodeCredential` |\n| Middle-tier Service | `OnBehalfOfCredential` |\n\n## Best Practices\n\n1. **Pick sync OR async and stay consistent.** Do not mix `azure.xxx` sync clients with `azure.xxx.aio` async clients in the same call path. Choose one mode per module.\n2. **Use credentials as context managers** (`with DefaultAzureCredential() as credential:`) when they own token caches \u002F HTTP transports you want cleaned up; for async, use `async with` on credentials from `azure.identity.aio`.\n3. **Use `DefaultAzureCredential`** for code that runs locally. Use a specific token credential for code that runs in Azure.\n4. **Never hardcode credentials** — use environment variables or managed identity\n5. **Prefer managed identity** in production Azure deployments\n6. **Use `get_bearer_token_provider`** for non-Azure-SDK clients (OpenAI, REST APIs)\n7. **Use `ChainedTokenCredential`** when you need a custom credential order\n8. **Set `AZURE_CLIENT_ID`** for user-assigned managed identities (object ID and resource ID are also valid identifiers)\n9. **Exclude unused credentials** to speed up `DefaultAzureCredential` authentication\n10. **Use `CertificateCredential`** (not `ClientCertificateCredential` — that name doesn't exist)\n11. **Enable `cache_persistence_options`** for long-running services to reduce token requests\n12. **Reuse credential instances** — same credential can be shared across multiple clients\n\n## Reference Links\n\n| Resource | URL |\n|----------|-----|\n| PyPI Package | https:\u002F\u002Fpypi.org\u002Fproject\u002Fazure-identity\u002F |\n| API Reference | https:\u002F\u002Flearn.microsoft.com\u002Fpython\u002Fapi\u002Fazure-identity |\n| GitHub Source | https:\u002F\u002Fgithub.com\u002FAzure\u002Fazure-sdk-for-python\u002Ftree\u002Fmain\u002Fsdk\u002Fidentity\u002Fazure-identity |\n| Credential Chains | https:\u002F\u002Faka.ms\u002Fazsdk\u002Fpython\u002Fidentity\u002Fcredential-chains |\n\n## Reference Files\n\n| File | Contents |\n|------|----------|\n| [references\u002Fcapabilities.md](references\u002Fcapabilities.md) | Additional non-hero capabilities, operation-group coverage, and production checklists. |\n| [references\u002Fnon-hero-scenarios.md](references\u002Fnon-hero-scenarios.md) | Dedicated non-hero examples for secondary\u002Fadvanced scenarios. |\n",{"data":43,"body":47},{"name":4,"description":6,"license":28,"metadata":44},{"author":9,"version":45,"package":46},"1.0.0","azure-identity",{"type":48,"children":49},"root",[50,59,65,70,127,134,168,173,196,202,212,218,547,553,673,679,684,778,784,800,806,944,950,1198,1203,1208,1345,1351,1357,1412,1418,1488,1494,1599,1605,1676,1682,1782,1788,1793,1798,1898,1903,1972,1977,2004,2140,2145,2191,2196,2201,2293,2298,2303,2393,2398,2403,2509,2514,2519,2593,2598,2603,2670,2675,2680,2754,2760,2836,2842,2862,2964,2986,2992,3012,3073,3159,3165,3177,3258,3263,3269,3274,3340,3346,3454,3460,3465,3519,3551,3557,3736,3742,3942,3948,4037,4043,4097],{"type":51,"tag":52,"props":53,"children":55},"element","h1",{"id":54},"azure-identity-library-for-python",[56],{"type":57,"value":58},"text","Azure Identity library for Python",{"type":51,"tag":60,"props":61,"children":62},"p",{},[63],{"type":57,"value":64},"Authentication library for Azure SDK clients using Microsoft Entra ID.",{"type":51,"tag":60,"props":66,"children":67},{},[68],{"type":57,"value":69},"Use this skill when:",{"type":51,"tag":71,"props":72,"children":73},"ul",{},[74,80,94,106,111,122],{"type":51,"tag":75,"props":76,"children":77},"li",{},[78],{"type":57,"value":79},"An app needs to authenticate to Azure services from Python",{"type":51,"tag":75,"props":81,"children":82},{},[83,85,92],{"type":57,"value":84},"You need ",{"type":51,"tag":86,"props":87,"children":89},"code",{"className":88},[],[90],{"type":57,"value":91},"DefaultAzureCredential",{"type":57,"value":93}," for local dev + Azure deployment",{"type":51,"tag":75,"props":95,"children":96},{},[97,98,104],{"type":57,"value":84},{"type":51,"tag":86,"props":99,"children":101},{"className":100},[],[102],{"type":57,"value":103},"ManagedIdentityCredential",{"type":57,"value":105}," for Azure-hosted workloads",{"type":51,"tag":75,"props":107,"children":108},{},[109],{"type":57,"value":110},"You need service principal auth with secret or certificate",{"type":51,"tag":75,"props":112,"children":113},{},[114,116],{"type":57,"value":115},"You need direct token acquisition with ",{"type":51,"tag":86,"props":117,"children":119},{"className":118},[],[120],{"type":57,"value":121},"get_token()",{"type":51,"tag":75,"props":123,"children":124},{},[125],{"type":57,"value":126},"You need to troubleshoot credential chain failures",{"type":51,"tag":128,"props":129,"children":131},"h2",{"id":130},"installation",[132],{"type":57,"value":133},"Installation",{"type":51,"tag":135,"props":136,"children":141},"pre",{"className":137,"code":138,"language":139,"meta":140,"style":140},"language-bash shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","pip install azure-identity\n","bash","",[142],{"type":51,"tag":86,"props":143,"children":144},{"__ignoreMap":140},[145],{"type":51,"tag":146,"props":147,"children":150},"span",{"class":148,"line":149},"line",1,[151,157,163],{"type":51,"tag":146,"props":152,"children":154},{"style":153},"--shiki-light:#E2931D;--shiki-default:#FFCB6B;--shiki-dark:#FFCB6B",[155],{"type":57,"value":156},"pip",{"type":51,"tag":146,"props":158,"children":160},{"style":159},"--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D",[161],{"type":57,"value":162}," install",{"type":51,"tag":146,"props":164,"children":165},{"style":159},[166],{"type":57,"value":167}," azure-identity\n",{"type":51,"tag":60,"props":169,"children":170},{},[171],{"type":57,"value":172},"For VS Code or broker-based desktop auth:",{"type":51,"tag":135,"props":174,"children":176},{"className":137,"code":175,"language":139,"meta":140,"style":140},"pip install azure-identity-broker\n",[177],{"type":51,"tag":86,"props":178,"children":179},{"__ignoreMap":140},[180],{"type":51,"tag":146,"props":181,"children":182},{"class":148,"line":149},[183,187,191],{"type":51,"tag":146,"props":184,"children":185},{"style":153},[186],{"type":57,"value":156},{"type":51,"tag":146,"props":188,"children":189},{"style":159},[190],{"type":57,"value":162},{"type":51,"tag":146,"props":192,"children":193},{"style":159},[194],{"type":57,"value":195}," azure-identity-broker\n",{"type":51,"tag":128,"props":197,"children":199},{"id":198},"python-version",[200],{"type":57,"value":201},"Python Version",{"type":51,"tag":60,"props":203,"children":204},{},[205,210],{"type":51,"tag":86,"props":206,"children":208},{"className":207},[],[209],{"type":57,"value":46},{"type":57,"value":211}," supports Python 3.9+.",{"type":51,"tag":128,"props":213,"children":215},{"id":214},"environment-variables",[216],{"type":57,"value":217},"Environment Variables",{"type":51,"tag":135,"props":219,"children":221},{"className":137,"code":220,"language":139,"meta":140,"style":140},"# Service principal with client secret\nAZURE_TENANT_ID=\u003Cyour-tenant-id>\nAZURE_CLIENT_ID=\u003Cyour-client-id>\nAZURE_CLIENT_SECRET=\u003Cyour-client-secret>\n\n# Service principal with certificate\nAZURE_TENANT_ID=\u003Cyour-tenant-id>\nAZURE_CLIENT_ID=\u003Cyour-client-id>\nAZURE_CLIENT_CERTIFICATE_PATH=\u002Fpath\u002Fto\u002Fcert.pem\nAZURE_CLIENT_CERTIFICATE_PASSWORD=\u003Coptional-password>\n\n# Authority (sovereign clouds)\nAZURE_AUTHORITY_HOST=login.microsoftonline.com  # Default; or login.chinacloudapi.cn, login.microsoftonline.us\n\n# User-assigned managed identity\nAZURE_CLIENT_ID=\u003Cmanaged-identity-client-id>\n\n# Credential selection (new)\nAZURE_TOKEN_CREDENTIALS=dev|prod|\u003Ccredential-name>  # Optional, restricts DAC chain\n",[222],{"type":51,"tag":86,"props":223,"children":224},{"__ignoreMap":140},[225,234,260,282,304,314,323,343,363,382,404,412,421,444,452,461,482,490,499],{"type":51,"tag":146,"props":226,"children":227},{"class":148,"line":149},[228],{"type":51,"tag":146,"props":229,"children":231},{"style":230},"--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#546E7A;--shiki-default-font-style:italic;--shiki-dark:#676E95;--shiki-dark-font-style:italic",[232],{"type":57,"value":233},"# Service principal with client secret\n",{"type":51,"tag":146,"props":235,"children":237},{"class":148,"line":236},2,[238,244,250,255],{"type":51,"tag":146,"props":239,"children":241},{"style":240},"--shiki-light:#90A4AE;--shiki-default:#EEFFFF;--shiki-dark:#BABED8",[242],{"type":57,"value":243},"AZURE_TENANT_ID",{"type":51,"tag":146,"props":245,"children":247},{"style":246},"--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF",[248],{"type":57,"value":249},"=\u003C",{"type":51,"tag":146,"props":251,"children":252},{"style":159},[253],{"type":57,"value":254},"your-tenant-id",{"type":51,"tag":146,"props":256,"children":257},{"style":246},[258],{"type":57,"value":259},">\n",{"type":51,"tag":146,"props":261,"children":263},{"class":148,"line":262},3,[264,269,273,278],{"type":51,"tag":146,"props":265,"children":266},{"style":240},[267],{"type":57,"value":268},"AZURE_CLIENT_ID",{"type":51,"tag":146,"props":270,"children":271},{"style":246},[272],{"type":57,"value":249},{"type":51,"tag":146,"props":274,"children":275},{"style":159},[276],{"type":57,"value":277},"your-client-id",{"type":51,"tag":146,"props":279,"children":280},{"style":246},[281],{"type":57,"value":259},{"type":51,"tag":146,"props":283,"children":285},{"class":148,"line":284},4,[286,291,295,300],{"type":51,"tag":146,"props":287,"children":288},{"style":240},[289],{"type":57,"value":290},"AZURE_CLIENT_SECRET",{"type":51,"tag":146,"props":292,"children":293},{"style":246},[294],{"type":57,"value":249},{"type":51,"tag":146,"props":296,"children":297},{"style":159},[298],{"type":57,"value":299},"your-client-secret",{"type":51,"tag":146,"props":301,"children":302},{"style":246},[303],{"type":57,"value":259},{"type":51,"tag":146,"props":305,"children":307},{"class":148,"line":306},5,[308],{"type":51,"tag":146,"props":309,"children":311},{"emptyLinePlaceholder":310},true,[312],{"type":57,"value":313},"\n",{"type":51,"tag":146,"props":315,"children":317},{"class":148,"line":316},6,[318],{"type":51,"tag":146,"props":319,"children":320},{"style":230},[321],{"type":57,"value":322},"# Service principal with certificate\n",{"type":51,"tag":146,"props":324,"children":326},{"class":148,"line":325},7,[327,331,335,339],{"type":51,"tag":146,"props":328,"children":329},{"style":240},[330],{"type":57,"value":243},{"type":51,"tag":146,"props":332,"children":333},{"style":246},[334],{"type":57,"value":249},{"type":51,"tag":146,"props":336,"children":337},{"style":159},[338],{"type":57,"value":254},{"type":51,"tag":146,"props":340,"children":341},{"style":246},[342],{"type":57,"value":259},{"type":51,"tag":146,"props":344,"children":346},{"class":148,"line":345},8,[347,351,355,359],{"type":51,"tag":146,"props":348,"children":349},{"style":240},[350],{"type":57,"value":268},{"type":51,"tag":146,"props":352,"children":353},{"style":246},[354],{"type":57,"value":249},{"type":51,"tag":146,"props":356,"children":357},{"style":159},[358],{"type":57,"value":277},{"type":51,"tag":146,"props":360,"children":361},{"style":246},[362],{"type":57,"value":259},{"type":51,"tag":146,"props":364,"children":366},{"class":148,"line":365},9,[367,372,377],{"type":51,"tag":146,"props":368,"children":369},{"style":240},[370],{"type":57,"value":371},"AZURE_CLIENT_CERTIFICATE_PATH",{"type":51,"tag":146,"props":373,"children":374},{"style":246},[375],{"type":57,"value":376},"=",{"type":51,"tag":146,"props":378,"children":379},{"style":159},[380],{"type":57,"value":381},"\u002Fpath\u002Fto\u002Fcert.pem\n",{"type":51,"tag":146,"props":383,"children":385},{"class":148,"line":384},10,[386,391,395,400],{"type":51,"tag":146,"props":387,"children":388},{"style":240},[389],{"type":57,"value":390},"AZURE_CLIENT_CERTIFICATE_PASSWORD",{"type":51,"tag":146,"props":392,"children":393},{"style":246},[394],{"type":57,"value":249},{"type":51,"tag":146,"props":396,"children":397},{"style":159},[398],{"type":57,"value":399},"optional-password",{"type":51,"tag":146,"props":401,"children":402},{"style":246},[403],{"type":57,"value":259},{"type":51,"tag":146,"props":405,"children":407},{"class":148,"line":406},11,[408],{"type":51,"tag":146,"props":409,"children":410},{"emptyLinePlaceholder":310},[411],{"type":57,"value":313},{"type":51,"tag":146,"props":413,"children":415},{"class":148,"line":414},12,[416],{"type":51,"tag":146,"props":417,"children":418},{"style":230},[419],{"type":57,"value":420},"# Authority (sovereign clouds)\n",{"type":51,"tag":146,"props":422,"children":424},{"class":148,"line":423},13,[425,430,434,439],{"type":51,"tag":146,"props":426,"children":427},{"style":240},[428],{"type":57,"value":429},"AZURE_AUTHORITY_HOST",{"type":51,"tag":146,"props":431,"children":432},{"style":246},[433],{"type":57,"value":376},{"type":51,"tag":146,"props":435,"children":436},{"style":159},[437],{"type":57,"value":438},"login.microsoftonline.com",{"type":51,"tag":146,"props":440,"children":441},{"style":230},[442],{"type":57,"value":443},"  # Default; or login.chinacloudapi.cn, login.microsoftonline.us\n",{"type":51,"tag":146,"props":445,"children":447},{"class":148,"line":446},14,[448],{"type":51,"tag":146,"props":449,"children":450},{"emptyLinePlaceholder":310},[451],{"type":57,"value":313},{"type":51,"tag":146,"props":453,"children":455},{"class":148,"line":454},15,[456],{"type":51,"tag":146,"props":457,"children":458},{"style":230},[459],{"type":57,"value":460},"# User-assigned managed identity\n",{"type":51,"tag":146,"props":462,"children":464},{"class":148,"line":463},16,[465,469,473,478],{"type":51,"tag":146,"props":466,"children":467},{"style":240},[468],{"type":57,"value":268},{"type":51,"tag":146,"props":470,"children":471},{"style":246},[472],{"type":57,"value":249},{"type":51,"tag":146,"props":474,"children":475},{"style":159},[476],{"type":57,"value":477},"managed-identity-client-id",{"type":51,"tag":146,"props":479,"children":480},{"style":246},[481],{"type":57,"value":259},{"type":51,"tag":146,"props":483,"children":485},{"class":148,"line":484},17,[486],{"type":51,"tag":146,"props":487,"children":488},{"emptyLinePlaceholder":310},[489],{"type":57,"value":313},{"type":51,"tag":146,"props":491,"children":493},{"class":148,"line":492},18,[494],{"type":51,"tag":146,"props":495,"children":496},{"style":230},[497],{"type":57,"value":498},"# Credential selection (new)\n",{"type":51,"tag":146,"props":500,"children":502},{"class":148,"line":501},19,[503,508,512,517,522,527,532,537,542],{"type":51,"tag":146,"props":504,"children":505},{"style":240},[506],{"type":57,"value":507},"AZURE_TOKEN_CREDENTIALS",{"type":51,"tag":146,"props":509,"children":510},{"style":246},[511],{"type":57,"value":376},{"type":51,"tag":146,"props":513,"children":514},{"style":159},[515],{"type":57,"value":516},"dev",{"type":51,"tag":146,"props":518,"children":519},{"style":246},[520],{"type":57,"value":521},"|",{"type":51,"tag":146,"props":523,"children":524},{"style":153},[525],{"type":57,"value":526},"prod",{"type":51,"tag":146,"props":528,"children":529},{"style":246},[530],{"type":57,"value":531},"|\u003C",{"type":51,"tag":146,"props":533,"children":534},{"style":240},[535],{"type":57,"value":536},"credential-name",{"type":51,"tag":146,"props":538,"children":539},{"style":246},[540],{"type":57,"value":541},">",{"type":51,"tag":146,"props":543,"children":544},{"style":230},[545],{"type":57,"value":546},"  # Optional, restricts DAC chain\n",{"type":51,"tag":128,"props":548,"children":550},{"id":549},"authentication-lifecycle",[551],{"type":57,"value":552},"Authentication & Lifecycle",{"type":51,"tag":554,"props":555,"children":556},"blockquote",{},[557,566,668],{"type":51,"tag":60,"props":558,"children":559},{},[560],{"type":51,"tag":561,"props":562,"children":563},"strong",{},[564],{"type":57,"value":565},"🔑 Two rules apply to every code sample below:",{"type":51,"tag":567,"props":568,"children":569},"ol",{},[570,623],{"type":51,"tag":75,"props":571,"children":572},{},[573,585,587],{"type":51,"tag":561,"props":574,"children":575},{},[576,578,583],{"type":57,"value":577},"Prefer ",{"type":51,"tag":86,"props":579,"children":581},{"className":580},[],[582],{"type":57,"value":91},{"type":57,"value":584},".",{"type":57,"value":586}," It works locally (Azure CLI \u002F VS Code \u002F Developer CLI) and in Azure (managed identity, workload identity) with no code change. Avoid connection strings, account\u002FAPI keys — they bypass Entra audit and rotation.\n",{"type":51,"tag":71,"props":588,"children":589},{},[590,602],{"type":51,"tag":75,"props":591,"children":592},{},[593,595,600],{"type":57,"value":594},"Local dev: ",{"type":51,"tag":86,"props":596,"children":598},{"className":597},[],[599],{"type":57,"value":91},{"type":57,"value":601}," works as-is.",{"type":51,"tag":75,"props":603,"children":604},{},[605,607,613,615,621],{"type":57,"value":606},"Production: set ",{"type":51,"tag":86,"props":608,"children":610},{"className":609},[],[611],{"type":57,"value":612},"AZURE_TOKEN_CREDENTIALS=prod",{"type":57,"value":614}," (or ",{"type":51,"tag":86,"props":616,"children":618},{"className":617},[],[619],{"type":57,"value":620},"AZURE_TOKEN_CREDENTIALS=\u003Cspecific_credential>",{"type":57,"value":622},") to constrain the credential chain to production-safe credentials.",{"type":51,"tag":75,"props":624,"children":625},{},[626,631,633],{"type":51,"tag":561,"props":627,"children":628},{},[629],{"type":57,"value":630},"Wrap credentials and clients in context managers",{"type":57,"value":632}," when they own token caches \u002F transports:\n",{"type":51,"tag":71,"props":634,"children":635},{},[636,647],{"type":51,"tag":75,"props":637,"children":638},{},[639,641],{"type":57,"value":640},"Sync: ",{"type":51,"tag":86,"props":642,"children":644},{"className":643},[],[645],{"type":57,"value":646},"with DefaultAzureCredential() as credential:",{"type":51,"tag":75,"props":648,"children":649},{},[650,652,658,660,666],{"type":57,"value":651},"Async: ",{"type":51,"tag":86,"props":653,"children":655},{"className":654},[],[656],{"type":57,"value":657},"async with DefaultAzureCredential() as credential:",{"type":57,"value":659}," (from ",{"type":51,"tag":86,"props":661,"children":663},{"className":662},[],[664],{"type":57,"value":665},"azure.identity.aio",{"type":57,"value":667},")",{"type":51,"tag":60,"props":669,"children":670},{},[671],{"type":57,"value":672},"Snippets may abbreviate this setup, but production code should always follow both rules.",{"type":51,"tag":674,"props":675,"children":677},"h3",{"id":676},"defaultazurecredential",[678],{"type":57,"value":91},{"type":51,"tag":60,"props":680,"children":681},{},[682],{"type":57,"value":683},"The recommended credential for most scenarios. Tries multiple authentication methods in order:",{"type":51,"tag":135,"props":685,"children":688},{"className":686,"code":687,"language":18,"meta":140,"style":140},"language-python shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","from azure.identity import DefaultAzureCredential\nfrom azure.storage.blob import BlobServiceClient\n\n# Works in local dev AND production without code changes\ncredential = DefaultAzureCredential()\n\nwith BlobServiceClient(\n    account_url=\"https:\u002F\u002F\u003Caccount>.blob.core.windows.net\",\n    credential=credential\n) as client:\n    containers = list(client.list_containers())\n",[689],{"type":51,"tag":86,"props":690,"children":691},{"__ignoreMap":140},[692,700,708,715,723,731,738,746,754,762,770],{"type":51,"tag":146,"props":693,"children":694},{"class":148,"line":149},[695],{"type":51,"tag":146,"props":696,"children":697},{},[698],{"type":57,"value":699},"from azure.identity import DefaultAzureCredential\n",{"type":51,"tag":146,"props":701,"children":702},{"class":148,"line":236},[703],{"type":51,"tag":146,"props":704,"children":705},{},[706],{"type":57,"value":707},"from azure.storage.blob import BlobServiceClient\n",{"type":51,"tag":146,"props":709,"children":710},{"class":148,"line":262},[711],{"type":51,"tag":146,"props":712,"children":713},{"emptyLinePlaceholder":310},[714],{"type":57,"value":313},{"type":51,"tag":146,"props":716,"children":717},{"class":148,"line":284},[718],{"type":51,"tag":146,"props":719,"children":720},{},[721],{"type":57,"value":722},"# Works in local dev AND production without code changes\n",{"type":51,"tag":146,"props":724,"children":725},{"class":148,"line":306},[726],{"type":51,"tag":146,"props":727,"children":728},{},[729],{"type":57,"value":730},"credential = DefaultAzureCredential()\n",{"type":51,"tag":146,"props":732,"children":733},{"class":148,"line":316},[734],{"type":51,"tag":146,"props":735,"children":736},{"emptyLinePlaceholder":310},[737],{"type":57,"value":313},{"type":51,"tag":146,"props":739,"children":740},{"class":148,"line":325},[741],{"type":51,"tag":146,"props":742,"children":743},{},[744],{"type":57,"value":745},"with BlobServiceClient(\n",{"type":51,"tag":146,"props":747,"children":748},{"class":148,"line":345},[749],{"type":51,"tag":146,"props":750,"children":751},{},[752],{"type":57,"value":753},"    account_url=\"https:\u002F\u002F\u003Caccount>.blob.core.windows.net\",\n",{"type":51,"tag":146,"props":755,"children":756},{"class":148,"line":365},[757],{"type":51,"tag":146,"props":758,"children":759},{},[760],{"type":57,"value":761},"    credential=credential\n",{"type":51,"tag":146,"props":763,"children":764},{"class":148,"line":384},[765],{"type":51,"tag":146,"props":766,"children":767},{},[768],{"type":57,"value":769},") as client:\n",{"type":51,"tag":146,"props":771,"children":772},{"class":148,"line":406},[773],{"type":51,"tag":146,"props":774,"children":775},{},[776],{"type":57,"value":777},"    containers = list(client.list_containers())\n",{"type":51,"tag":674,"props":779,"children":781},{"id":780},"credential-chain-order",[782],{"type":57,"value":783},"Credential Chain Order",{"type":51,"tag":60,"props":785,"children":786},{},[787,789,798],{"type":57,"value":788},"See ",{"type":51,"tag":790,"props":791,"children":795},"a",{"href":792,"rel":793},"https:\u002F\u002Faka.ms\u002Fazsdk\u002Fpython\u002Fidentity\u002Fcredential-chains#defaultazurecredential-overview",[794],"nofollow",[796],{"type":57,"value":797},"DefaultAzureCredential overview",{"type":57,"value":799}," for the current credential chain order and defaults.",{"type":51,"tag":674,"props":801,"children":803},{"id":802},"customizing-defaultazurecredential",[804],{"type":57,"value":805},"Customizing DefaultAzureCredential",{"type":51,"tag":135,"props":807,"children":809},{"className":686,"code":808,"language":18,"meta":140,"style":140},"# Exclude credentials you don't need\ncredential = DefaultAzureCredential(\n    exclude_environment_credential=True,\n    exclude_shared_token_cache_credential=True,\n    managed_identity_client_id=\"\u003Cuser-assigned-mi-client-id>\"  # For user-assigned MI (also accepts object ID or resource ID)\n)\n\n# Enable interactive browser (disabled by default)\ncredential = DefaultAzureCredential(\n    exclude_interactive_browser_credential=False\n)\n\n# Set subprocess timeout for CLI-based credentials (default: 10s)\ncredential = DefaultAzureCredential(process_timeout=30)\n\n# Require AZURE_TOKEN_CREDENTIALS env var to be set\ncredential = DefaultAzureCredential(require_envvar=True)\n",[810],{"type":51,"tag":86,"props":811,"children":812},{"__ignoreMap":140},[813,821,829,837,845,853,861,868,876,883,891,898,905,913,921,928,936],{"type":51,"tag":146,"props":814,"children":815},{"class":148,"line":149},[816],{"type":51,"tag":146,"props":817,"children":818},{},[819],{"type":57,"value":820},"# Exclude credentials you don't need\n",{"type":51,"tag":146,"props":822,"children":823},{"class":148,"line":236},[824],{"type":51,"tag":146,"props":825,"children":826},{},[827],{"type":57,"value":828},"credential = DefaultAzureCredential(\n",{"type":51,"tag":146,"props":830,"children":831},{"class":148,"line":262},[832],{"type":51,"tag":146,"props":833,"children":834},{},[835],{"type":57,"value":836},"    exclude_environment_credential=True,\n",{"type":51,"tag":146,"props":838,"children":839},{"class":148,"line":284},[840],{"type":51,"tag":146,"props":841,"children":842},{},[843],{"type":57,"value":844},"    exclude_shared_token_cache_credential=True,\n",{"type":51,"tag":146,"props":846,"children":847},{"class":148,"line":306},[848],{"type":51,"tag":146,"props":849,"children":850},{},[851],{"type":57,"value":852},"    managed_identity_client_id=\"\u003Cuser-assigned-mi-client-id>\"  # For user-assigned MI (also accepts object ID or resource ID)\n",{"type":51,"tag":146,"props":854,"children":855},{"class":148,"line":316},[856],{"type":51,"tag":146,"props":857,"children":858},{},[859],{"type":57,"value":860},")\n",{"type":51,"tag":146,"props":862,"children":863},{"class":148,"line":325},[864],{"type":51,"tag":146,"props":865,"children":866},{"emptyLinePlaceholder":310},[867],{"type":57,"value":313},{"type":51,"tag":146,"props":869,"children":870},{"class":148,"line":345},[871],{"type":51,"tag":146,"props":872,"children":873},{},[874],{"type":57,"value":875},"# Enable interactive browser (disabled by default)\n",{"type":51,"tag":146,"props":877,"children":878},{"class":148,"line":365},[879],{"type":51,"tag":146,"props":880,"children":881},{},[882],{"type":57,"value":828},{"type":51,"tag":146,"props":884,"children":885},{"class":148,"line":384},[886],{"type":51,"tag":146,"props":887,"children":888},{},[889],{"type":57,"value":890},"    exclude_interactive_browser_credential=False\n",{"type":51,"tag":146,"props":892,"children":893},{"class":148,"line":406},[894],{"type":51,"tag":146,"props":895,"children":896},{},[897],{"type":57,"value":860},{"type":51,"tag":146,"props":899,"children":900},{"class":148,"line":414},[901],{"type":51,"tag":146,"props":902,"children":903},{"emptyLinePlaceholder":310},[904],{"type":57,"value":313},{"type":51,"tag":146,"props":906,"children":907},{"class":148,"line":423},[908],{"type":51,"tag":146,"props":909,"children":910},{},[911],{"type":57,"value":912},"# Set subprocess timeout for CLI-based credentials (default: 10s)\n",{"type":51,"tag":146,"props":914,"children":915},{"class":148,"line":446},[916],{"type":51,"tag":146,"props":917,"children":918},{},[919],{"type":57,"value":920},"credential = DefaultAzureCredential(process_timeout=30)\n",{"type":51,"tag":146,"props":922,"children":923},{"class":148,"line":454},[924],{"type":51,"tag":146,"props":925,"children":926},{"emptyLinePlaceholder":310},[927],{"type":57,"value":313},{"type":51,"tag":146,"props":929,"children":930},{"class":148,"line":463},[931],{"type":51,"tag":146,"props":932,"children":933},{},[934],{"type":57,"value":935},"# Require AZURE_TOKEN_CREDENTIALS env var to be set\n",{"type":51,"tag":146,"props":937,"children":938},{"class":148,"line":484},[939],{"type":51,"tag":146,"props":940,"children":941},{},[942],{"type":57,"value":943},"credential = DefaultAzureCredential(require_envvar=True)\n",{"type":51,"tag":674,"props":945,"children":947},{"id":946},"exclude-parameters",[948],{"type":57,"value":949},"Exclude Parameters",{"type":51,"tag":951,"props":952,"children":953},"table",{},[954,978],{"type":51,"tag":955,"props":956,"children":957},"thead",{},[958],{"type":51,"tag":959,"props":960,"children":961},"tr",{},[962,968,973],{"type":51,"tag":963,"props":964,"children":965},"th",{},[966],{"type":57,"value":967},"Parameter",{"type":51,"tag":963,"props":969,"children":970},{},[971],{"type":57,"value":972},"Default",{"type":51,"tag":963,"props":974,"children":975},{},[976],{"type":57,"value":977},"Effect",{"type":51,"tag":979,"props":980,"children":981},"tbody",{},[982,1005,1026,1047,1068,1089,1110,1131,1152,1177],{"type":51,"tag":959,"props":983,"children":984},{},[985,995,1000],{"type":51,"tag":986,"props":987,"children":988},"td",{},[989],{"type":51,"tag":86,"props":990,"children":992},{"className":991},[],[993],{"type":57,"value":994},"exclude_environment_credential",{"type":51,"tag":986,"props":996,"children":997},{},[998],{"type":57,"value":999},"False",{"type":51,"tag":986,"props":1001,"children":1002},{},[1003],{"type":57,"value":1004},"Skip env-var-based auth",{"type":51,"tag":959,"props":1006,"children":1007},{},[1008,1017,1021],{"type":51,"tag":986,"props":1009,"children":1010},{},[1011],{"type":51,"tag":86,"props":1012,"children":1014},{"className":1013},[],[1015],{"type":57,"value":1016},"exclude_workload_identity_credential",{"type":51,"tag":986,"props":1018,"children":1019},{},[1020],{"type":57,"value":999},{"type":51,"tag":986,"props":1022,"children":1023},{},[1024],{"type":57,"value":1025},"Skip Kubernetes workload identity",{"type":51,"tag":959,"props":1027,"children":1028},{},[1029,1038,1042],{"type":51,"tag":986,"props":1030,"children":1031},{},[1032],{"type":51,"tag":86,"props":1033,"children":1035},{"className":1034},[],[1036],{"type":57,"value":1037},"exclude_managed_identity_credential",{"type":51,"tag":986,"props":1039,"children":1040},{},[1041],{"type":57,"value":999},{"type":51,"tag":986,"props":1043,"children":1044},{},[1045],{"type":57,"value":1046},"Skip managed identity",{"type":51,"tag":959,"props":1048,"children":1049},{},[1050,1059,1063],{"type":51,"tag":986,"props":1051,"children":1052},{},[1053],{"type":51,"tag":86,"props":1054,"children":1056},{"className":1055},[],[1057],{"type":57,"value":1058},"exclude_shared_token_cache_credential",{"type":51,"tag":986,"props":1060,"children":1061},{},[1062],{"type":57,"value":999},{"type":51,"tag":986,"props":1064,"children":1065},{},[1066],{"type":57,"value":1067},"Skip shared token cache",{"type":51,"tag":959,"props":1069,"children":1070},{},[1071,1080,1084],{"type":51,"tag":986,"props":1072,"children":1073},{},[1074],{"type":51,"tag":86,"props":1075,"children":1077},{"className":1076},[],[1078],{"type":57,"value":1079},"exclude_visual_studio_code_credential",{"type":51,"tag":986,"props":1081,"children":1082},{},[1083],{"type":57,"value":999},{"type":51,"tag":986,"props":1085,"children":1086},{},[1087],{"type":57,"value":1088},"Skip VS Code credential",{"type":51,"tag":959,"props":1090,"children":1091},{},[1092,1101,1105],{"type":51,"tag":986,"props":1093,"children":1094},{},[1095],{"type":51,"tag":86,"props":1096,"children":1098},{"className":1097},[],[1099],{"type":57,"value":1100},"exclude_cli_credential",{"type":51,"tag":986,"props":1102,"children":1103},{},[1104],{"type":57,"value":999},{"type":51,"tag":986,"props":1106,"children":1107},{},[1108],{"type":57,"value":1109},"Skip Azure CLI",{"type":51,"tag":959,"props":1111,"children":1112},{},[1113,1122,1126],{"type":51,"tag":986,"props":1114,"children":1115},{},[1116],{"type":51,"tag":86,"props":1117,"children":1119},{"className":1118},[],[1120],{"type":57,"value":1121},"exclude_powershell_credential",{"type":51,"tag":986,"props":1123,"children":1124},{},[1125],{"type":57,"value":999},{"type":51,"tag":986,"props":1127,"children":1128},{},[1129],{"type":57,"value":1130},"Skip Azure PowerShell",{"type":51,"tag":959,"props":1132,"children":1133},{},[1134,1143,1147],{"type":51,"tag":986,"props":1135,"children":1136},{},[1137],{"type":51,"tag":86,"props":1138,"children":1140},{"className":1139},[],[1141],{"type":57,"value":1142},"exclude_developer_cli_credential",{"type":51,"tag":986,"props":1144,"children":1145},{},[1146],{"type":57,"value":999},{"type":51,"tag":986,"props":1148,"children":1149},{},[1150],{"type":57,"value":1151},"Skip Azure Developer CLI",{"type":51,"tag":959,"props":1153,"children":1154},{},[1155,1164,1172],{"type":51,"tag":986,"props":1156,"children":1157},{},[1158],{"type":51,"tag":86,"props":1159,"children":1161},{"className":1160},[],[1162],{"type":57,"value":1163},"exclude_interactive_browser_credential",{"type":51,"tag":986,"props":1165,"children":1166},{},[1167],{"type":51,"tag":561,"props":1168,"children":1169},{},[1170],{"type":57,"value":1171},"True",{"type":51,"tag":986,"props":1173,"children":1174},{},[1175],{"type":57,"value":1176},"Skip interactive browser",{"type":51,"tag":959,"props":1178,"children":1179},{},[1180,1189,1193],{"type":51,"tag":986,"props":1181,"children":1182},{},[1183],{"type":51,"tag":86,"props":1184,"children":1186},{"className":1185},[],[1187],{"type":57,"value":1188},"exclude_broker_credential",{"type":51,"tag":986,"props":1190,"children":1191},{},[1192],{"type":57,"value":999},{"type":51,"tag":986,"props":1194,"children":1195},{},[1196],{"type":57,"value":1197},"Skip WAM broker",{"type":51,"tag":128,"props":1199,"children":1201},{"id":1200},"get_bearer_token_provider",[1202],{"type":57,"value":1200},{"type":51,"tag":60,"props":1204,"children":1205},{},[1206],{"type":57,"value":1207},"Helper that wraps a credential into a callable returning a bearer token string. Essential for OpenAI SDK and other non-Azure-SDK clients:",{"type":51,"tag":135,"props":1209,"children":1211},{"className":686,"code":1210,"language":18,"meta":140,"style":140},"from azure.identity import DefaultAzureCredential, get_bearer_token_provider\n\ncredential = DefaultAzureCredential()\ntoken_provider = get_bearer_token_provider(\n    credential, \"https:\u002F\u002Fcognitiveservices.azure.com\u002F.default\"\n)\n\n# Use with OpenAI SDK\nfrom openai import AzureOpenAI\n\nwith AzureOpenAI(\n    azure_endpoint=\"https:\u002F\u002F\u003Cresource>.openai.azure.com\u002F\",\n    azure_ad_token_provider=token_provider,\n    api_version=\"2024-10-21\",\n) as client:\n    # response = client.chat.completions.create(...)\n    ...\n",[1212],{"type":51,"tag":86,"props":1213,"children":1214},{"__ignoreMap":140},[1215,1223,1230,1237,1245,1253,1260,1267,1275,1283,1290,1298,1306,1314,1322,1329,1337],{"type":51,"tag":146,"props":1216,"children":1217},{"class":148,"line":149},[1218],{"type":51,"tag":146,"props":1219,"children":1220},{},[1221],{"type":57,"value":1222},"from azure.identity import DefaultAzureCredential, get_bearer_token_provider\n",{"type":51,"tag":146,"props":1224,"children":1225},{"class":148,"line":236},[1226],{"type":51,"tag":146,"props":1227,"children":1228},{"emptyLinePlaceholder":310},[1229],{"type":57,"value":313},{"type":51,"tag":146,"props":1231,"children":1232},{"class":148,"line":262},[1233],{"type":51,"tag":146,"props":1234,"children":1235},{},[1236],{"type":57,"value":730},{"type":51,"tag":146,"props":1238,"children":1239},{"class":148,"line":284},[1240],{"type":51,"tag":146,"props":1241,"children":1242},{},[1243],{"type":57,"value":1244},"token_provider = get_bearer_token_provider(\n",{"type":51,"tag":146,"props":1246,"children":1247},{"class":148,"line":306},[1248],{"type":51,"tag":146,"props":1249,"children":1250},{},[1251],{"type":57,"value":1252},"    credential, \"https:\u002F\u002Fcognitiveservices.azure.com\u002F.default\"\n",{"type":51,"tag":146,"props":1254,"children":1255},{"class":148,"line":316},[1256],{"type":51,"tag":146,"props":1257,"children":1258},{},[1259],{"type":57,"value":860},{"type":51,"tag":146,"props":1261,"children":1262},{"class":148,"line":325},[1263],{"type":51,"tag":146,"props":1264,"children":1265},{"emptyLinePlaceholder":310},[1266],{"type":57,"value":313},{"type":51,"tag":146,"props":1268,"children":1269},{"class":148,"line":345},[1270],{"type":51,"tag":146,"props":1271,"children":1272},{},[1273],{"type":57,"value":1274},"# Use with OpenAI SDK\n",{"type":51,"tag":146,"props":1276,"children":1277},{"class":148,"line":365},[1278],{"type":51,"tag":146,"props":1279,"children":1280},{},[1281],{"type":57,"value":1282},"from openai import AzureOpenAI\n",{"type":51,"tag":146,"props":1284,"children":1285},{"class":148,"line":384},[1286],{"type":51,"tag":146,"props":1287,"children":1288},{"emptyLinePlaceholder":310},[1289],{"type":57,"value":313},{"type":51,"tag":146,"props":1291,"children":1292},{"class":148,"line":406},[1293],{"type":51,"tag":146,"props":1294,"children":1295},{},[1296],{"type":57,"value":1297},"with AzureOpenAI(\n",{"type":51,"tag":146,"props":1299,"children":1300},{"class":148,"line":414},[1301],{"type":51,"tag":146,"props":1302,"children":1303},{},[1304],{"type":57,"value":1305},"    azure_endpoint=\"https:\u002F\u002F\u003Cresource>.openai.azure.com\u002F\",\n",{"type":51,"tag":146,"props":1307,"children":1308},{"class":148,"line":423},[1309],{"type":51,"tag":146,"props":1310,"children":1311},{},[1312],{"type":57,"value":1313},"    azure_ad_token_provider=token_provider,\n",{"type":51,"tag":146,"props":1315,"children":1316},{"class":148,"line":446},[1317],{"type":51,"tag":146,"props":1318,"children":1319},{},[1320],{"type":57,"value":1321},"    api_version=\"2024-10-21\",\n",{"type":51,"tag":146,"props":1323,"children":1324},{"class":148,"line":454},[1325],{"type":51,"tag":146,"props":1326,"children":1327},{},[1328],{"type":57,"value":769},{"type":51,"tag":146,"props":1330,"children":1331},{"class":148,"line":463},[1332],{"type":51,"tag":146,"props":1333,"children":1334},{},[1335],{"type":57,"value":1336},"    # response = client.chat.completions.create(...)\n",{"type":51,"tag":146,"props":1338,"children":1339},{"class":148,"line":484},[1340],{"type":51,"tag":146,"props":1341,"children":1342},{},[1343],{"type":57,"value":1344},"    ...\n",{"type":51,"tag":128,"props":1346,"children":1348},{"id":1347},"credential-types",[1349],{"type":57,"value":1350},"Credential Types",{"type":51,"tag":674,"props":1352,"children":1354},{"id":1353},"credential-chains",[1355],{"type":57,"value":1356},"Credential Chains",{"type":51,"tag":951,"props":1358,"children":1359},{},[1360,1376],{"type":51,"tag":955,"props":1361,"children":1362},{},[1363],{"type":51,"tag":959,"props":1364,"children":1365},{},[1366,1371],{"type":51,"tag":963,"props":1367,"children":1368},{},[1369],{"type":57,"value":1370},"Credential",{"type":51,"tag":963,"props":1372,"children":1373},{},[1374],{"type":57,"value":1375},"Use Case",{"type":51,"tag":979,"props":1377,"children":1378},{},[1379,1395],{"type":51,"tag":959,"props":1380,"children":1381},{},[1382,1390],{"type":51,"tag":986,"props":1383,"children":1384},{},[1385],{"type":51,"tag":86,"props":1386,"children":1388},{"className":1387},[],[1389],{"type":57,"value":91},{"type":51,"tag":986,"props":1391,"children":1392},{},[1393],{"type":57,"value":1394},"Most scenarios — auto-detects environment",{"type":51,"tag":959,"props":1396,"children":1397},{},[1398,1407],{"type":51,"tag":986,"props":1399,"children":1400},{},[1401],{"type":51,"tag":86,"props":1402,"children":1404},{"className":1403},[],[1405],{"type":57,"value":1406},"ChainedTokenCredential",{"type":51,"tag":986,"props":1408,"children":1409},{},[1410],{"type":57,"value":1411},"Custom credential chain with explicit ordering",{"type":51,"tag":674,"props":1413,"children":1415},{"id":1414},"azure-hosted-applications",[1416],{"type":57,"value":1417},"Azure-Hosted Applications",{"type":51,"tag":951,"props":1419,"children":1420},{},[1421,1435],{"type":51,"tag":955,"props":1422,"children":1423},{},[1424],{"type":51,"tag":959,"props":1425,"children":1426},{},[1427,1431],{"type":51,"tag":963,"props":1428,"children":1429},{},[1430],{"type":57,"value":1370},{"type":51,"tag":963,"props":1432,"children":1433},{},[1434],{"type":57,"value":1375},{"type":51,"tag":979,"props":1436,"children":1437},{},[1438,1455,1471],{"type":51,"tag":959,"props":1439,"children":1440},{},[1441,1450],{"type":51,"tag":986,"props":1442,"children":1443},{},[1444],{"type":51,"tag":86,"props":1445,"children":1447},{"className":1446},[],[1448],{"type":57,"value":1449},"EnvironmentCredential",{"type":51,"tag":986,"props":1451,"children":1452},{},[1453],{"type":57,"value":1454},"Auth via AZURE_CLIENT_SECRET \u002F AZURE_CLIENT_CERTIFICATE_PATH env vars",{"type":51,"tag":959,"props":1456,"children":1457},{},[1458,1466],{"type":51,"tag":986,"props":1459,"children":1460},{},[1461],{"type":51,"tag":86,"props":1462,"children":1464},{"className":1463},[],[1465],{"type":57,"value":103},{"type":51,"tag":986,"props":1467,"children":1468},{},[1469],{"type":57,"value":1470},"Azure VMs, App Service, Functions, AKS, Arc, Service Fabric",{"type":51,"tag":959,"props":1472,"children":1473},{},[1474,1483],{"type":51,"tag":986,"props":1475,"children":1476},{},[1477],{"type":51,"tag":86,"props":1478,"children":1480},{"className":1479},[],[1481],{"type":57,"value":1482},"WorkloadIdentityCredential",{"type":51,"tag":986,"props":1484,"children":1485},{},[1486],{"type":57,"value":1487},"Kubernetes with Microsoft Entra Workload ID",{"type":51,"tag":674,"props":1489,"children":1491},{"id":1490},"service-principals",[1492],{"type":57,"value":1493},"Service Principals",{"type":51,"tag":951,"props":1495,"children":1496},{},[1497,1511],{"type":51,"tag":955,"props":1498,"children":1499},{},[1500],{"type":51,"tag":959,"props":1501,"children":1502},{},[1503,1507],{"type":51,"tag":963,"props":1504,"children":1505},{},[1506],{"type":57,"value":1370},{"type":51,"tag":963,"props":1508,"children":1509},{},[1510],{"type":57,"value":1375},{"type":51,"tag":979,"props":1512,"children":1513},{},[1514,1531,1548,1565,1582],{"type":51,"tag":959,"props":1515,"children":1516},{},[1517,1526],{"type":51,"tag":986,"props":1518,"children":1519},{},[1520],{"type":51,"tag":86,"props":1521,"children":1523},{"className":1522},[],[1524],{"type":57,"value":1525},"ClientSecretCredential",{"type":51,"tag":986,"props":1527,"children":1528},{},[1529],{"type":57,"value":1530},"Service principal with client secret",{"type":51,"tag":959,"props":1532,"children":1533},{},[1534,1543],{"type":51,"tag":986,"props":1535,"children":1536},{},[1537],{"type":51,"tag":86,"props":1538,"children":1540},{"className":1539},[],[1541],{"type":57,"value":1542},"CertificateCredential",{"type":51,"tag":986,"props":1544,"children":1545},{},[1546],{"type":57,"value":1547},"Service principal with PEM\u002FPKCS12 certificate",{"type":51,"tag":959,"props":1549,"children":1550},{},[1551,1560],{"type":51,"tag":986,"props":1552,"children":1553},{},[1554],{"type":51,"tag":86,"props":1555,"children":1557},{"className":1556},[],[1558],{"type":57,"value":1559},"ClientAssertionCredential",{"type":51,"tag":986,"props":1561,"children":1562},{},[1563],{"type":57,"value":1564},"Service principal with signed JWT assertion",{"type":51,"tag":959,"props":1566,"children":1567},{},[1568,1577],{"type":51,"tag":986,"props":1569,"children":1570},{},[1571],{"type":51,"tag":86,"props":1572,"children":1574},{"className":1573},[],[1575],{"type":57,"value":1576},"AzurePipelinesCredential",{"type":51,"tag":986,"props":1578,"children":1579},{},[1580],{"type":57,"value":1581},"Azure Pipelines with workload identity federation",{"type":51,"tag":959,"props":1583,"children":1584},{},[1585,1594],{"type":51,"tag":986,"props":1586,"children":1587},{},[1588],{"type":51,"tag":86,"props":1589,"children":1591},{"className":1590},[],[1592],{"type":57,"value":1593},"OnBehalfOfCredential",{"type":51,"tag":986,"props":1595,"children":1596},{},[1597],{"type":57,"value":1598},"Middle-tier on-behalf-of flow (delegated user identity)",{"type":51,"tag":674,"props":1600,"children":1602},{"id":1601},"user-authentication",[1603],{"type":57,"value":1604},"User Authentication",{"type":51,"tag":951,"props":1606,"children":1607},{},[1608,1622],{"type":51,"tag":955,"props":1609,"children":1610},{},[1611],{"type":51,"tag":959,"props":1612,"children":1613},{},[1614,1618],{"type":51,"tag":963,"props":1615,"children":1616},{},[1617],{"type":57,"value":1370},{"type":51,"tag":963,"props":1619,"children":1620},{},[1621],{"type":57,"value":1375},{"type":51,"tag":979,"props":1623,"children":1624},{},[1625,1642,1659],{"type":51,"tag":959,"props":1626,"children":1627},{},[1628,1637],{"type":51,"tag":986,"props":1629,"children":1630},{},[1631],{"type":51,"tag":86,"props":1632,"children":1634},{"className":1633},[],[1635],{"type":57,"value":1636},"InteractiveBrowserCredential",{"type":51,"tag":986,"props":1638,"children":1639},{},[1640],{"type":57,"value":1641},"Interactive browser OAuth sign-in",{"type":51,"tag":959,"props":1643,"children":1644},{},[1645,1654],{"type":51,"tag":986,"props":1646,"children":1647},{},[1648],{"type":51,"tag":86,"props":1649,"children":1651},{"className":1650},[],[1652],{"type":57,"value":1653},"DeviceCodeCredential",{"type":51,"tag":986,"props":1655,"children":1656},{},[1657],{"type":57,"value":1658},"Headless\u002FSSH device code flow",{"type":51,"tag":959,"props":1660,"children":1661},{},[1662,1671],{"type":51,"tag":986,"props":1663,"children":1664},{},[1665],{"type":51,"tag":86,"props":1666,"children":1668},{"className":1667},[],[1669],{"type":57,"value":1670},"AuthorizationCodeCredential",{"type":51,"tag":986,"props":1672,"children":1673},{},[1674],{"type":57,"value":1675},"Previously obtained authorization code",{"type":51,"tag":674,"props":1677,"children":1679},{"id":1678},"developer-tools",[1680],{"type":57,"value":1681},"Developer Tools",{"type":51,"tag":951,"props":1683,"children":1684},{},[1685,1699],{"type":51,"tag":955,"props":1686,"children":1687},{},[1688],{"type":51,"tag":959,"props":1689,"children":1690},{},[1691,1695],{"type":51,"tag":963,"props":1692,"children":1693},{},[1694],{"type":57,"value":1370},{"type":51,"tag":963,"props":1696,"children":1697},{},[1698],{"type":57,"value":1375},{"type":51,"tag":979,"props":1700,"children":1701},{},[1702,1723,1744,1765],{"type":51,"tag":959,"props":1703,"children":1704},{},[1705,1714],{"type":51,"tag":986,"props":1706,"children":1707},{},[1708],{"type":51,"tag":86,"props":1709,"children":1711},{"className":1710},[],[1712],{"type":57,"value":1713},"AzureCliCredential",{"type":51,"tag":986,"props":1715,"children":1716},{},[1717],{"type":51,"tag":86,"props":1718,"children":1720},{"className":1719},[],[1721],{"type":57,"value":1722},"az login",{"type":51,"tag":959,"props":1724,"children":1725},{},[1726,1735],{"type":51,"tag":986,"props":1727,"children":1728},{},[1729],{"type":51,"tag":86,"props":1730,"children":1732},{"className":1731},[],[1733],{"type":57,"value":1734},"AzureDeveloperCliCredential",{"type":51,"tag":986,"props":1736,"children":1737},{},[1738],{"type":51,"tag":86,"props":1739,"children":1741},{"className":1740},[],[1742],{"type":57,"value":1743},"azd auth login",{"type":51,"tag":959,"props":1745,"children":1746},{},[1747,1756],{"type":51,"tag":986,"props":1748,"children":1749},{},[1750],{"type":51,"tag":86,"props":1751,"children":1753},{"className":1752},[],[1754],{"type":57,"value":1755},"AzurePowerShellCredential",{"type":51,"tag":986,"props":1757,"children":1758},{},[1759],{"type":51,"tag":86,"props":1760,"children":1762},{"className":1761},[],[1763],{"type":57,"value":1764},"Connect-AzAccount",{"type":51,"tag":959,"props":1766,"children":1767},{},[1768,1777],{"type":51,"tag":986,"props":1769,"children":1770},{},[1771],{"type":51,"tag":86,"props":1772,"children":1774},{"className":1773},[],[1775],{"type":57,"value":1776},"VisualStudioCodeCredential",{"type":51,"tag":986,"props":1778,"children":1779},{},[1780],{"type":57,"value":1781},"VS Code Azure Resources extension",{"type":51,"tag":128,"props":1783,"children":1785},{"id":1784},"specific-credential-examples",[1786],{"type":57,"value":1787},"Specific Credential Examples",{"type":51,"tag":674,"props":1789,"children":1791},{"id":1790},"managedidentitycredential",[1792],{"type":57,"value":103},{"type":51,"tag":60,"props":1794,"children":1795},{},[1796],{"type":57,"value":1797},"For Azure-hosted resources (VMs, App Service, Functions, AKS):",{"type":51,"tag":135,"props":1799,"children":1801},{"className":686,"code":1800,"language":18,"meta":140,"style":140},"from azure.identity import ManagedIdentityCredential\n\n# System-assigned managed identity\ncredential = ManagedIdentityCredential()\n\n# User-assigned managed identity (client_id, object_id, or resource_id)\ncredential = ManagedIdentityCredential(\n    client_id=\"\u003Cuser-assigned-mi-client-id>\"\n)\n# Also valid:\n# credential = ManagedIdentityCredential(object_id=\"\u003Cobject-id>\")\n# credential = ManagedIdentityCredential(resource_id=\"\u003Cresource-id>\")\n",[1802],{"type":51,"tag":86,"props":1803,"children":1804},{"__ignoreMap":140},[1805,1813,1820,1828,1836,1843,1851,1859,1867,1874,1882,1890],{"type":51,"tag":146,"props":1806,"children":1807},{"class":148,"line":149},[1808],{"type":51,"tag":146,"props":1809,"children":1810},{},[1811],{"type":57,"value":1812},"from azure.identity import ManagedIdentityCredential\n",{"type":51,"tag":146,"props":1814,"children":1815},{"class":148,"line":236},[1816],{"type":51,"tag":146,"props":1817,"children":1818},{"emptyLinePlaceholder":310},[1819],{"type":57,"value":313},{"type":51,"tag":146,"props":1821,"children":1822},{"class":148,"line":262},[1823],{"type":51,"tag":146,"props":1824,"children":1825},{},[1826],{"type":57,"value":1827},"# System-assigned managed identity\n",{"type":51,"tag":146,"props":1829,"children":1830},{"class":148,"line":284},[1831],{"type":51,"tag":146,"props":1832,"children":1833},{},[1834],{"type":57,"value":1835},"credential = ManagedIdentityCredential()\n",{"type":51,"tag":146,"props":1837,"children":1838},{"class":148,"line":306},[1839],{"type":51,"tag":146,"props":1840,"children":1841},{"emptyLinePlaceholder":310},[1842],{"type":57,"value":313},{"type":51,"tag":146,"props":1844,"children":1845},{"class":148,"line":316},[1846],{"type":51,"tag":146,"props":1847,"children":1848},{},[1849],{"type":57,"value":1850},"# User-assigned managed identity (client_id, object_id, or resource_id)\n",{"type":51,"tag":146,"props":1852,"children":1853},{"class":148,"line":325},[1854],{"type":51,"tag":146,"props":1855,"children":1856},{},[1857],{"type":57,"value":1858},"credential = ManagedIdentityCredential(\n",{"type":51,"tag":146,"props":1860,"children":1861},{"class":148,"line":345},[1862],{"type":51,"tag":146,"props":1863,"children":1864},{},[1865],{"type":57,"value":1866},"    client_id=\"\u003Cuser-assigned-mi-client-id>\"\n",{"type":51,"tag":146,"props":1868,"children":1869},{"class":148,"line":365},[1870],{"type":51,"tag":146,"props":1871,"children":1872},{},[1873],{"type":57,"value":860},{"type":51,"tag":146,"props":1875,"children":1876},{"class":148,"line":384},[1877],{"type":51,"tag":146,"props":1878,"children":1879},{},[1880],{"type":57,"value":1881},"# Also valid:\n",{"type":51,"tag":146,"props":1883,"children":1884},{"class":148,"line":406},[1885],{"type":51,"tag":146,"props":1886,"children":1887},{},[1888],{"type":57,"value":1889},"# credential = ManagedIdentityCredential(object_id=\"\u003Cobject-id>\")\n",{"type":51,"tag":146,"props":1891,"children":1892},{"class":148,"line":414},[1893],{"type":51,"tag":146,"props":1894,"children":1895},{},[1896],{"type":57,"value":1897},"# credential = ManagedIdentityCredential(resource_id=\"\u003Cresource-id>\")\n",{"type":51,"tag":674,"props":1899,"children":1901},{"id":1900},"clientsecretcredential",[1902],{"type":57,"value":1525},{"type":51,"tag":135,"props":1904,"children":1906},{"className":686,"code":1905,"language":18,"meta":140,"style":140},"import os\nfrom azure.identity import ClientSecretCredential\n\ncredential = ClientSecretCredential(\n    tenant_id=os.environ[\"AZURE_TENANT_ID\"],\n    client_id=os.environ[\"AZURE_CLIENT_ID\"],\n    client_secret=os.environ[\"AZURE_CLIENT_SECRET\"],\n)\n",[1907],{"type":51,"tag":86,"props":1908,"children":1909},{"__ignoreMap":140},[1910,1918,1926,1933,1941,1949,1957,1965],{"type":51,"tag":146,"props":1911,"children":1912},{"class":148,"line":149},[1913],{"type":51,"tag":146,"props":1914,"children":1915},{},[1916],{"type":57,"value":1917},"import os\n",{"type":51,"tag":146,"props":1919,"children":1920},{"class":148,"line":236},[1921],{"type":51,"tag":146,"props":1922,"children":1923},{},[1924],{"type":57,"value":1925},"from azure.identity import ClientSecretCredential\n",{"type":51,"tag":146,"props":1927,"children":1928},{"class":148,"line":262},[1929],{"type":51,"tag":146,"props":1930,"children":1931},{"emptyLinePlaceholder":310},[1932],{"type":57,"value":313},{"type":51,"tag":146,"props":1934,"children":1935},{"class":148,"line":284},[1936],{"type":51,"tag":146,"props":1937,"children":1938},{},[1939],{"type":57,"value":1940},"credential = ClientSecretCredential(\n",{"type":51,"tag":146,"props":1942,"children":1943},{"class":148,"line":306},[1944],{"type":51,"tag":146,"props":1945,"children":1946},{},[1947],{"type":57,"value":1948},"    tenant_id=os.environ[\"AZURE_TENANT_ID\"],\n",{"type":51,"tag":146,"props":1950,"children":1951},{"class":148,"line":316},[1952],{"type":51,"tag":146,"props":1953,"children":1954},{},[1955],{"type":57,"value":1956},"    client_id=os.environ[\"AZURE_CLIENT_ID\"],\n",{"type":51,"tag":146,"props":1958,"children":1959},{"class":148,"line":325},[1960],{"type":51,"tag":146,"props":1961,"children":1962},{},[1963],{"type":57,"value":1964},"    client_secret=os.environ[\"AZURE_CLIENT_SECRET\"],\n",{"type":51,"tag":146,"props":1966,"children":1967},{"class":148,"line":345},[1968],{"type":51,"tag":146,"props":1969,"children":1970},{},[1971],{"type":57,"value":860},{"type":51,"tag":674,"props":1973,"children":1975},{"id":1974},"certificatecredential",[1976],{"type":57,"value":1542},{"type":51,"tag":554,"props":1978,"children":1979},{},[1980],{"type":51,"tag":60,"props":1981,"children":1982},{},[1983,1988,1990,1995,1997,2003],{"type":51,"tag":561,"props":1984,"children":1985},{},[1986],{"type":57,"value":1987},"Note:",{"type":57,"value":1989}," The class is ",{"type":51,"tag":86,"props":1991,"children":1993},{"className":1992},[],[1994],{"type":57,"value":1542},{"type":57,"value":1996},", NOT ",{"type":51,"tag":86,"props":1998,"children":2000},{"className":1999},[],[2001],{"type":57,"value":2002},"ClientCertificateCredential",{"type":57,"value":584},{"type":51,"tag":135,"props":2005,"children":2007},{"className":686,"code":2006,"language":18,"meta":140,"style":140},"from azure.identity import CertificateCredential\n\n# From file path\ncredential = CertificateCredential(\n    tenant_id=\"\u003Ctenant-id>\",\n    client_id=\"\u003Cclient-id>\",\n    certificate_path=\"\u002Fpath\u002Fto\u002Fcert.pem\",\n)\n\n# From bytes with password\ncredential = CertificateCredential(\n    tenant_id=\"\u003Ctenant-id>\",\n    client_id=\"\u003Cclient-id>\",\n    certificate_data=cert_bytes,\n    password=\"\u003Ccert-password>\",\n    send_certificate_chain=True,  # Required for SNI auth\n)\n",[2008],{"type":51,"tag":86,"props":2009,"children":2010},{"__ignoreMap":140},[2011,2019,2026,2034,2042,2050,2058,2066,2073,2080,2088,2095,2102,2109,2117,2125,2133],{"type":51,"tag":146,"props":2012,"children":2013},{"class":148,"line":149},[2014],{"type":51,"tag":146,"props":2015,"children":2016},{},[2017],{"type":57,"value":2018},"from azure.identity import CertificateCredential\n",{"type":51,"tag":146,"props":2020,"children":2021},{"class":148,"line":236},[2022],{"type":51,"tag":146,"props":2023,"children":2024},{"emptyLinePlaceholder":310},[2025],{"type":57,"value":313},{"type":51,"tag":146,"props":2027,"children":2028},{"class":148,"line":262},[2029],{"type":51,"tag":146,"props":2030,"children":2031},{},[2032],{"type":57,"value":2033},"# From file path\n",{"type":51,"tag":146,"props":2035,"children":2036},{"class":148,"line":284},[2037],{"type":51,"tag":146,"props":2038,"children":2039},{},[2040],{"type":57,"value":2041},"credential = CertificateCredential(\n",{"type":51,"tag":146,"props":2043,"children":2044},{"class":148,"line":306},[2045],{"type":51,"tag":146,"props":2046,"children":2047},{},[2048],{"type":57,"value":2049},"    tenant_id=\"\u003Ctenant-id>\",\n",{"type":51,"tag":146,"props":2051,"children":2052},{"class":148,"line":316},[2053],{"type":51,"tag":146,"props":2054,"children":2055},{},[2056],{"type":57,"value":2057},"    client_id=\"\u003Cclient-id>\",\n",{"type":51,"tag":146,"props":2059,"children":2060},{"class":148,"line":325},[2061],{"type":51,"tag":146,"props":2062,"children":2063},{},[2064],{"type":57,"value":2065},"    certificate_path=\"\u002Fpath\u002Fto\u002Fcert.pem\",\n",{"type":51,"tag":146,"props":2067,"children":2068},{"class":148,"line":345},[2069],{"type":51,"tag":146,"props":2070,"children":2071},{},[2072],{"type":57,"value":860},{"type":51,"tag":146,"props":2074,"children":2075},{"class":148,"line":365},[2076],{"type":51,"tag":146,"props":2077,"children":2078},{"emptyLinePlaceholder":310},[2079],{"type":57,"value":313},{"type":51,"tag":146,"props":2081,"children":2082},{"class":148,"line":384},[2083],{"type":51,"tag":146,"props":2084,"children":2085},{},[2086],{"type":57,"value":2087},"# From bytes with password\n",{"type":51,"tag":146,"props":2089,"children":2090},{"class":148,"line":406},[2091],{"type":51,"tag":146,"props":2092,"children":2093},{},[2094],{"type":57,"value":2041},{"type":51,"tag":146,"props":2096,"children":2097},{"class":148,"line":414},[2098],{"type":51,"tag":146,"props":2099,"children":2100},{},[2101],{"type":57,"value":2049},{"type":51,"tag":146,"props":2103,"children":2104},{"class":148,"line":423},[2105],{"type":51,"tag":146,"props":2106,"children":2107},{},[2108],{"type":57,"value":2057},{"type":51,"tag":146,"props":2110,"children":2111},{"class":148,"line":446},[2112],{"type":51,"tag":146,"props":2113,"children":2114},{},[2115],{"type":57,"value":2116},"    certificate_data=cert_bytes,\n",{"type":51,"tag":146,"props":2118,"children":2119},{"class":148,"line":454},[2120],{"type":51,"tag":146,"props":2121,"children":2122},{},[2123],{"type":57,"value":2124},"    password=\"\u003Ccert-password>\",\n",{"type":51,"tag":146,"props":2126,"children":2127},{"class":148,"line":463},[2128],{"type":51,"tag":146,"props":2129,"children":2130},{},[2131],{"type":57,"value":2132},"    send_certificate_chain=True,  # Required for SNI auth\n",{"type":51,"tag":146,"props":2134,"children":2135},{"class":148,"line":484},[2136],{"type":51,"tag":146,"props":2137,"children":2138},{},[2139],{"type":57,"value":860},{"type":51,"tag":674,"props":2141,"children":2143},{"id":2142},"azureclicredential",[2144],{"type":57,"value":1713},{"type":51,"tag":135,"props":2146,"children":2148},{"className":686,"code":2147,"language":18,"meta":140,"style":140},"from azure.identity import AzureCliCredential\n\ncredential = AzureCliCredential()\n# With tenant restriction\ncredential = AzureCliCredential(tenant_id=\"\u003Ctenant-id>\")\n",[2149],{"type":51,"tag":86,"props":2150,"children":2151},{"__ignoreMap":140},[2152,2160,2167,2175,2183],{"type":51,"tag":146,"props":2153,"children":2154},{"class":148,"line":149},[2155],{"type":51,"tag":146,"props":2156,"children":2157},{},[2158],{"type":57,"value":2159},"from azure.identity import AzureCliCredential\n",{"type":51,"tag":146,"props":2161,"children":2162},{"class":148,"line":236},[2163],{"type":51,"tag":146,"props":2164,"children":2165},{"emptyLinePlaceholder":310},[2166],{"type":57,"value":313},{"type":51,"tag":146,"props":2168,"children":2169},{"class":148,"line":262},[2170],{"type":51,"tag":146,"props":2171,"children":2172},{},[2173],{"type":57,"value":2174},"credential = AzureCliCredential()\n",{"type":51,"tag":146,"props":2176,"children":2177},{"class":148,"line":284},[2178],{"type":51,"tag":146,"props":2179,"children":2180},{},[2181],{"type":57,"value":2182},"# With tenant restriction\n",{"type":51,"tag":146,"props":2184,"children":2185},{"class":148,"line":306},[2186],{"type":51,"tag":146,"props":2187,"children":2188},{},[2189],{"type":57,"value":2190},"credential = AzureCliCredential(tenant_id=\"\u003Ctenant-id>\")\n",{"type":51,"tag":674,"props":2192,"children":2194},{"id":2193},"chainedtokencredential",[2195],{"type":57,"value":1406},{"type":51,"tag":60,"props":2197,"children":2198},{},[2199],{"type":57,"value":2200},"Custom credential chain:",{"type":51,"tag":135,"props":2202,"children":2204},{"className":686,"code":2203,"language":18,"meta":140,"style":140},"from azure.identity import (\n    ChainedTokenCredential,\n    ManagedIdentityCredential,\n    AzureCliCredential,\n)\n\n# Try managed identity first, fall back to CLI\ncredential = ChainedTokenCredential(\n    ManagedIdentityCredential(client_id=\"\u003Cuser-assigned-mi-client-id>\"),\n    AzureCliCredential(),\n)\n",[2205],{"type":51,"tag":86,"props":2206,"children":2207},{"__ignoreMap":140},[2208,2216,2224,2232,2240,2247,2254,2262,2270,2278,2286],{"type":51,"tag":146,"props":2209,"children":2210},{"class":148,"line":149},[2211],{"type":51,"tag":146,"props":2212,"children":2213},{},[2214],{"type":57,"value":2215},"from azure.identity import (\n",{"type":51,"tag":146,"props":2217,"children":2218},{"class":148,"line":236},[2219],{"type":51,"tag":146,"props":2220,"children":2221},{},[2222],{"type":57,"value":2223},"    ChainedTokenCredential,\n",{"type":51,"tag":146,"props":2225,"children":2226},{"class":148,"line":262},[2227],{"type":51,"tag":146,"props":2228,"children":2229},{},[2230],{"type":57,"value":2231},"    ManagedIdentityCredential,\n",{"type":51,"tag":146,"props":2233,"children":2234},{"class":148,"line":284},[2235],{"type":51,"tag":146,"props":2236,"children":2237},{},[2238],{"type":57,"value":2239},"    AzureCliCredential,\n",{"type":51,"tag":146,"props":2241,"children":2242},{"class":148,"line":306},[2243],{"type":51,"tag":146,"props":2244,"children":2245},{},[2246],{"type":57,"value":860},{"type":51,"tag":146,"props":2248,"children":2249},{"class":148,"line":316},[2250],{"type":51,"tag":146,"props":2251,"children":2252},{"emptyLinePlaceholder":310},[2253],{"type":57,"value":313},{"type":51,"tag":146,"props":2255,"children":2256},{"class":148,"line":325},[2257],{"type":51,"tag":146,"props":2258,"children":2259},{},[2260],{"type":57,"value":2261},"# Try managed identity first, fall back to CLI\n",{"type":51,"tag":146,"props":2263,"children":2264},{"class":148,"line":345},[2265],{"type":51,"tag":146,"props":2266,"children":2267},{},[2268],{"type":57,"value":2269},"credential = ChainedTokenCredential(\n",{"type":51,"tag":146,"props":2271,"children":2272},{"class":148,"line":365},[2273],{"type":51,"tag":146,"props":2274,"children":2275},{},[2276],{"type":57,"value":2277},"    ManagedIdentityCredential(client_id=\"\u003Cuser-assigned-mi-client-id>\"),\n",{"type":51,"tag":146,"props":2279,"children":2280},{"class":148,"line":384},[2281],{"type":51,"tag":146,"props":2282,"children":2283},{},[2284],{"type":57,"value":2285},"    AzureCliCredential(),\n",{"type":51,"tag":146,"props":2287,"children":2288},{"class":148,"line":406},[2289],{"type":51,"tag":146,"props":2290,"children":2291},{},[2292],{"type":57,"value":860},{"type":51,"tag":674,"props":2294,"children":2296},{"id":2295},"workloadidentitycredential",[2297],{"type":57,"value":1482},{"type":51,"tag":60,"props":2299,"children":2300},{},[2301],{"type":57,"value":2302},"For Azure Kubernetes Service with workload identity:",{"type":51,"tag":135,"props":2304,"children":2306},{"className":686,"code":2305,"language":18,"meta":140,"style":140},"from azure.identity import WorkloadIdentityCredential\n\n# Reads from AZURE_TENANT_ID, AZURE_CLIENT_ID, AZURE_FEDERATED_TOKEN_FILE\ncredential = WorkloadIdentityCredential()\n\n# Or explicit configuration\ncredential = WorkloadIdentityCredential(\n    tenant_id=\"\u003Ctenant-id>\",\n    client_id=\"\u003Cclient-id>\",\n    token_file_path=\"\u002Fvar\u002Frun\u002Fsecrets\u002Fazure\u002Ftokens\u002Fazure-identity-token\",\n)\n",[2307],{"type":51,"tag":86,"props":2308,"children":2309},{"__ignoreMap":140},[2310,2318,2325,2333,2341,2348,2356,2364,2371,2378,2386],{"type":51,"tag":146,"props":2311,"children":2312},{"class":148,"line":149},[2313],{"type":51,"tag":146,"props":2314,"children":2315},{},[2316],{"type":57,"value":2317},"from azure.identity import WorkloadIdentityCredential\n",{"type":51,"tag":146,"props":2319,"children":2320},{"class":148,"line":236},[2321],{"type":51,"tag":146,"props":2322,"children":2323},{"emptyLinePlaceholder":310},[2324],{"type":57,"value":313},{"type":51,"tag":146,"props":2326,"children":2327},{"class":148,"line":262},[2328],{"type":51,"tag":146,"props":2329,"children":2330},{},[2331],{"type":57,"value":2332},"# Reads from AZURE_TENANT_ID, AZURE_CLIENT_ID, AZURE_FEDERATED_TOKEN_FILE\n",{"type":51,"tag":146,"props":2334,"children":2335},{"class":148,"line":284},[2336],{"type":51,"tag":146,"props":2337,"children":2338},{},[2339],{"type":57,"value":2340},"credential = WorkloadIdentityCredential()\n",{"type":51,"tag":146,"props":2342,"children":2343},{"class":148,"line":306},[2344],{"type":51,"tag":146,"props":2345,"children":2346},{"emptyLinePlaceholder":310},[2347],{"type":57,"value":313},{"type":51,"tag":146,"props":2349,"children":2350},{"class":148,"line":316},[2351],{"type":51,"tag":146,"props":2352,"children":2353},{},[2354],{"type":57,"value":2355},"# Or explicit configuration\n",{"type":51,"tag":146,"props":2357,"children":2358},{"class":148,"line":325},[2359],{"type":51,"tag":146,"props":2360,"children":2361},{},[2362],{"type":57,"value":2363},"credential = WorkloadIdentityCredential(\n",{"type":51,"tag":146,"props":2365,"children":2366},{"class":148,"line":345},[2367],{"type":51,"tag":146,"props":2368,"children":2369},{},[2370],{"type":57,"value":2049},{"type":51,"tag":146,"props":2372,"children":2373},{"class":148,"line":365},[2374],{"type":51,"tag":146,"props":2375,"children":2376},{},[2377],{"type":57,"value":2057},{"type":51,"tag":146,"props":2379,"children":2380},{"class":148,"line":384},[2381],{"type":51,"tag":146,"props":2382,"children":2383},{},[2384],{"type":57,"value":2385},"    token_file_path=\"\u002Fvar\u002Frun\u002Fsecrets\u002Fazure\u002Ftokens\u002Fazure-identity-token\",\n",{"type":51,"tag":146,"props":2387,"children":2388},{"class":148,"line":406},[2389],{"type":51,"tag":146,"props":2390,"children":2391},{},[2392],{"type":57,"value":860},{"type":51,"tag":674,"props":2394,"children":2396},{"id":2395},"devicecodecredential",[2397],{"type":57,"value":1653},{"type":51,"tag":60,"props":2399,"children":2400},{},[2401],{"type":57,"value":2402},"For headless devices (IoT, SSH, CLI tools):",{"type":51,"tag":135,"props":2404,"children":2406},{"className":686,"code":2405,"language":18,"meta":140,"style":140},"from azure.identity import DeviceCodeCredential\n\ncredential = DeviceCodeCredential()\n# Prints device code prompt to stdout by default\n\n# With custom prompt callback\ndef prompt_callback(verification_uri, user_code, expires_on):\n    print(f\"Go to {verification_uri} and enter code {user_code}\")\n\ncredential = DeviceCodeCredential(\n    client_id=\"\u003Cclient-id>\",\n    prompt_callback=prompt_callback,\n)\n",[2407],{"type":51,"tag":86,"props":2408,"children":2409},{"__ignoreMap":140},[2410,2418,2425,2433,2441,2448,2456,2464,2472,2479,2487,2494,2502],{"type":51,"tag":146,"props":2411,"children":2412},{"class":148,"line":149},[2413],{"type":51,"tag":146,"props":2414,"children":2415},{},[2416],{"type":57,"value":2417},"from azure.identity import DeviceCodeCredential\n",{"type":51,"tag":146,"props":2419,"children":2420},{"class":148,"line":236},[2421],{"type":51,"tag":146,"props":2422,"children":2423},{"emptyLinePlaceholder":310},[2424],{"type":57,"value":313},{"type":51,"tag":146,"props":2426,"children":2427},{"class":148,"line":262},[2428],{"type":51,"tag":146,"props":2429,"children":2430},{},[2431],{"type":57,"value":2432},"credential = DeviceCodeCredential()\n",{"type":51,"tag":146,"props":2434,"children":2435},{"class":148,"line":284},[2436],{"type":51,"tag":146,"props":2437,"children":2438},{},[2439],{"type":57,"value":2440},"# Prints device code prompt to stdout by default\n",{"type":51,"tag":146,"props":2442,"children":2443},{"class":148,"line":306},[2444],{"type":51,"tag":146,"props":2445,"children":2446},{"emptyLinePlaceholder":310},[2447],{"type":57,"value":313},{"type":51,"tag":146,"props":2449,"children":2450},{"class":148,"line":316},[2451],{"type":51,"tag":146,"props":2452,"children":2453},{},[2454],{"type":57,"value":2455},"# With custom prompt callback\n",{"type":51,"tag":146,"props":2457,"children":2458},{"class":148,"line":325},[2459],{"type":51,"tag":146,"props":2460,"children":2461},{},[2462],{"type":57,"value":2463},"def prompt_callback(verification_uri, user_code, expires_on):\n",{"type":51,"tag":146,"props":2465,"children":2466},{"class":148,"line":345},[2467],{"type":51,"tag":146,"props":2468,"children":2469},{},[2470],{"type":57,"value":2471},"    print(f\"Go to {verification_uri} and enter code {user_code}\")\n",{"type":51,"tag":146,"props":2473,"children":2474},{"class":148,"line":365},[2475],{"type":51,"tag":146,"props":2476,"children":2477},{"emptyLinePlaceholder":310},[2478],{"type":57,"value":313},{"type":51,"tag":146,"props":2480,"children":2481},{"class":148,"line":384},[2482],{"type":51,"tag":146,"props":2483,"children":2484},{},[2485],{"type":57,"value":2486},"credential = DeviceCodeCredential(\n",{"type":51,"tag":146,"props":2488,"children":2489},{"class":148,"line":406},[2490],{"type":51,"tag":146,"props":2491,"children":2492},{},[2493],{"type":57,"value":2057},{"type":51,"tag":146,"props":2495,"children":2496},{"class":148,"line":414},[2497],{"type":51,"tag":146,"props":2498,"children":2499},{},[2500],{"type":57,"value":2501},"    prompt_callback=prompt_callback,\n",{"type":51,"tag":146,"props":2503,"children":2504},{"class":148,"line":423},[2505],{"type":51,"tag":146,"props":2506,"children":2507},{},[2508],{"type":57,"value":860},{"type":51,"tag":674,"props":2510,"children":2512},{"id":2511},"interactivebrowsercredential",[2513],{"type":57,"value":1636},{"type":51,"tag":60,"props":2515,"children":2516},{},[2517],{"type":57,"value":2518},"For interactive OAuth browser sign-in:",{"type":51,"tag":135,"props":2520,"children":2522},{"className":686,"code":2521,"language":18,"meta":140,"style":140},"from azure.identity import InteractiveBrowserCredential\n\ncredential = InteractiveBrowserCredential()\n\n# With specific tenant and client\ncredential = InteractiveBrowserCredential(\n    tenant_id=\"\u003Ctenant-id>\",\n    client_id=\"\u003Cclient-id>\",\n)\n",[2523],{"type":51,"tag":86,"props":2524,"children":2525},{"__ignoreMap":140},[2526,2534,2541,2549,2556,2564,2572,2579,2586],{"type":51,"tag":146,"props":2527,"children":2528},{"class":148,"line":149},[2529],{"type":51,"tag":146,"props":2530,"children":2531},{},[2532],{"type":57,"value":2533},"from azure.identity import InteractiveBrowserCredential\n",{"type":51,"tag":146,"props":2535,"children":2536},{"class":148,"line":236},[2537],{"type":51,"tag":146,"props":2538,"children":2539},{"emptyLinePlaceholder":310},[2540],{"type":57,"value":313},{"type":51,"tag":146,"props":2542,"children":2543},{"class":148,"line":262},[2544],{"type":51,"tag":146,"props":2545,"children":2546},{},[2547],{"type":57,"value":2548},"credential = InteractiveBrowserCredential()\n",{"type":51,"tag":146,"props":2550,"children":2551},{"class":148,"line":284},[2552],{"type":51,"tag":146,"props":2553,"children":2554},{"emptyLinePlaceholder":310},[2555],{"type":57,"value":313},{"type":51,"tag":146,"props":2557,"children":2558},{"class":148,"line":306},[2559],{"type":51,"tag":146,"props":2560,"children":2561},{},[2562],{"type":57,"value":2563},"# With specific tenant and client\n",{"type":51,"tag":146,"props":2565,"children":2566},{"class":148,"line":316},[2567],{"type":51,"tag":146,"props":2568,"children":2569},{},[2570],{"type":57,"value":2571},"credential = InteractiveBrowserCredential(\n",{"type":51,"tag":146,"props":2573,"children":2574},{"class":148,"line":325},[2575],{"type":51,"tag":146,"props":2576,"children":2577},{},[2578],{"type":57,"value":2049},{"type":51,"tag":146,"props":2580,"children":2581},{"class":148,"line":345},[2582],{"type":51,"tag":146,"props":2583,"children":2584},{},[2585],{"type":57,"value":2057},{"type":51,"tag":146,"props":2587,"children":2588},{"class":148,"line":365},[2589],{"type":51,"tag":146,"props":2590,"children":2591},{},[2592],{"type":57,"value":860},{"type":51,"tag":674,"props":2594,"children":2596},{"id":2595},"onbehalfofcredential",[2597],{"type":57,"value":1593},{"type":51,"tag":60,"props":2599,"children":2600},{},[2601],{"type":57,"value":2602},"For middle-tier services propagating user identity:",{"type":51,"tag":135,"props":2604,"children":2606},{"className":686,"code":2605,"language":18,"meta":140,"style":140},"from azure.identity import OnBehalfOfCredential\n\ncredential = OnBehalfOfCredential(\n    tenant_id=\"\u003Ctenant-id>\",\n    client_id=\"\u003Cclient-id>\",\n    client_secret=\"\u003Cclient-secret>\",\n    user_assertion=\"\u003Caccess-token-from-client>\",\n)\n",[2607],{"type":51,"tag":86,"props":2608,"children":2609},{"__ignoreMap":140},[2610,2618,2625,2633,2640,2647,2655,2663],{"type":51,"tag":146,"props":2611,"children":2612},{"class":148,"line":149},[2613],{"type":51,"tag":146,"props":2614,"children":2615},{},[2616],{"type":57,"value":2617},"from azure.identity import OnBehalfOfCredential\n",{"type":51,"tag":146,"props":2619,"children":2620},{"class":148,"line":236},[2621],{"type":51,"tag":146,"props":2622,"children":2623},{"emptyLinePlaceholder":310},[2624],{"type":57,"value":313},{"type":51,"tag":146,"props":2626,"children":2627},{"class":148,"line":262},[2628],{"type":51,"tag":146,"props":2629,"children":2630},{},[2631],{"type":57,"value":2632},"credential = OnBehalfOfCredential(\n",{"type":51,"tag":146,"props":2634,"children":2635},{"class":148,"line":284},[2636],{"type":51,"tag":146,"props":2637,"children":2638},{},[2639],{"type":57,"value":2049},{"type":51,"tag":146,"props":2641,"children":2642},{"class":148,"line":306},[2643],{"type":51,"tag":146,"props":2644,"children":2645},{},[2646],{"type":57,"value":2057},{"type":51,"tag":146,"props":2648,"children":2649},{"class":148,"line":316},[2650],{"type":51,"tag":146,"props":2651,"children":2652},{},[2653],{"type":57,"value":2654},"    client_secret=\"\u003Cclient-secret>\",\n",{"type":51,"tag":146,"props":2656,"children":2657},{"class":148,"line":325},[2658],{"type":51,"tag":146,"props":2659,"children":2660},{},[2661],{"type":57,"value":2662},"    user_assertion=\"\u003Caccess-token-from-client>\",\n",{"type":51,"tag":146,"props":2664,"children":2665},{"class":148,"line":345},[2666],{"type":51,"tag":146,"props":2667,"children":2668},{},[2669],{"type":57,"value":860},{"type":51,"tag":674,"props":2671,"children":2673},{"id":2672},"azurepipelinescredential",[2674],{"type":57,"value":1576},{"type":51,"tag":60,"props":2676,"children":2677},{},[2678],{"type":57,"value":2679},"For Azure DevOps pipelines with workload identity federation:",{"type":51,"tag":135,"props":2681,"children":2683},{"className":686,"code":2682,"language":18,"meta":140,"style":140},"import os\nfrom azure.identity import AzurePipelinesCredential\n\ncredential = AzurePipelinesCredential(\n    tenant_id=\"\u003Ctenant-id>\",\n    client_id=\"\u003Cclient-id>\",\n    service_connection_id=\"\u003Cservice-connection-id>\",\n    system_access_token=os.environ[\"SYSTEM_ACCESSTOKEN\"],\n)\n",[2684],{"type":51,"tag":86,"props":2685,"children":2686},{"__ignoreMap":140},[2687,2694,2702,2709,2717,2724,2731,2739,2747],{"type":51,"tag":146,"props":2688,"children":2689},{"class":148,"line":149},[2690],{"type":51,"tag":146,"props":2691,"children":2692},{},[2693],{"type":57,"value":1917},{"type":51,"tag":146,"props":2695,"children":2696},{"class":148,"line":236},[2697],{"type":51,"tag":146,"props":2698,"children":2699},{},[2700],{"type":57,"value":2701},"from azure.identity import AzurePipelinesCredential\n",{"type":51,"tag":146,"props":2703,"children":2704},{"class":148,"line":262},[2705],{"type":51,"tag":146,"props":2706,"children":2707},{"emptyLinePlaceholder":310},[2708],{"type":57,"value":313},{"type":51,"tag":146,"props":2710,"children":2711},{"class":148,"line":284},[2712],{"type":51,"tag":146,"props":2713,"children":2714},{},[2715],{"type":57,"value":2716},"credential = AzurePipelinesCredential(\n",{"type":51,"tag":146,"props":2718,"children":2719},{"class":148,"line":306},[2720],{"type":51,"tag":146,"props":2721,"children":2722},{},[2723],{"type":57,"value":2049},{"type":51,"tag":146,"props":2725,"children":2726},{"class":148,"line":316},[2727],{"type":51,"tag":146,"props":2728,"children":2729},{},[2730],{"type":57,"value":2057},{"type":51,"tag":146,"props":2732,"children":2733},{"class":148,"line":325},[2734],{"type":51,"tag":146,"props":2735,"children":2736},{},[2737],{"type":57,"value":2738},"    service_connection_id=\"\u003Cservice-connection-id>\",\n",{"type":51,"tag":146,"props":2740,"children":2741},{"class":148,"line":345},[2742],{"type":51,"tag":146,"props":2743,"children":2744},{},[2745],{"type":57,"value":2746},"    system_access_token=os.environ[\"SYSTEM_ACCESSTOKEN\"],\n",{"type":51,"tag":146,"props":2748,"children":2749},{"class":148,"line":365},[2750],{"type":51,"tag":146,"props":2751,"children":2752},{},[2753],{"type":57,"value":860},{"type":51,"tag":128,"props":2755,"children":2757},{"id":2756},"getting-tokens-directly",[2758],{"type":57,"value":2759},"Getting Tokens Directly",{"type":51,"tag":135,"props":2761,"children":2763},{"className":686,"code":2762,"language":18,"meta":140,"style":140},"from azure.identity import DefaultAzureCredential\n\nwith DefaultAzureCredential() as credential:\n    # Get token for a specific scope\n    token = credential.get_token(\"https:\u002F\u002Fmanagement.azure.com\u002F.default\")\n    print(f\"Token expires: {token.expires_on}\")\n\n    # For Azure Database for PostgreSQL\n    token = credential.get_token(\"https:\u002F\u002Fossrdbms-aad.database.windows.net\u002F.default\")\n",[2764],{"type":51,"tag":86,"props":2765,"children":2766},{"__ignoreMap":140},[2767,2774,2781,2789,2797,2805,2813,2820,2828],{"type":51,"tag":146,"props":2768,"children":2769},{"class":148,"line":149},[2770],{"type":51,"tag":146,"props":2771,"children":2772},{},[2773],{"type":57,"value":699},{"type":51,"tag":146,"props":2775,"children":2776},{"class":148,"line":236},[2777],{"type":51,"tag":146,"props":2778,"children":2779},{"emptyLinePlaceholder":310},[2780],{"type":57,"value":313},{"type":51,"tag":146,"props":2782,"children":2783},{"class":148,"line":262},[2784],{"type":51,"tag":146,"props":2785,"children":2786},{},[2787],{"type":57,"value":2788},"with DefaultAzureCredential() as credential:\n",{"type":51,"tag":146,"props":2790,"children":2791},{"class":148,"line":284},[2792],{"type":51,"tag":146,"props":2793,"children":2794},{},[2795],{"type":57,"value":2796},"    # Get token for a specific scope\n",{"type":51,"tag":146,"props":2798,"children":2799},{"class":148,"line":306},[2800],{"type":51,"tag":146,"props":2801,"children":2802},{},[2803],{"type":57,"value":2804},"    token = credential.get_token(\"https:\u002F\u002Fmanagement.azure.com\u002F.default\")\n",{"type":51,"tag":146,"props":2806,"children":2807},{"class":148,"line":316},[2808],{"type":51,"tag":146,"props":2809,"children":2810},{},[2811],{"type":57,"value":2812},"    print(f\"Token expires: {token.expires_on}\")\n",{"type":51,"tag":146,"props":2814,"children":2815},{"class":148,"line":325},[2816],{"type":51,"tag":146,"props":2817,"children":2818},{"emptyLinePlaceholder":310},[2819],{"type":57,"value":313},{"type":51,"tag":146,"props":2821,"children":2822},{"class":148,"line":345},[2823],{"type":51,"tag":146,"props":2824,"children":2825},{},[2826],{"type":57,"value":2827},"    # For Azure Database for PostgreSQL\n",{"type":51,"tag":146,"props":2829,"children":2830},{"class":148,"line":365},[2831],{"type":51,"tag":146,"props":2832,"children":2833},{},[2834],{"type":57,"value":2835},"    token = credential.get_token(\"https:\u002F\u002Fossrdbms-aad.database.windows.net\u002F.default\")\n",{"type":51,"tag":128,"props":2837,"children":2839},{"id":2838},"async-credentials",[2840],{"type":57,"value":2841},"Async Credentials",{"type":51,"tag":60,"props":2843,"children":2844},{},[2845,2847,2852,2854,2860],{"type":57,"value":2846},"Async credentials are in ",{"type":51,"tag":86,"props":2848,"children":2850},{"className":2849},[],[2851],{"type":57,"value":665},{"type":57,"value":2853},". Always close them or use ",{"type":51,"tag":86,"props":2855,"children":2857},{"className":2856},[],[2858],{"type":57,"value":2859},"async with",{"type":57,"value":2861},":",{"type":51,"tag":135,"props":2863,"children":2865},{"className":686,"code":2864,"language":18,"meta":140,"style":140},"from azure.identity.aio import DefaultAzureCredential\nfrom azure.storage.blob.aio import BlobServiceClient\n\nasync def main():\n    # Preferred: use async context manager for both credential and client\n    async with DefaultAzureCredential() as credential:\n        async with BlobServiceClient(\n            account_url=\"https:\u002F\u002F\u003Caccount>.blob.core.windows.net\",\n            credential=credential,\n        ) as client:\n            # ... async operations\n            pass\n",[2866],{"type":51,"tag":86,"props":2867,"children":2868},{"__ignoreMap":140},[2869,2877,2885,2892,2900,2908,2916,2924,2932,2940,2948,2956],{"type":51,"tag":146,"props":2870,"children":2871},{"class":148,"line":149},[2872],{"type":51,"tag":146,"props":2873,"children":2874},{},[2875],{"type":57,"value":2876},"from azure.identity.aio import DefaultAzureCredential\n",{"type":51,"tag":146,"props":2878,"children":2879},{"class":148,"line":236},[2880],{"type":51,"tag":146,"props":2881,"children":2882},{},[2883],{"type":57,"value":2884},"from azure.storage.blob.aio import BlobServiceClient\n",{"type":51,"tag":146,"props":2886,"children":2887},{"class":148,"line":262},[2888],{"type":51,"tag":146,"props":2889,"children":2890},{"emptyLinePlaceholder":310},[2891],{"type":57,"value":313},{"type":51,"tag":146,"props":2893,"children":2894},{"class":148,"line":284},[2895],{"type":51,"tag":146,"props":2896,"children":2897},{},[2898],{"type":57,"value":2899},"async def main():\n",{"type":51,"tag":146,"props":2901,"children":2902},{"class":148,"line":306},[2903],{"type":51,"tag":146,"props":2904,"children":2905},{},[2906],{"type":57,"value":2907},"    # Preferred: use async context manager for both credential and client\n",{"type":51,"tag":146,"props":2909,"children":2910},{"class":148,"line":316},[2911],{"type":51,"tag":146,"props":2912,"children":2913},{},[2914],{"type":57,"value":2915},"    async with DefaultAzureCredential() as credential:\n",{"type":51,"tag":146,"props":2917,"children":2918},{"class":148,"line":325},[2919],{"type":51,"tag":146,"props":2920,"children":2921},{},[2922],{"type":57,"value":2923},"        async with BlobServiceClient(\n",{"type":51,"tag":146,"props":2925,"children":2926},{"class":148,"line":345},[2927],{"type":51,"tag":146,"props":2928,"children":2929},{},[2930],{"type":57,"value":2931},"            account_url=\"https:\u002F\u002F\u003Caccount>.blob.core.windows.net\",\n",{"type":51,"tag":146,"props":2933,"children":2934},{"class":148,"line":365},[2935],{"type":51,"tag":146,"props":2936,"children":2937},{},[2938],{"type":57,"value":2939},"            credential=credential,\n",{"type":51,"tag":146,"props":2941,"children":2942},{"class":148,"line":384},[2943],{"type":51,"tag":146,"props":2944,"children":2945},{},[2946],{"type":57,"value":2947},"        ) as client:\n",{"type":51,"tag":146,"props":2949,"children":2950},{"class":148,"line":406},[2951],{"type":51,"tag":146,"props":2952,"children":2953},{},[2954],{"type":57,"value":2955},"            # ... async operations\n",{"type":51,"tag":146,"props":2957,"children":2958},{"class":148,"line":414},[2959],{"type":51,"tag":146,"props":2960,"children":2961},{},[2962],{"type":57,"value":2963},"            pass\n",{"type":51,"tag":554,"props":2965,"children":2966},{},[2967],{"type":51,"tag":60,"props":2968,"children":2969},{},[2970,2972,2977,2979,2985],{"type":57,"value":2971},"The async ",{"type":51,"tag":86,"props":2973,"children":2975},{"className":2974},[],[2976],{"type":57,"value":1200},{"type":57,"value":2978}," is at ",{"type":51,"tag":86,"props":2980,"children":2982},{"className":2981},[],[2983],{"type":57,"value":2984},"azure.identity.aio.get_bearer_token_provider",{"type":57,"value":584},{"type":51,"tag":128,"props":2987,"children":2989},{"id":2988},"sovereign-clouds",[2990],{"type":57,"value":2991},"Sovereign Clouds",{"type":51,"tag":60,"props":2993,"children":2994},{},[2995,2997,3003,3005,3010],{"type":57,"value":2996},"Use ",{"type":51,"tag":86,"props":2998,"children":3000},{"className":2999},[],[3001],{"type":57,"value":3002},"AzureAuthorityHosts",{"type":57,"value":3004}," or the ",{"type":51,"tag":86,"props":3006,"children":3008},{"className":3007},[],[3009],{"type":57,"value":429},{"type":57,"value":3011}," env var:",{"type":51,"tag":135,"props":3013,"children":3015},{"className":686,"code":3014,"language":18,"meta":140,"style":140},"from azure.identity import DefaultAzureCredential, AzureAuthorityHosts\n\n# Azure Government\ncredential = DefaultAzureCredential(authority=AzureAuthorityHosts.AZURE_GOVERNMENT)\n\n# Azure China\ncredential = DefaultAzureCredential(authority=AzureAuthorityHosts.AZURE_CHINA)\n",[3016],{"type":51,"tag":86,"props":3017,"children":3018},{"__ignoreMap":140},[3019,3027,3034,3042,3050,3057,3065],{"type":51,"tag":146,"props":3020,"children":3021},{"class":148,"line":149},[3022],{"type":51,"tag":146,"props":3023,"children":3024},{},[3025],{"type":57,"value":3026},"from azure.identity import DefaultAzureCredential, AzureAuthorityHosts\n",{"type":51,"tag":146,"props":3028,"children":3029},{"class":148,"line":236},[3030],{"type":51,"tag":146,"props":3031,"children":3032},{"emptyLinePlaceholder":310},[3033],{"type":57,"value":313},{"type":51,"tag":146,"props":3035,"children":3036},{"class":148,"line":262},[3037],{"type":51,"tag":146,"props":3038,"children":3039},{},[3040],{"type":57,"value":3041},"# Azure Government\n",{"type":51,"tag":146,"props":3043,"children":3044},{"class":148,"line":284},[3045],{"type":51,"tag":146,"props":3046,"children":3047},{},[3048],{"type":57,"value":3049},"credential = DefaultAzureCredential(authority=AzureAuthorityHosts.AZURE_GOVERNMENT)\n",{"type":51,"tag":146,"props":3051,"children":3052},{"class":148,"line":306},[3053],{"type":51,"tag":146,"props":3054,"children":3055},{"emptyLinePlaceholder":310},[3056],{"type":57,"value":313},{"type":51,"tag":146,"props":3058,"children":3059},{"class":148,"line":316},[3060],{"type":51,"tag":146,"props":3061,"children":3062},{},[3063],{"type":57,"value":3064},"# Azure China\n",{"type":51,"tag":146,"props":3066,"children":3067},{"class":148,"line":325},[3068],{"type":51,"tag":146,"props":3069,"children":3070},{},[3071],{"type":57,"value":3072},"credential = DefaultAzureCredential(authority=AzureAuthorityHosts.AZURE_CHINA)\n",{"type":51,"tag":951,"props":3074,"children":3075},{},[3076,3092],{"type":51,"tag":955,"props":3077,"children":3078},{},[3079],{"type":51,"tag":959,"props":3080,"children":3081},{},[3082,3087],{"type":51,"tag":963,"props":3083,"children":3084},{},[3085],{"type":57,"value":3086},"Constant",{"type":51,"tag":963,"props":3088,"children":3089},{},[3090],{"type":57,"value":3091},"Authority",{"type":51,"tag":979,"props":3093,"children":3094},{},[3095,3117,3138],{"type":51,"tag":959,"props":3096,"children":3097},{},[3098,3107],{"type":51,"tag":986,"props":3099,"children":3100},{},[3101],{"type":51,"tag":86,"props":3102,"children":3104},{"className":3103},[],[3105],{"type":57,"value":3106},"AzureAuthorityHosts.AZURE_PUBLIC_CLOUD",{"type":51,"tag":986,"props":3108,"children":3109},{},[3110,3115],{"type":51,"tag":86,"props":3111,"children":3113},{"className":3112},[],[3114],{"type":57,"value":438},{"type":57,"value":3116}," (default)",{"type":51,"tag":959,"props":3118,"children":3119},{},[3120,3129],{"type":51,"tag":986,"props":3121,"children":3122},{},[3123],{"type":51,"tag":86,"props":3124,"children":3126},{"className":3125},[],[3127],{"type":57,"value":3128},"AzureAuthorityHosts.AZURE_GOVERNMENT",{"type":51,"tag":986,"props":3130,"children":3131},{},[3132],{"type":51,"tag":86,"props":3133,"children":3135},{"className":3134},[],[3136],{"type":57,"value":3137},"login.microsoftonline.us",{"type":51,"tag":959,"props":3139,"children":3140},{},[3141,3150],{"type":51,"tag":986,"props":3142,"children":3143},{},[3144],{"type":51,"tag":86,"props":3145,"children":3147},{"className":3146},[],[3148],{"type":57,"value":3149},"AzureAuthorityHosts.AZURE_CHINA",{"type":51,"tag":986,"props":3151,"children":3152},{},[3153],{"type":51,"tag":86,"props":3154,"children":3156},{"className":3155},[],[3157],{"type":57,"value":3158},"login.chinacloudapi.cn",{"type":51,"tag":128,"props":3160,"children":3162},{"id":3161},"persistent-token-caching",[3163],{"type":57,"value":3164},"Persistent Token Caching",{"type":51,"tag":60,"props":3166,"children":3167},{},[3168,3170,3176],{"type":57,"value":3169},"Opt-in disk-based caching with ",{"type":51,"tag":86,"props":3171,"children":3173},{"className":3172},[],[3174],{"type":57,"value":3175},"TokenCachePersistenceOptions",{"type":57,"value":2861},{"type":51,"tag":135,"props":3178,"children":3180},{"className":686,"code":3179,"language":18,"meta":140,"style":140},"from azure.identity import DefaultAzureCredential, TokenCachePersistenceOptions\n\ncredential = DefaultAzureCredential(\n    cache_persistence_options=TokenCachePersistenceOptions()\n)\n\n# Allow unencrypted fallback (NOT recommended for production)\ncredential = DefaultAzureCredential(\n    cache_persistence_options=TokenCachePersistenceOptions(allow_unencrypted_storage=True)\n)\n",[3181],{"type":51,"tag":86,"props":3182,"children":3183},{"__ignoreMap":140},[3184,3192,3199,3206,3214,3221,3228,3236,3243,3251],{"type":51,"tag":146,"props":3185,"children":3186},{"class":148,"line":149},[3187],{"type":51,"tag":146,"props":3188,"children":3189},{},[3190],{"type":57,"value":3191},"from azure.identity import DefaultAzureCredential, TokenCachePersistenceOptions\n",{"type":51,"tag":146,"props":3193,"children":3194},{"class":148,"line":236},[3195],{"type":51,"tag":146,"props":3196,"children":3197},{"emptyLinePlaceholder":310},[3198],{"type":57,"value":313},{"type":51,"tag":146,"props":3200,"children":3201},{"class":148,"line":262},[3202],{"type":51,"tag":146,"props":3203,"children":3204},{},[3205],{"type":57,"value":828},{"type":51,"tag":146,"props":3207,"children":3208},{"class":148,"line":284},[3209],{"type":51,"tag":146,"props":3210,"children":3211},{},[3212],{"type":57,"value":3213},"    cache_persistence_options=TokenCachePersistenceOptions()\n",{"type":51,"tag":146,"props":3215,"children":3216},{"class":148,"line":306},[3217],{"type":51,"tag":146,"props":3218,"children":3219},{},[3220],{"type":57,"value":860},{"type":51,"tag":146,"props":3222,"children":3223},{"class":148,"line":316},[3224],{"type":51,"tag":146,"props":3225,"children":3226},{"emptyLinePlaceholder":310},[3227],{"type":57,"value":313},{"type":51,"tag":146,"props":3229,"children":3230},{"class":148,"line":325},[3231],{"type":51,"tag":146,"props":3232,"children":3233},{},[3234],{"type":57,"value":3235},"# Allow unencrypted fallback (NOT recommended for production)\n",{"type":51,"tag":146,"props":3237,"children":3238},{"class":148,"line":345},[3239],{"type":51,"tag":146,"props":3240,"children":3241},{},[3242],{"type":57,"value":828},{"type":51,"tag":146,"props":3244,"children":3245},{"class":148,"line":365},[3246],{"type":51,"tag":146,"props":3247,"children":3248},{},[3249],{"type":57,"value":3250},"    cache_persistence_options=TokenCachePersistenceOptions(allow_unencrypted_storage=True)\n",{"type":51,"tag":146,"props":3252,"children":3253},{"class":148,"line":384},[3254],{"type":51,"tag":146,"props":3255,"children":3256},{},[3257],{"type":57,"value":860},{"type":51,"tag":60,"props":3259,"children":3260},{},[3261],{"type":57,"value":3262},"Storage: Windows (DPAPI), macOS (Keychain), Linux (Keyring).",{"type":51,"tag":128,"props":3264,"children":3266},{"id":3265},"multi-tenant-support",[3267],{"type":57,"value":3268},"Multi-Tenant Support",{"type":51,"tag":60,"props":3270,"children":3271},{},[3272],{"type":57,"value":3273},"Allow token acquisition for additional tenants beyond the configured one:",{"type":51,"tag":135,"props":3275,"children":3277},{"className":686,"code":3276,"language":18,"meta":140,"style":140},"from azure.identity import ClientSecretCredential\n\ncredential = ClientSecretCredential(\n    tenant_id=\"\u003Chome-tenant>\",\n    client_id=\"\u003Cclient-id>\",\n    client_secret=\"\u003Csecret>\",\n    additionally_allowed_tenants=[\"\u003Cother-tenant>\", \"*\"],  # \"*\" allows any tenant\n)\n",[3278],{"type":51,"tag":86,"props":3279,"children":3280},{"__ignoreMap":140},[3281,3288,3295,3302,3310,3317,3325,3333],{"type":51,"tag":146,"props":3282,"children":3283},{"class":148,"line":149},[3284],{"type":51,"tag":146,"props":3285,"children":3286},{},[3287],{"type":57,"value":1925},{"type":51,"tag":146,"props":3289,"children":3290},{"class":148,"line":236},[3291],{"type":51,"tag":146,"props":3292,"children":3293},{"emptyLinePlaceholder":310},[3294],{"type":57,"value":313},{"type":51,"tag":146,"props":3296,"children":3297},{"class":148,"line":262},[3298],{"type":51,"tag":146,"props":3299,"children":3300},{},[3301],{"type":57,"value":1940},{"type":51,"tag":146,"props":3303,"children":3304},{"class":148,"line":284},[3305],{"type":51,"tag":146,"props":3306,"children":3307},{},[3308],{"type":57,"value":3309},"    tenant_id=\"\u003Chome-tenant>\",\n",{"type":51,"tag":146,"props":3311,"children":3312},{"class":148,"line":306},[3313],{"type":51,"tag":146,"props":3314,"children":3315},{},[3316],{"type":57,"value":2057},{"type":51,"tag":146,"props":3318,"children":3319},{"class":148,"line":316},[3320],{"type":51,"tag":146,"props":3321,"children":3322},{},[3323],{"type":57,"value":3324},"    client_secret=\"\u003Csecret>\",\n",{"type":51,"tag":146,"props":3326,"children":3327},{"class":148,"line":325},[3328],{"type":51,"tag":146,"props":3329,"children":3330},{},[3331],{"type":57,"value":3332},"    additionally_allowed_tenants=[\"\u003Cother-tenant>\", \"*\"],  # \"*\" allows any tenant\n",{"type":51,"tag":146,"props":3334,"children":3335},{"class":148,"line":345},[3336],{"type":51,"tag":146,"props":3337,"children":3338},{},[3339],{"type":57,"value":860},{"type":51,"tag":128,"props":3341,"children":3343},{"id":3342},"error-handling",[3344],{"type":57,"value":3345},"Error Handling",{"type":51,"tag":135,"props":3347,"children":3349},{"className":686,"code":3348,"language":18,"meta":140,"style":140},"from azure.identity import DefaultAzureCredential, CredentialUnavailableError\nfrom azure.core.exceptions import ClientAuthenticationError\n\nwith DefaultAzureCredential() as credential:\n    try:\n        token = credential.get_token(\"https:\u002F\u002Fmanagement.azure.com\u002F.default\")\n    except CredentialUnavailableError:\n        # No credential in the chain could attempt authentication\n        pass\n    except ClientAuthenticationError as e:\n        # Authentication was attempted but failed\n        # e.message contains details from each credential in the chain\n        pass\n",[3350],{"type":51,"tag":86,"props":3351,"children":3352},{"__ignoreMap":140},[3353,3361,3369,3376,3383,3391,3399,3407,3415,3423,3431,3439,3447],{"type":51,"tag":146,"props":3354,"children":3355},{"class":148,"line":149},[3356],{"type":51,"tag":146,"props":3357,"children":3358},{},[3359],{"type":57,"value":3360},"from azure.identity import DefaultAzureCredential, CredentialUnavailableError\n",{"type":51,"tag":146,"props":3362,"children":3363},{"class":148,"line":236},[3364],{"type":51,"tag":146,"props":3365,"children":3366},{},[3367],{"type":57,"value":3368},"from azure.core.exceptions import ClientAuthenticationError\n",{"type":51,"tag":146,"props":3370,"children":3371},{"class":148,"line":262},[3372],{"type":51,"tag":146,"props":3373,"children":3374},{"emptyLinePlaceholder":310},[3375],{"type":57,"value":313},{"type":51,"tag":146,"props":3377,"children":3378},{"class":148,"line":284},[3379],{"type":51,"tag":146,"props":3380,"children":3381},{},[3382],{"type":57,"value":2788},{"type":51,"tag":146,"props":3384,"children":3385},{"class":148,"line":306},[3386],{"type":51,"tag":146,"props":3387,"children":3388},{},[3389],{"type":57,"value":3390},"    try:\n",{"type":51,"tag":146,"props":3392,"children":3393},{"class":148,"line":316},[3394],{"type":51,"tag":146,"props":3395,"children":3396},{},[3397],{"type":57,"value":3398},"        token = credential.get_token(\"https:\u002F\u002Fmanagement.azure.com\u002F.default\")\n",{"type":51,"tag":146,"props":3400,"children":3401},{"class":148,"line":325},[3402],{"type":51,"tag":146,"props":3403,"children":3404},{},[3405],{"type":57,"value":3406},"    except CredentialUnavailableError:\n",{"type":51,"tag":146,"props":3408,"children":3409},{"class":148,"line":345},[3410],{"type":51,"tag":146,"props":3411,"children":3412},{},[3413],{"type":57,"value":3414},"        # No credential in the chain could attempt authentication\n",{"type":51,"tag":146,"props":3416,"children":3417},{"class":148,"line":365},[3418],{"type":51,"tag":146,"props":3419,"children":3420},{},[3421],{"type":57,"value":3422},"        pass\n",{"type":51,"tag":146,"props":3424,"children":3425},{"class":148,"line":384},[3426],{"type":51,"tag":146,"props":3427,"children":3428},{},[3429],{"type":57,"value":3430},"    except ClientAuthenticationError as e:\n",{"type":51,"tag":146,"props":3432,"children":3433},{"class":148,"line":406},[3434],{"type":51,"tag":146,"props":3435,"children":3436},{},[3437],{"type":57,"value":3438},"        # Authentication was attempted but failed\n",{"type":51,"tag":146,"props":3440,"children":3441},{"class":148,"line":414},[3442],{"type":51,"tag":146,"props":3443,"children":3444},{},[3445],{"type":57,"value":3446},"        # e.message contains details from each credential in the chain\n",{"type":51,"tag":146,"props":3448,"children":3449},{"class":148,"line":423},[3450],{"type":51,"tag":146,"props":3451,"children":3452},{},[3453],{"type":57,"value":3422},{"type":51,"tag":128,"props":3455,"children":3457},{"id":3456},"logging",[3458],{"type":57,"value":3459},"Logging",{"type":51,"tag":60,"props":3461,"children":3462},{},[3463],{"type":57,"value":3464},"Enable authentication logging for debugging:",{"type":51,"tag":135,"props":3466,"children":3468},{"className":686,"code":3467,"language":18,"meta":140,"style":140},"import logging\n\n# Enable verbose Azure Identity logging\nlogging.basicConfig(level=logging.DEBUG)\nlogger = logging.getLogger(\"azure.identity\")\nlogger.setLevel(logging.DEBUG)\n",[3469],{"type":51,"tag":86,"props":3470,"children":3471},{"__ignoreMap":140},[3472,3480,3487,3495,3503,3511],{"type":51,"tag":146,"props":3473,"children":3474},{"class":148,"line":149},[3475],{"type":51,"tag":146,"props":3476,"children":3477},{},[3478],{"type":57,"value":3479},"import logging\n",{"type":51,"tag":146,"props":3481,"children":3482},{"class":148,"line":236},[3483],{"type":51,"tag":146,"props":3484,"children":3485},{"emptyLinePlaceholder":310},[3486],{"type":57,"value":313},{"type":51,"tag":146,"props":3488,"children":3489},{"class":148,"line":262},[3490],{"type":51,"tag":146,"props":3491,"children":3492},{},[3493],{"type":57,"value":3494},"# Enable verbose Azure Identity logging\n",{"type":51,"tag":146,"props":3496,"children":3497},{"class":148,"line":284},[3498],{"type":51,"tag":146,"props":3499,"children":3500},{},[3501],{"type":57,"value":3502},"logging.basicConfig(level=logging.DEBUG)\n",{"type":51,"tag":146,"props":3504,"children":3505},{"class":148,"line":306},[3506],{"type":51,"tag":146,"props":3507,"children":3508},{},[3509],{"type":57,"value":3510},"logger = logging.getLogger(\"azure.identity\")\n",{"type":51,"tag":146,"props":3512,"children":3513},{"class":148,"line":316},[3514],{"type":51,"tag":146,"props":3515,"children":3516},{},[3517],{"type":57,"value":3518},"logger.setLevel(logging.DEBUG)\n",{"type":51,"tag":135,"props":3520,"children":3522},{"className":137,"code":3521,"language":139,"meta":140,"style":140},"# Or via environment variable\nAZURE_LOG_LEVEL=debug\n",[3523],{"type":51,"tag":86,"props":3524,"children":3525},{"__ignoreMap":140},[3526,3534],{"type":51,"tag":146,"props":3527,"children":3528},{"class":148,"line":149},[3529],{"type":51,"tag":146,"props":3530,"children":3531},{"style":230},[3532],{"type":57,"value":3533},"# Or via environment variable\n",{"type":51,"tag":146,"props":3535,"children":3536},{"class":148,"line":236},[3537,3542,3546],{"type":51,"tag":146,"props":3538,"children":3539},{"style":240},[3540],{"type":57,"value":3541},"AZURE_LOG_LEVEL",{"type":51,"tag":146,"props":3543,"children":3544},{"style":246},[3545],{"type":57,"value":376},{"type":51,"tag":146,"props":3547,"children":3548},{"style":159},[3549],{"type":57,"value":3550},"debug\n",{"type":51,"tag":128,"props":3552,"children":3554},{"id":3553},"credential-selection-matrix",[3555],{"type":57,"value":3556},"Credential Selection Matrix",{"type":51,"tag":951,"props":3558,"children":3559},{},[3560,3576],{"type":51,"tag":955,"props":3561,"children":3562},{},[3563],{"type":51,"tag":959,"props":3564,"children":3565},{},[3566,3571],{"type":51,"tag":963,"props":3567,"children":3568},{},[3569],{"type":57,"value":3570},"Environment",{"type":51,"tag":963,"props":3572,"children":3573},{},[3574],{"type":57,"value":3575},"Recommended Credential",{"type":51,"tag":979,"props":3577,"children":3578},{},[3579,3597,3615,3632,3648,3665,3688,3704,3720],{"type":51,"tag":959,"props":3580,"children":3581},{},[3582,3587],{"type":51,"tag":986,"props":3583,"children":3584},{},[3585],{"type":57,"value":3586},"Local Development",{"type":51,"tag":986,"props":3588,"children":3589},{},[3590,3595],{"type":51,"tag":86,"props":3591,"children":3593},{"className":3592},[],[3594],{"type":57,"value":91},{"type":57,"value":3596}," (uses Azure CLI)",{"type":51,"tag":959,"props":3598,"children":3599},{},[3600,3605],{"type":51,"tag":986,"props":3601,"children":3602},{},[3603],{"type":57,"value":3604},"Azure App Service",{"type":51,"tag":986,"props":3606,"children":3607},{},[3608,3613],{"type":51,"tag":86,"props":3609,"children":3611},{"className":3610},[],[3612],{"type":57,"value":91},{"type":57,"value":3614}," (uses Managed Identity)",{"type":51,"tag":959,"props":3616,"children":3617},{},[3618,3623],{"type":51,"tag":986,"props":3619,"children":3620},{},[3621],{"type":57,"value":3622},"Azure Functions",{"type":51,"tag":986,"props":3624,"children":3625},{},[3626,3631],{"type":51,"tag":86,"props":3627,"children":3629},{"className":3628},[],[3630],{"type":57,"value":91},{"type":57,"value":3614},{"type":51,"tag":959,"props":3633,"children":3634},{},[3635,3640],{"type":51,"tag":986,"props":3636,"children":3637},{},[3638],{"type":57,"value":3639},"Azure Kubernetes Service",{"type":51,"tag":986,"props":3641,"children":3642},{},[3643],{"type":51,"tag":86,"props":3644,"children":3646},{"className":3645},[],[3647],{"type":57,"value":1482},{"type":51,"tag":959,"props":3649,"children":3650},{},[3651,3656],{"type":51,"tag":986,"props":3652,"children":3653},{},[3654],{"type":57,"value":3655},"Azure VMs",{"type":51,"tag":986,"props":3657,"children":3658},{},[3659,3664],{"type":51,"tag":86,"props":3660,"children":3662},{"className":3661},[],[3663],{"type":57,"value":91},{"type":57,"value":3614},{"type":51,"tag":959,"props":3666,"children":3667},{},[3668,3673],{"type":51,"tag":986,"props":3669,"children":3670},{},[3671],{"type":57,"value":3672},"CI\u002FCD Pipeline",{"type":51,"tag":986,"props":3674,"children":3675},{},[3676,3681,3683],{"type":51,"tag":86,"props":3677,"children":3679},{"className":3678},[],[3680],{"type":57,"value":1449},{"type":57,"value":3682}," or ",{"type":51,"tag":86,"props":3684,"children":3686},{"className":3685},[],[3687],{"type":57,"value":1576},{"type":51,"tag":959,"props":3689,"children":3690},{},[3691,3696],{"type":51,"tag":986,"props":3692,"children":3693},{},[3694],{"type":57,"value":3695},"Desktop App",{"type":51,"tag":986,"props":3697,"children":3698},{},[3699],{"type":51,"tag":86,"props":3700,"children":3702},{"className":3701},[],[3703],{"type":57,"value":1636},{"type":51,"tag":959,"props":3705,"children":3706},{},[3707,3712],{"type":51,"tag":986,"props":3708,"children":3709},{},[3710],{"type":57,"value":3711},"CLI \u002F Headless Tool",{"type":51,"tag":986,"props":3713,"children":3714},{},[3715],{"type":51,"tag":86,"props":3716,"children":3718},{"className":3717},[],[3719],{"type":57,"value":1653},{"type":51,"tag":959,"props":3721,"children":3722},{},[3723,3728],{"type":51,"tag":986,"props":3724,"children":3725},{},[3726],{"type":57,"value":3727},"Middle-tier Service",{"type":51,"tag":986,"props":3729,"children":3730},{},[3731],{"type":51,"tag":86,"props":3732,"children":3734},{"className":3733},[],[3735],{"type":57,"value":1593},{"type":51,"tag":128,"props":3737,"children":3739},{"id":3738},"best-practices",[3740],{"type":57,"value":3741},"Best Practices",{"type":51,"tag":567,"props":3743,"children":3744},{},[3745,3771,3801,3815,3825,3835,3849,3863,3878,3895,3916,3932],{"type":51,"tag":75,"props":3746,"children":3747},{},[3748,3753,3755,3761,3763,3769],{"type":51,"tag":561,"props":3749,"children":3750},{},[3751],{"type":57,"value":3752},"Pick sync OR async and stay consistent.",{"type":57,"value":3754}," Do not mix ",{"type":51,"tag":86,"props":3756,"children":3758},{"className":3757},[],[3759],{"type":57,"value":3760},"azure.xxx",{"type":57,"value":3762}," sync clients with ",{"type":51,"tag":86,"props":3764,"children":3766},{"className":3765},[],[3767],{"type":57,"value":3768},"azure.xxx.aio",{"type":57,"value":3770}," async clients in the same call path. Choose one mode per module.",{"type":51,"tag":75,"props":3772,"children":3773},{},[3774,3779,3781,3786,3788,3793,3795,3800],{"type":51,"tag":561,"props":3775,"children":3776},{},[3777],{"type":57,"value":3778},"Use credentials as context managers",{"type":57,"value":3780}," (",{"type":51,"tag":86,"props":3782,"children":3784},{"className":3783},[],[3785],{"type":57,"value":646},{"type":57,"value":3787},") when they own token caches \u002F HTTP transports you want cleaned up; for async, use ",{"type":51,"tag":86,"props":3789,"children":3791},{"className":3790},[],[3792],{"type":57,"value":2859},{"type":57,"value":3794}," on credentials from ",{"type":51,"tag":86,"props":3796,"children":3798},{"className":3797},[],[3799],{"type":57,"value":665},{"type":57,"value":584},{"type":51,"tag":75,"props":3802,"children":3803},{},[3804,3813],{"type":51,"tag":561,"props":3805,"children":3806},{},[3807,3808],{"type":57,"value":2996},{"type":51,"tag":86,"props":3809,"children":3811},{"className":3810},[],[3812],{"type":57,"value":91},{"type":57,"value":3814}," for code that runs locally. Use a specific token credential for code that runs in Azure.",{"type":51,"tag":75,"props":3816,"children":3817},{},[3818,3823],{"type":51,"tag":561,"props":3819,"children":3820},{},[3821],{"type":57,"value":3822},"Never hardcode credentials",{"type":57,"value":3824}," — use environment variables or managed identity",{"type":51,"tag":75,"props":3826,"children":3827},{},[3828,3833],{"type":51,"tag":561,"props":3829,"children":3830},{},[3831],{"type":57,"value":3832},"Prefer managed identity",{"type":57,"value":3834}," in production Azure deployments",{"type":51,"tag":75,"props":3836,"children":3837},{},[3838,3847],{"type":51,"tag":561,"props":3839,"children":3840},{},[3841,3842],{"type":57,"value":2996},{"type":51,"tag":86,"props":3843,"children":3845},{"className":3844},[],[3846],{"type":57,"value":1200},{"type":57,"value":3848}," for non-Azure-SDK clients (OpenAI, REST APIs)",{"type":51,"tag":75,"props":3850,"children":3851},{},[3852,3861],{"type":51,"tag":561,"props":3853,"children":3854},{},[3855,3856],{"type":57,"value":2996},{"type":51,"tag":86,"props":3857,"children":3859},{"className":3858},[],[3860],{"type":57,"value":1406},{"type":57,"value":3862}," when you need a custom credential order",{"type":51,"tag":75,"props":3864,"children":3865},{},[3866,3876],{"type":51,"tag":561,"props":3867,"children":3868},{},[3869,3871],{"type":57,"value":3870},"Set ",{"type":51,"tag":86,"props":3872,"children":3874},{"className":3873},[],[3875],{"type":57,"value":268},{"type":57,"value":3877}," for user-assigned managed identities (object ID and resource ID are also valid identifiers)",{"type":51,"tag":75,"props":3879,"children":3880},{},[3881,3886,3888,3893],{"type":51,"tag":561,"props":3882,"children":3883},{},[3884],{"type":57,"value":3885},"Exclude unused credentials",{"type":57,"value":3887}," to speed up ",{"type":51,"tag":86,"props":3889,"children":3891},{"className":3890},[],[3892],{"type":57,"value":91},{"type":57,"value":3894}," authentication",{"type":51,"tag":75,"props":3896,"children":3897},{},[3898,3907,3909,3914],{"type":51,"tag":561,"props":3899,"children":3900},{},[3901,3902],{"type":57,"value":2996},{"type":51,"tag":86,"props":3903,"children":3905},{"className":3904},[],[3906],{"type":57,"value":1542},{"type":57,"value":3908}," (not ",{"type":51,"tag":86,"props":3910,"children":3912},{"className":3911},[],[3913],{"type":57,"value":2002},{"type":57,"value":3915}," — that name doesn't exist)",{"type":51,"tag":75,"props":3917,"children":3918},{},[3919,3930],{"type":51,"tag":561,"props":3920,"children":3921},{},[3922,3924],{"type":57,"value":3923},"Enable ",{"type":51,"tag":86,"props":3925,"children":3927},{"className":3926},[],[3928],{"type":57,"value":3929},"cache_persistence_options",{"type":57,"value":3931}," for long-running services to reduce token requests",{"type":51,"tag":75,"props":3933,"children":3934},{},[3935,3940],{"type":51,"tag":561,"props":3936,"children":3937},{},[3938],{"type":57,"value":3939},"Reuse credential instances",{"type":57,"value":3941}," — same credential can be shared across multiple clients",{"type":51,"tag":128,"props":3943,"children":3945},{"id":3944},"reference-links",[3946],{"type":57,"value":3947},"Reference Links",{"type":51,"tag":951,"props":3949,"children":3950},{},[3951,3967],{"type":51,"tag":955,"props":3952,"children":3953},{},[3954],{"type":51,"tag":959,"props":3955,"children":3956},{},[3957,3962],{"type":51,"tag":963,"props":3958,"children":3959},{},[3960],{"type":57,"value":3961},"Resource",{"type":51,"tag":963,"props":3963,"children":3964},{},[3965],{"type":57,"value":3966},"URL",{"type":51,"tag":979,"props":3968,"children":3969},{},[3970,3987,4004,4021],{"type":51,"tag":959,"props":3971,"children":3972},{},[3973,3978],{"type":51,"tag":986,"props":3974,"children":3975},{},[3976],{"type":57,"value":3977},"PyPI Package",{"type":51,"tag":986,"props":3979,"children":3980},{},[3981],{"type":51,"tag":790,"props":3982,"children":3985},{"href":3983,"rel":3984},"https:\u002F\u002Fpypi.org\u002Fproject\u002Fazure-identity\u002F",[794],[3986],{"type":57,"value":3983},{"type":51,"tag":959,"props":3988,"children":3989},{},[3990,3995],{"type":51,"tag":986,"props":3991,"children":3992},{},[3993],{"type":57,"value":3994},"API Reference",{"type":51,"tag":986,"props":3996,"children":3997},{},[3998],{"type":51,"tag":790,"props":3999,"children":4002},{"href":4000,"rel":4001},"https:\u002F\u002Flearn.microsoft.com\u002Fpython\u002Fapi\u002Fazure-identity",[794],[4003],{"type":57,"value":4000},{"type":51,"tag":959,"props":4005,"children":4006},{},[4007,4012],{"type":51,"tag":986,"props":4008,"children":4009},{},[4010],{"type":57,"value":4011},"GitHub Source",{"type":51,"tag":986,"props":4013,"children":4014},{},[4015],{"type":51,"tag":790,"props":4016,"children":4019},{"href":4017,"rel":4018},"https:\u002F\u002Fgithub.com\u002FAzure\u002Fazure-sdk-for-python\u002Ftree\u002Fmain\u002Fsdk\u002Fidentity\u002Fazure-identity",[794],[4020],{"type":57,"value":4017},{"type":51,"tag":959,"props":4022,"children":4023},{},[4024,4028],{"type":51,"tag":986,"props":4025,"children":4026},{},[4027],{"type":57,"value":1356},{"type":51,"tag":986,"props":4029,"children":4030},{},[4031],{"type":51,"tag":790,"props":4032,"children":4035},{"href":4033,"rel":4034},"https:\u002F\u002Faka.ms\u002Fazsdk\u002Fpython\u002Fidentity\u002Fcredential-chains",[794],[4036],{"type":57,"value":4033},{"type":51,"tag":128,"props":4038,"children":4040},{"id":4039},"reference-files",[4041],{"type":57,"value":4042},"Reference Files",{"type":51,"tag":951,"props":4044,"children":4045},{},[4046,4062],{"type":51,"tag":955,"props":4047,"children":4048},{},[4049],{"type":51,"tag":959,"props":4050,"children":4051},{},[4052,4057],{"type":51,"tag":963,"props":4053,"children":4054},{},[4055],{"type":57,"value":4056},"File",{"type":51,"tag":963,"props":4058,"children":4059},{},[4060],{"type":57,"value":4061},"Contents",{"type":51,"tag":979,"props":4063,"children":4064},{},[4065,4081],{"type":51,"tag":959,"props":4066,"children":4067},{},[4068,4076],{"type":51,"tag":986,"props":4069,"children":4070},{},[4071],{"type":51,"tag":790,"props":4072,"children":4074},{"href":4073},"references\u002Fcapabilities.md",[4075],{"type":57,"value":4073},{"type":51,"tag":986,"props":4077,"children":4078},{},[4079],{"type":57,"value":4080},"Additional non-hero capabilities, operation-group coverage, and production checklists.",{"type":51,"tag":959,"props":4082,"children":4083},{},[4084,4092],{"type":51,"tag":986,"props":4085,"children":4086},{},[4087],{"type":51,"tag":790,"props":4088,"children":4090},{"href":4089},"references\u002Fnon-hero-scenarios.md",[4091],{"type":57,"value":4089},{"type":51,"tag":986,"props":4093,"children":4094},{},[4095],{"type":57,"value":4096},"Dedicated non-hero examples for secondary\u002Fadvanced scenarios.",{"type":51,"tag":4098,"props":4099,"children":4100},"style",{},[4101],{"type":57,"value":4102},"html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"items":4104,"total":4211},[4105,4121,4142,4157,4172,4183,4196],{"slug":4106,"name":4106,"fn":4107,"description":4108,"org":4109,"tags":4110,"stars":25,"repoUrl":26,"updatedAt":4120},"azure-ai-agents-persistent-dotnet","build AI agents with Azure .NET SDK","Azure AI Agents Persistent SDK for .NET. Low-level SDK for creating and managing AI agents with threads, messages, runs, and tools. Use for agent CRUD, conversation threads, streaming responses, function calling, file search, and code interpreter. Triggers: \"PersistentAgentsClient\", \"persistent agents\", \"agent threads\", \"agent runs\", \"streaming agents\", \"function calling agents .NET\".\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[4111,4114,4116,4117],{"name":4112,"slug":4113,"type":15},".NET","net",{"name":4115,"slug":32,"type":15},"Agents",{"name":13,"slug":14,"type":15},{"name":4118,"slug":4119,"type":15},"LLM","llm","2026-07-03T16:32:10.297433",{"slug":4122,"name":4122,"fn":4123,"description":4124,"org":4125,"tags":4126,"stars":25,"repoUrl":26,"updatedAt":4141},"azure-ai-anomalydetector-java","build anomaly detection applications with Java","Build anomaly detection applications with Azure AI Anomaly Detector SDK for Java. Use when implementing univariate\u002Fmultivariate anomaly detection, time-series analysis, or AI-powered monitoring.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[4127,4130,4131,4134,4137,4138],{"name":4128,"slug":4129,"type":15},"Analytics","analytics",{"name":13,"slug":14,"type":15},{"name":4132,"slug":4133,"type":15},"Data Analysis","data-analysis",{"name":4135,"slug":4136,"type":15},"Java","java",{"name":9,"slug":8,"type":15},{"name":4139,"slug":4140,"type":15},"Monitoring","monitoring","2026-05-13T06:14:16.261754",{"slug":4143,"name":4143,"fn":4144,"description":4145,"org":4146,"tags":4147,"stars":25,"repoUrl":26,"updatedAt":4156},"azure-ai-contentsafety-java","build content moderation applications with Azure AI","Build content moderation applications with Azure AI Content Safety SDK for Java. Use when implementing text\u002Fimage analysis, blocklist management, or harm detection for hate, violence, sexual content, and self-harm.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[4148,4151,4152,4153],{"name":4149,"slug":4150,"type":15},"AI Infrastructure","ai-infrastructure",{"name":13,"slug":14,"type":15},{"name":4135,"slug":4136,"type":15},{"name":4154,"slug":4155,"type":15},"Security","security","2026-07-07T06:53:31.293235",{"slug":4158,"name":4158,"fn":4159,"description":4160,"org":4161,"tags":4162,"stars":25,"repoUrl":26,"updatedAt":4171},"azure-ai-contentsafety-py","detect harmful content with Azure AI Content Safety","Azure AI Content Safety SDK for Python. Use for detecting harmful content in text and images with multi-severity classification.\nTriggers: \"azure-ai-contentsafety\", \"ContentSafetyClient\", \"content moderation\", \"harmful content\", \"text analysis\", \"image analysis\".\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[4163,4164,4167,4168,4169,4170],{"name":13,"slug":14,"type":15},{"name":4165,"slug":4166,"type":15},"Compliance","compliance",{"name":4118,"slug":4119,"type":15},{"name":9,"slug":8,"type":15},{"name":17,"slug":18,"type":15},{"name":4154,"slug":4155,"type":15},"2026-07-18T05:14:23.017504",{"slug":4173,"name":4173,"fn":4174,"description":4175,"org":4176,"tags":4177,"stars":25,"repoUrl":26,"updatedAt":4182},"azure-ai-language-conversations-py","implement conversational language understanding with Python","Implement Conversational Language Understanding (CLU) using the azure-ai-language-conversations Python SDK. Use when working with ConversationAnalysisClient to analyze conversation intent and entities, building NLP features, or integrating language understanding into applications.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[4178,4179,4180,4181],{"name":4128,"slug":4129,"type":15},{"name":13,"slug":14,"type":15},{"name":4118,"slug":4119,"type":15},{"name":17,"slug":18,"type":15},"2026-07-31T05:54:29.068751",{"slug":4184,"name":4184,"fn":4185,"description":4186,"org":4187,"tags":4188,"stars":25,"repoUrl":26,"updatedAt":4195},"azure-ai-translation-text-py","translate text using Azure AI services","Azure AI Text Translation SDK for real-time text translation, transliteration, language detection, and dictionary lookup. Use for translating text content in applications.\nTriggers: \"text translation\", \"translator\", \"translate text\", \"transliterate\", \"TextTranslationClient\".\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[4189,4192,4193,4194],{"name":4190,"slug":4191,"type":15},"API Development","api-development",{"name":13,"slug":14,"type":15},{"name":9,"slug":8,"type":15},{"name":17,"slug":18,"type":15},"2026-07-18T05:14:16.988376",{"slug":4197,"name":4197,"fn":4198,"description":4199,"org":4200,"tags":4201,"stars":25,"repoUrl":26,"updatedAt":4210},"azure-ai-vision-imageanalysis-py","analyze images with Azure AI Vision","Azure AI Vision Image Analysis SDK for captions, tags, objects, OCR, people detection, and smart cropping. Use for computer vision and image understanding tasks.\nTriggers: \"image analysis\", \"computer vision\", \"OCR\", \"object detection\", \"ImageAnalysisClient\", \"image caption\".\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[4202,4203,4206,4209],{"name":13,"slug":14,"type":15},{"name":4204,"slug":4205,"type":15},"Computer Vision","computer-vision",{"name":4207,"slug":4208,"type":15},"Images","images",{"name":17,"slug":18,"type":15},"2026-07-18T05:14:18.007737",38,{"items":4213,"total":4347},[4214,4235,4242,4251,4258,4267,4274,4281,4288,4303,4322,4335],{"slug":4215,"name":4215,"fn":4216,"description":4217,"org":4218,"tags":4219,"stars":4232,"repoUrl":4233,"updatedAt":4234},"rushstack-best-practices","manage Rush monorepos with best practices","Provides best practices and guidance for working with Rush monorepos. Use when the user is working in a Rush-based repository, asks about Rush commands (install, update, build, rebuild), needs help with project selection, dependency management, build caching, subspace configuration, or troubleshooting Rush-specific issues.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[4220,4223,4225,4226,4229],{"name":4221,"slug":4222,"type":15},"Engineering","engineering",{"name":3586,"slug":4224,"type":15},"local-development",{"name":9,"slug":8,"type":15},{"name":4227,"slug":4228,"type":15},"Project Management","project-management",{"name":4230,"slug":4231,"type":15},"Rush","rush",6484,"https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Frushstack","2026-04-06T18:34:44.965032",{"slug":4106,"name":4106,"fn":4107,"description":4108,"org":4236,"tags":4237,"stars":25,"repoUrl":26,"updatedAt":4120},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[4238,4239,4240,4241],{"name":4112,"slug":4113,"type":15},{"name":4115,"slug":32,"type":15},{"name":13,"slug":14,"type":15},{"name":4118,"slug":4119,"type":15},{"slug":4122,"name":4122,"fn":4123,"description":4124,"org":4243,"tags":4244,"stars":25,"repoUrl":26,"updatedAt":4141},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[4245,4246,4247,4248,4249,4250],{"name":4128,"slug":4129,"type":15},{"name":13,"slug":14,"type":15},{"name":4132,"slug":4133,"type":15},{"name":4135,"slug":4136,"type":15},{"name":9,"slug":8,"type":15},{"name":4139,"slug":4140,"type":15},{"slug":4143,"name":4143,"fn":4144,"description":4145,"org":4252,"tags":4253,"stars":25,"repoUrl":26,"updatedAt":4156},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[4254,4255,4256,4257],{"name":4149,"slug":4150,"type":15},{"name":13,"slug":14,"type":15},{"name":4135,"slug":4136,"type":15},{"name":4154,"slug":4155,"type":15},{"slug":4158,"name":4158,"fn":4159,"description":4160,"org":4259,"tags":4260,"stars":25,"repoUrl":26,"updatedAt":4171},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[4261,4262,4263,4264,4265,4266],{"name":13,"slug":14,"type":15},{"name":4165,"slug":4166,"type":15},{"name":4118,"slug":4119,"type":15},{"name":9,"slug":8,"type":15},{"name":17,"slug":18,"type":15},{"name":4154,"slug":4155,"type":15},{"slug":4173,"name":4173,"fn":4174,"description":4175,"org":4268,"tags":4269,"stars":25,"repoUrl":26,"updatedAt":4182},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[4270,4271,4272,4273],{"name":4128,"slug":4129,"type":15},{"name":13,"slug":14,"type":15},{"name":4118,"slug":4119,"type":15},{"name":17,"slug":18,"type":15},{"slug":4184,"name":4184,"fn":4185,"description":4186,"org":4275,"tags":4276,"stars":25,"repoUrl":26,"updatedAt":4195},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[4277,4278,4279,4280],{"name":4190,"slug":4191,"type":15},{"name":13,"slug":14,"type":15},{"name":9,"slug":8,"type":15},{"name":17,"slug":18,"type":15},{"slug":4197,"name":4197,"fn":4198,"description":4199,"org":4282,"tags":4283,"stars":25,"repoUrl":26,"updatedAt":4210},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[4284,4285,4286,4287],{"name":13,"slug":14,"type":15},{"name":4204,"slug":4205,"type":15},{"name":4207,"slug":4208,"type":15},{"name":17,"slug":18,"type":15},{"slug":4289,"name":4289,"fn":4290,"description":4291,"org":4292,"tags":4293,"stars":25,"repoUrl":26,"updatedAt":4302},"azure-appconfiguration-java","manage configuration with Azure App Configuration","Azure App Configuration SDK for Java. Centralized application configuration management with key-value settings, feature flags, and snapshots.\nTriggers: \"ConfigurationClient java\", \"app configuration java\", \"feature flag java\", \"configuration setting java\", \"azure config java\".\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[4294,4295,4298,4301],{"name":13,"slug":14,"type":15},{"name":4296,"slug":4297,"type":15},"Configuration","configuration",{"name":4299,"slug":4300,"type":15},"Feature Flags","feature-flags",{"name":4135,"slug":4136,"type":15},"2026-07-03T16:32:01.278468",{"slug":4304,"name":4304,"fn":4305,"description":4306,"org":4307,"tags":4308,"stars":25,"repoUrl":26,"updatedAt":4321},"azure-cosmos-rust","build applications with Azure Cosmos DB","Azure Cosmos DB library for Rust (NoSQL API). Document CRUD, containers, and globally distributed data.\nTriggers: \"cosmos db rust\", \"CosmosClient rust\", \"document crud rust\", \"NoSQL rust\", \"partition key rust\".\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[4309,4312,4315,4318],{"name":4310,"slug":4311,"type":15},"Cosmos DB","cosmos-db",{"name":4313,"slug":4314,"type":15},"Database","database",{"name":4316,"slug":4317,"type":15},"NoSQL","nosql",{"name":4319,"slug":4320,"type":15},"Rust","rust","2026-07-31T05:54:27.021432",{"slug":4323,"name":4323,"fn":4305,"description":4324,"org":4325,"tags":4326,"stars":25,"repoUrl":26,"updatedAt":4334},"azure-cosmos-ts","Azure Cosmos DB JavaScript\u002FTypeScript SDK (@azure\u002Fcosmos) for data plane operations. Use for CRUD operations on documents, queries, bulk operations, and container management. Triggers: \"Cosmos DB\", \"@azure\u002Fcosmos\", \"CosmosClient\", \"document CRUD\", \"NoSQL queries\", \"bulk operations\", \"partition key\", \"container.items\".\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[4327,4328,4329,4330,4331],{"name":4310,"slug":4311,"type":15},{"name":4313,"slug":4314,"type":15},{"name":9,"slug":8,"type":15},{"name":4316,"slug":4317,"type":15},{"name":4332,"slug":4333,"type":15},"TypeScript","typescript","2026-07-03T16:31:19.368382",{"slug":4336,"name":4336,"fn":4337,"description":4338,"org":4339,"tags":4340,"stars":25,"repoUrl":26,"updatedAt":4346},"azure-data-tables-java","build table storage applications with Java","Build table storage applications with Azure Tables SDK for Java. Use when working with Azure Table Storage or Cosmos DB Table API for NoSQL key-value data, schemaless storage, or structured data at scale.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[4341,4342,4343,4344,4345],{"name":13,"slug":14,"type":15},{"name":4310,"slug":4311,"type":15},{"name":4313,"slug":4314,"type":15},{"name":4135,"slug":4136,"type":15},{"name":4316,"slug":4317,"type":15},"2026-05-13T06:14:17.582229",267]