Skip to content

Latest commit

 

History

History
80 lines (64 loc) · 5.97 KB

cli-samples.md

File metadata and controls

80 lines (64 loc) · 5.97 KB
title description author ms.service ms.subservice ms.topic ms.date ms.author ms.custom
Azure CLI Samples for Azure Cosmos DB
Azure CLI Samples for Azure Cosmos DB
markjbrown
cosmos-db
cosmosdb-sql
sample
10/07/2020
mjbrown
devx-track-azurecli

Azure CLI samples for Azure Cosmos DB

The following table includes links to sample Azure CLI scripts for Azure Cosmos DB. Use the links on the right to navigate to API specific samples. Common samples are the same across all APIs. Reference pages for all Azure Cosmos DB CLI commands are available in the Azure CLI Reference. Azure Cosmos DB CLI script samples can also be found in the Azure Cosmos DB CLI GitHub Repository.

These samples require Azure CLI version 2.9.1 or later. Run az --version to find the version. If you need to install or upgrade, see Install Azure CLI

Common Samples

These samples apply to all Azure Cosmos DB APIs

Task Description
Add or failover regions Add a region, change failover priority, trigger a manual failover.
Account keys and connection strings  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.

Core (SQL) API Samples

Task Description
Create an Azure Cosmos account, database and container Creates an Azure Cosmos DB account, database, and container for Core (SQL) API.
Create an Azure Cosmos account, database and container with autoscale Creates an Azure Cosmos DB account, database, and container with autoscale for Core (SQL) API.
Throughput operations Read, update and migrate between autoscale and standard throughput on a database and container.
Lock resources from deletion Prevent resources from being deleted with resource locks.

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 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.
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.

Cassandra API Samples

Task Description
Create an Azure Cosmos account, keyspace and table Creates an Azure Cosmos DB account, keyspace, and table for Cassandra API.
Create an Azure Cosmos account, keyspace and table with autoscale Creates an Azure Cosmos DB account, keyspace, and table with autoscale for Cassandra API.
Throughput operations Read, update and migrate between autoscale and standard throughput on a keyspace and table.
Lock resources from deletion Prevent resources from being deleted with resource locks.

Gremlin API Samples

Task Description
Create an Azure Cosmos account, database and graph Creates an Azure Cosmos DB account, database, and graph for Gremlin API.
Create an Azure Cosmos account, database and graph with autoscale Creates an Azure Cosmos DB account, database, and graph with autoscale for Gremlin API.
Throughput operations Read, update and migrate between autoscale and standard throughput on a database and graph.
Lock resources from deletion Prevent resources from being deleted with resource locks.

Table API Samples

Task Description
Create an Azure Cosmos account and table Creates an Azure Cosmos DB account and table for Table API.
Create an Azure Cosmos account and table with autoscale Creates an Azure Cosmos DB account and table with autoscale for Table API.
Throughput operations Read, update and migrate between autoscale and standard throughput on a table.
Lock resources from deletion Prevent resources from being deleted with resource locks.