Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Prepare applications for Azure deployment by generating infrastructure code, Dockerfiles, and config files.
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
references/sdk/azure-identity-py.md
1# Authentication — Python SDK Quick Reference23> Condensed from **azure-identity-py**. Full patterns (async,4> ChainedTokenCredential, token caching, all credential types)5> in the **azure-identity-py** plugin skill if installed.67## Install8```bash9pip install azure-identity10```1112## Quick Start1314> **Auth:** `DefaultAzureCredential` is for local development. See [auth-best-practices.md](../auth-best-practices.md) for production patterns.1516```python17from azure.identity import DefaultAzureCredential18credential = DefaultAzureCredential()19```2021## Best Practices22- Use DefaultAzureCredential for **local development only** (CLI, PowerShell, VS Code). In production, use ManagedIdentityCredential — see [auth-best-practices.md](../auth-best-practices.md)23- Never hardcode credentials — use environment variables or managed identity24- Prefer managed identity in production Azure deployments25- Use ChainedTokenCredential when you need a custom credential order26- Close async credentials explicitly or use context managers27- Set AZURE_CLIENT_ID env var for user-assigned managed identities28- Exclude unused credentials to speed up authentication29