Azure CLI samples for Azure Cosmos DB API for MongoDB
APPLIES TO:
Azure Cosmos DB API for MongoDB
The following tables include links to sample Azure CLI scripts for the Azure Cosmos DB MongoDB API and to sample Azure CLI scripts that apply to all Cosmos DB APIs. Common samples are the same across all APIs.
These samples require Azure CLI version 2.30 or later. Run az --version to find the version. If you need to install or upgrade, see Install Azure CLI. If using Azure Cloud Shell, the latest version is already installed.
MongoDB API Samples
| Task | Description |
|---|---|
| Create an Azure Cosmos account, database and collection | Creates an Azure Cosmos DB account, database, and collection for MongoDB API. |
| Create a serverless Azure Cosmos account, database and collection | Creates a serverless Azure Cosmos DB account, database, and collection for MongoDB API. |
| Create an Azure Cosmos account, database with autoscale and two collections with shared throughput | Creates an Azure Cosmos DB account, database with autoscale and two collections with shared throughput for MongoDB API. |
| Perform throughput operations | Read, update and migrate between autoscale and standard throughput on a database and collection. |
| Lock resources from deletion | Prevent resources from being deleted with resource locks. |
Common API Samples
These samples apply to all Azure Cosmos DB APIs. These samples use a SQL (Core) API account, but these operations are identical across all database APIs in Cosmos DB.
| Task | Description |
|---|---|
| Add or fail over regions | Add a region, change failover priority, trigger a manual failover. |
| Perform account key operations | List account keys, read-only keys, regenerate keys and list connection strings. |
| Secure with IP firewall | Create a Cosmos account with IP firewall configured. |
| Secure new account with service endpoints | Create a Cosmos account and secure with service-endpoints. |
| Secure existing account with service endpoints | Update a Cosmos account to secure with service-endpoints when the subnet is eventually configured. |
Next steps
Reference pages for all Azure Cosmos DB CLI commands are available in the Azure CLI Reference.
For Azure CLI samples for other APIs see:
Povratne informacije
Pošalјite i prikažite povratne informacije za