azure-cosmos-py
Azure Cosmos DB for Python (NoSQL API): document CRUD, queries, containers and partition keys.
- Kind
- Skill
- Works with
- Claude Code
- Languages
- Python
- Source
- microsoft/skills @ 2130750147de
- Path
- .github/plugins/azure-sdk-python/skills/azure-cosmos-py/SKILL.md
- License
- MIT
- Jobs
- Implementation
InstallCopy it from the source repository, or sign in and let the assistant adapt it for your project.
# Azure Cosmos DB SDK for Python Client library for Azure Cosmos DB NoSQL API — globally distributed, multi-model database. ## Installation ```bash pip install azure-cosmos azure-identity ``` ## Environment Variables ```bash COSMOS_ENDPOINT=https://<account>.documents.azure.com:443/ # Required for all auth methods COSMOS_DATABASE=mydb # Required for all auth methods COSMOS_CONTAINER=mycontainer # Required for all auth methods AZURE_TOKEN_CREDENTIALS=prod # Required only if DefaultAzureCredential is used in production ``` ## Authentication & Lifecycle > **🔑 Two rules apply to every code sample below:** > > 1. **Prefer `DefaultAzureCredential`.** It works locally (Azure CLI / VS Code / Developer CLI) and in Azure (managed identity, workload identity) with no code change. Avoid connection strings, account/API keys — they bypass Entra audit and rotation. > - Local dev: `DefaultAzureCredential` works as-is. > - Production: set `AZURE_TOKEN_CREDENTIALS=prod` (or `AZURE_TOKEN_CREDENTIALS=<specific_credential>`) to constrain the credential chain to production-safe credentials. …