Skip to content

Commit b6c4d59

Browse files
authored
Merge pull request #89459 from markjbrown/mjbrown-cli-update
Mega update to az cli for cosmos db
2 parents 4a60f1b + b912f7d commit b6c4d59

34 files changed

+926
-610
lines changed

.openpublishing.redirection.json

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1715,6 +1715,66 @@
17151715
"redirect_url": "/azure/cosmos-db/manage-with-powershell",
17161716
"redirect_document_id": true
17171717
},
1718+
{
1719+
"source_path": "articles/cosmos-db/scripts/create-cassandra-database-account-cli.md",
1720+
"redirect_url": "/azure/cosmos-db/scripts/cli/cassandra/create",
1721+
"redirect_document_id": false
1722+
},
1723+
{
1724+
"source_path": "articles/cosmos-db/scripts/create-database-account-collections-cli.md",
1725+
"redirect_url": "/azure/cosmos-db/scripts/cli/sql/create",
1726+
"redirect_document_id": false
1727+
},
1728+
{
1729+
"source_path": "articles/cosmos-db/scripts/create-firewall-cli.md",
1730+
"redirect_url": "/azure/cosmos-db/scripts/cli/common/ipfirewall",
1731+
"redirect_document_id": false
1732+
},
1733+
{
1734+
"source_path": "articles/cosmos-db/scripts/create-gremlin-database-account-cli.md",
1735+
"redirect_url": "/azure/cosmos-db/scripts/cli/gremlin/create",
1736+
"redirect_document_id": false
1737+
},
1738+
{
1739+
"source_path": "articles/cosmos-db/scripts/create-mongodb-database-account-cli.md",
1740+
"redirect_url": "/azure/cosmos-db/scripts/cli/mongodb/create",
1741+
"redirect_document_id": false
1742+
},
1743+
{
1744+
"source_path": "articles/cosmos-db/scripts/create-table-database-account-cli.md",
1745+
"redirect_url": "/azure/cosmos-db/scripts/cli/table/create",
1746+
"redirect_document_id": false
1747+
},
1748+
{
1749+
"source_path": "articles/cosmos-db/scripts/ha-failover-policy.md",
1750+
"redirect_url": "/azure/cosmos-db/scripts/cli/common/regions",
1751+
"redirect_document_id": false
1752+
},
1753+
{
1754+
"source_path": "articles/cosmos-db/scripts/scale-collection-throughput-cli.md",
1755+
"redirect_url": "/azure/cosmos-db/scripts/cli/sql/throughput",
1756+
"redirect_document_id": false
1757+
},
1758+
{
1759+
"source_path": "articles/cosmos-db/scripts/scale-multiregion-cli.md",
1760+
"redirect_url": "/azure/cosmos-db/scripts/cli/common/regions",
1761+
"redirect_document_id": false
1762+
},
1763+
{
1764+
"source_path": "articles/cosmos-db/scripts/secure-get-account-key-cli.md",
1765+
"redirect_url": "/azure/cosmos-db/scripts/cli/common/keys",
1766+
"redirect_document_id": false
1767+
},
1768+
{
1769+
"source_path": "articles/cosmos-db/scripts/secure-mongo-connection-string.md",
1770+
"redirect_url": "/azure/cosmos-db/scripts/cli/common/keys",
1771+
"redirect_document_id": false
1772+
},
1773+
{
1774+
"source_path": "articles/cosmos-db/scripts/secure-generate-key-cli.md",
1775+
"redirect_url": "/azure/cosmos-db/scripts/cli/common/keys",
1776+
"redirect_document_id": false
1777+
},
17181778
{
17191779
"source_path": "articles/cosmos-db/programming.md",
17201780
"redirect_url": "/azure/cosmos-db/storedprocedures-triggers-udfs",

articles/cosmos-db/TOC.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,8 @@
349349
href: manage-cassandra-with-resource-manager.md
350350
- name: Manage using PowerShell
351351
href: powershell-samples-cassandra.md
352+
- name: Manage using Azure CLI
353+
href: cli-samples-cassandra.md
352354
- name: MongoDB API
353355
items:
354356
- name: Introduction
@@ -432,6 +434,8 @@
432434
href: manage-mongodb-with-resource-manager.md
433435
- name: Manage using PowerShell
434436
href: powershell-samples-mongodb.md
437+
- name: Manage using Azure CLI
438+
href: cli-samples-mongodb.md
435439
- name: Troubleshoot common issues
436440
href: mongodb-troubleshoot.md
437441
- name: Gremlin API
@@ -492,6 +496,8 @@
492496
href: manage-gremlin-with-resource-manager.md
493497
- name: Manage using PowerShell
494498
href: powershell-samples-gremlin.md
499+
- name: Manage using Azure CLI
500+
href: cli-samples-gremlin.md
495501
- name: Table API
496502
items:
497503
- name: Introduction
@@ -546,6 +552,8 @@
546552
href: manage-table-with-resource-manager.md
547553
- name: Manage using PowerShell
548554
href: powershell-samples-table.md
555+
- name: Manage using Azure CLI
556+
href: cli-samples-table.md
549557
- name: Reference
550558
items:
551559
- name: .NET
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
title: Azure CLI samples for Azure Cosmos DB Cassandra API
3+
description: Azure CLI samples for Azure Cosmos DB Cassandra API
4+
author: markjbrown
5+
ms.service: cosmos-db
6+
ms.subservice: cosmosdb-cassandra
7+
ms.topic: sample
8+
ms.date: 9/25/2019
9+
ms.author: mjbrown
10+
---
11+
12+
# Azure CLI samples for Azure Cosmos DB Cassandra API
13+
14+
The following table includes links to sample Azure CLI scripts for Azure Cosmos DB Cassandra API. Reference pages for all Azure Cosmos DB CLI commands are available in the [Azure CLI Reference](/cli/azure/cosmosdb). All Azure Cosmos DB CLI script samples can be found in the [Azure Cosmos DB CLI GitHub Repository](https://github.com/Azure-Samples/azure-cli-samples/tree/master/cosmosdb).
15+
16+
| | |
17+
|---|---|
18+
| [Create an Azure Cosmos account, keyspace and table](scripts/cli/cassandra/create.md?toc=%2fcli%2fazure%2ftoc.json)| Creates an Azure Cosmos DB account, keyspace, and table for Cassandra API. |
19+
| [Change throughput](scripts/cli/cassandra/throughput.md?toc=%2fcli%2fazure%2ftoc.json) | Update RU/s on a keyspace and table.|
20+
| [Add or failover regions](scripts/cli/common/regions.md?toc=%2fcli%2fazure%2ftoc.json) | Add a region, change failover priority, trigger a manual failover.|
21+
| [Account keys and connection strings](scripts/cli/common/keys.md?toc=%2fcli%2fazure%2ftoc.json) | List account keys, read-only keys, regenerate keys and list connection strings.|
22+
| [Secure with IP firewall](scripts/cli/common/ipfirewall.md?toc=%2fcli%2fazure%2ftoc.json)| Create a Cosmos account with IP firewall configured.|
23+
| [Secure new account with service endpoints](scripts/cli/common/service-endpoints.md?toc=%2fcli%2fazure%2ftoc.json)| Create a Cosmos account and secure with service-endpoints.|
24+
| [Secure existing account with service endpoints](scripts/cli/common/service-endpoints-ignore-missing-vnet.md?toc=%2fcli%2fazure%2ftoc.json)| Update a Cosmos account to secure with service-endpoints when the subnet is eventually configured.|
25+
|||
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
title: Azure CLI samples for Azure Cosmos DB Gremlin API
3+
description: Azure CLI samples for Azure Cosmos DB Gremlin API
4+
author: markjbrown
5+
ms.service: cosmos-db
6+
ms.subservice: cosmosdb-graph
7+
ms.topic: sample
8+
ms.date: 9/25/2019
9+
ms.author: mjbrown
10+
---
11+
12+
# Azure CLI samples for Azure Cosmos DB Gremlin API
13+
14+
The following table includes links to sample Azure CLI scripts for Azure Cosmos DB Gremlin API. Reference pages for all Azure Cosmos DB CLI commands are available in the [Azure CLI Reference](/cli/azure/cosmosdb). All Azure Cosmos DB CLI script samples can be found in the [Azure Cosmos DB CLI GitHub Repository](https://github.com/Azure-Samples/azure-cli-samples/tree/master/cosmosdb).
15+
16+
| | |
17+
|---|---|
18+
| [Create an Azure Cosmos account, database and graph](scripts/cli/gremlin/create.md?toc=%2fcli%2fazure%2ftoc.json)| Creates an Azure Cosmos DB account, database, and graph for Gremlin API. |
19+
| [Change throughput](scripts/cli/gremlin/throughput.md?toc=%2fcli%2fazure%2ftoc.json) | Update RU/s on a database and graph.|
20+
| [Add or failover regions](scripts/cli/common/regions.md?toc=%2fcli%2fazure%2ftoc.json) | Add a region, change failover priority, trigger a manual failover.|
21+
| [Account keys and connection strings](scripts/cli/common/keys.md?toc=%2fcli%2fazure%2ftoc.json) | List account keys, read-only keys, regenerate keys and list connection strings.|
22+
| [Secure with IP firewall](scripts/cli/common/ipfirewall.md?toc=%2fcli%2fazure%2ftoc.json)| Create a Cosmos account with IP firewall configured.|
23+
| [Secure new account with service endpoints](scripts/cli/common/service-endpoints.md?toc=%2fcli%2fazure%2ftoc.json)| Create a Cosmos account and secure with service-endpoints.|
24+
| [Secure existing account with service endpoints](scripts/cli/common/service-endpoints-ignore-missing-vnet.md?toc=%2fcli%2fazure%2ftoc.json)| Update a Cosmos account to secure with service-endpoints when the subnet is eventually configured.|
25+
|||
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
title: Azure CLI samples for Azure Cosmos DB MongoDB API
3+
description: Azure CLI samples for Azure Cosmos DB MongoDB API
4+
author: markjbrown
5+
ms.service: cosmos-db
6+
ms.subservice: cosmosdb-mongo
7+
ms.topic: sample
8+
ms.date: 9/25/2019
9+
ms.author: mjbrown
10+
---
11+
12+
# Azure CLI samples for Azure Cosmos DB MongoDB API
13+
14+
The following table includes links to sample Azure CLI scripts for Azure Cosmos DB MongoDB API. Reference pages for all Azure Cosmos DB CLI commands are available in the [Azure CLI Reference](/cli/azure/cosmosdb). All Azure Cosmos DB CLI script samples can be found in the [Azure Cosmos DB CLI GitHub Repository](https://github.com/Azure-Samples/azure-cli-samples/tree/master/cosmosdb).
15+
16+
| | |
17+
|---|---|
18+
| [Create an Azure Cosmos account, database and collection](scripts/cli/mongodb/create.md?toc=%2fcli%2fazure%2ftoc.json)| Creates an Azure Cosmos DB account, database, and collection for MongoDB API. |
19+
| [Change throughput](scripts/cli/mongodb/throughput.md?toc=%2fcli%2fazure%2ftoc.json) | Update RU/s on a database and collection.|
20+
| [Add or failover regions](scripts/cli/common/regions.md?toc=%2fcli%2fazure%2ftoc.json) | Add a region, change failover priority, trigger a manual failover.|
21+
| [Account keys and connection strings](scripts/cli/common/keys.md?toc=%2fcli%2fazure%2ftoc.json) | List account keys, read-only keys, regenerate keys and list connection strings.|
22+
| [Secure with IP firewall](scripts/cli/common/ipfirewall.md?toc=%2fcli%2fazure%2ftoc.json)| Create a Cosmos account with IP firewall configured.|
23+
| [Secure new account with service endpoints](scripts/cli/common/service-endpoints.md?toc=%2fcli%2fazure%2ftoc.json)| Create a Cosmos account and secure with service-endpoints.|
24+
| [Secure existing account with service endpoints](scripts/cli/common/service-endpoints-ignore-missing-vnet.md?toc=%2fcli%2fazure%2ftoc.json)| Update a Cosmos account to secure with service-endpoints when the subnet is eventually configured.|
25+
|||
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
title: Azure CLI samples for Azure Cosmos DB Table API
3+
description: Azure CLI samples for Azure Cosmos DB Table API
4+
author: markjbrown
5+
ms.service: cosmos-db
6+
ms.subservice: cosmosdb-table
7+
ms.topic: sample
8+
ms.date: 9/25/2019
9+
ms.author: mjbrown
10+
---
11+
12+
# Azure CLI samples for Azure Cosmos DB Table API
13+
14+
The following table includes links to sample Azure CLI scripts for Azure Cosmos DB Table API. Reference pages for all Azure Cosmos DB CLI commands are available in the [Azure CLI Reference](/cli/azure/cosmosdb). All Azure Cosmos DB CLI script samples can be found in the [Azure Cosmos DB CLI GitHub Repository](https://github.com/Azure-Samples/azure-cli-samples/tree/master/cosmosdb).
15+
16+
| | |
17+
|---|---|
18+
| [Create an Azure Cosmos account and table](scripts/cli/table/create.md?toc=%2fcli%2fazure%2ftoc.json)| Creates an Azure Cosmos DB account and table for Table API. |
19+
| [Change throughput](scripts/cli/table/throughput.md?toc=%2fcli%2fazure%2ftoc.json) | Update RU/s on a table.|
20+
| [Add or failover regions](scripts/cli/common/regions.md?toc=%2fcli%2fazure%2ftoc.json) | Add a region, change failover priority, trigger a manual failover.|
21+
| [Account keys and connection strings](scripts/cli/common/keys.md?toc=%2fcli%2fazure%2ftoc.json) | List account keys, read-only keys, regenerate keys and list connection strings.|
22+
| [Secure with IP firewall](scripts/cli/common/ipfirewall.md?toc=%2fcli%2fazure%2ftoc.json)| Create a Cosmos account with IP firewall configured.|
23+
| [Secure new account with service endpoints](scripts/cli/common/service-endpoints.md?toc=%2fcli%2fazure%2ftoc.json)| Create a Cosmos account and secure with service-endpoints.|
24+
| [Secure existing account with service endpoints](scripts/cli/common/service-endpoints-ignore-missing-vnet.md?toc=%2fcli%2fazure%2ftoc.json)| Update a Cosmos account to secure with service-endpoints when the subnet is eventually configured.|
25+
|||

articles/cosmos-db/cli-samples.md

Lines changed: 13 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,25 @@
11
---
2-
title: Azure CLI Samples for Azure Cosmos DB
3-
description: Azure CLI Samples - Create and manage Azure Cosmos DB accounts, databases, containers, regions, and firewalls.
2+
title: Azure CLI Samples for Azure Cosmos DB SQL (Core) API
3+
description: Azure CLI Samples for Azure Cosmos DB SQL (Core) API
44
author: markjbrown
55
ms.service: cosmos-db
6+
ms.subservice: cosmosdb-sql
67
ms.topic: sample
7-
ms.date: 10/26/2018
8+
ms.date: 9/25/2019
89
ms.author: mjbrown
9-
ms.reviewer: sngun
1010
---
1111

12-
# Azure CLI samples for Azure Cosmos DB
12+
# Azure CLI samples for Azure Cosmos DB SQL (Core) API
1313

14-
The following table includes links to sample Azure CLI scripts for Azure Cosmos DB. Reference pages for all Azure Cosmos DB CLI commands are available in the [Azure CLI Reference](/cli/azure/cosmosdb).
14+
The following table includes links to sample Azure CLI scripts for Azure Cosmos DB SQL (Core) API. Reference pages for all Azure Cosmos DB CLI commands are available in the [Azure CLI Reference](/cli/azure/cosmosdb). For Azure CLI samples for other Azure Cosmos DB APIs see, [Cassandra API](cli-samples-cassandra.md), [MongoDB API](cli-samples-mongodb.md), [Gremlin API](cli-samples-gremlin.md), and [Table API](cli-samples-table.md). All Azure Cosmos DB CLI script samples can be found in the [Azure Cosmos DB CLI GitHub Repository](https://github.com/Azure-Samples/azure-cli-samples/tree/master/cosmosdb).
1515

1616
| | |
1717
|---|---|
18-
|**Create Azure Cosmos DB account, database, and containers**||
19-
| [Create an Azure Cosmos DB account using SQL API](scripts/create-database-account-collections-cli.md?toc=%2fcli%2fazure%2ftoc.json)| Creates a single Azure Cosmos DB account, database, and container. |
20-
| [Create an Azure Cosmos DB account using Cosmos DB's API for MongoDB](scripts/create-mongodb-database-account-cli.md?toc=%2fcli%2fazure%2ftoc.json) | Creates a single Azure Cosmos DB account, a database, and a collection. |
21-
| [Create an Azure Cosmos DB account using Gremlin API](scripts/create-gremlin-database-account-cli.md?toc=%2fcli%2fazure%2ftoc.json) | Creates a single Azure Cosmos DB account, database, and graph. |
22-
| [Create an Azure Cosmos DB account using Cassandra API](scripts/create-cassandra-database-account-cli.md?toc=%2fcli%2fazure%2ftoc.json) | Creates a single Azure Cosmos DB account and database. |
23-
| [Create an Azure Cosmos DB account using Table API](scripts/create-table-database-account-cli.md?toc=%2fcli%2fazure%2ftoc.json) | Creates a single Azure Cosmos DB account, database, and table. |
24-
|**Scale Azure Cosmos DB**||
25-
| [Scale container throughput](scripts/scale-collection-throughput-cli.md?toc=%2fcli%2fazure%2ftoc.json) | Changes the provisioned throughput on a container.|
26-
| [Replicate Azure Cosmos database account in multiple regions and configure failover priorities](scripts/scale-multiregion-cli.md?toc=%2fcli%2fazure%2ftoc.json)|Globally replicates account data into multiple regions with a specified failover priority.|
27-
|**Secure Azure Cosmos DB**||
28-
| [Get account keys](scripts/secure-get-account-key-cli.md?toc=%2fcli%2fazure%2ftoc.json) | Gets the primary and secondary master write keys and primary and secondary read-only keys for the account.|
29-
| [Get the connection string for Cosmos account configured with Azure Cosmos DB's API for MongoDB](scripts/secure-mongo-connection-string-cli.md?toc=%2fcli%2fazure%2ftoc.json) | Gets the connection string to connect MongoDB app to your Azure Cosmos DB account.|
30-
| [Regenerate account keys](scripts/secure-regenerate-key-cli.md?toc=%2fcli%2fazure%2ftoc.json)|Regenerate the keys for the account.|
31-
| [Create a firewall](scripts/create-firewall-cli.md?toc=%2fcli%2fazure%2ftoc.json)| Create an inbound IP access control policy to limit access to the account from an approved set of machines and/or cloud services.|
32-
|**High availability, disaster recovery, backup and restore**||
33-
| [Configure failover policy](scripts/ha-failover-policy-cli.md?toc=%2fcli%2fazure%2ftoc.json)|Sets the failover priority of each region in which the account is replicated.|
34-
|**Connect Azure Cosmos DB to resources**||
35-
| [Connect a web app to Azure Cosmos DB](../app-service/scripts/cli-connect-to-documentdb.md?toc=%2fcli%2fazure%2ftoc.json)|Create and connect an Azure Cosmos database and an Azure web app.|
18+
| [Create an Azure Cosmos account, database and container](scripts/cli/sql/create.md?toc=%2fcli%2fazure%2ftoc.json)| Creates an Azure Cosmos DB account, database, and container for SQL (Core) API. |
19+
| [Change throughput](scripts/cli/sql/throughput.md?toc=%2fcli%2fazure%2ftoc.json) | Update RU/s on a database and container.|
20+
| [Add or failover regions](scripts/cli/common/regions.md?toc=%2fcli%2fazure%2ftoc.json) | Add a region, change failover priority, trigger a manual failover.|
21+
| [Account keys and connection strings](scripts/cli/common/keys.md?toc=%2fcli%2fazure%2ftoc.json) | List account keys, read-only keys, regenerate keys and list connection strings.|
22+
| [Secure with IP firewall](scripts/cli/common/ipfirewall.md?toc=%2fcli%2fazure%2ftoc.json)| Create a Cosmos account with IP firewall configured.|
23+
| [Secure new account with service endpoints](scripts/cli/common/service-endpoints.md?toc=%2fcli%2fazure%2ftoc.json)| Create a Cosmos account and secure with service-endpoints.|
24+
| [Secure existing account with service endpoints](scripts/cli/common/service-endpoints-ignore-missing-vnet.md?toc=%2fcli%2fazure%2ftoc.json)| Update a Cosmos account to secure with service-endpoints when the subnet is eventually configured.|
3625
|||
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
---
2+
title: Create a Cassandra keyspace and table for Azure Cosmos DB
3+
description: Create a Cassandra keyspace and table for Azure Cosmos DB
4+
author: markjbrown
5+
ms.author: mjbrown
6+
ms.service: cosmos-db
7+
ms.subservice: cosmosdb-cassandra
8+
ms.topic: sample
9+
ms.date: 9/25/2019
10+
---
11+
12+
# Create an Azure Cosmos Cassandra API account, keyspace and table using Azure CLI
13+
14+
[!INCLUDE [cloud-shell-try-it.md](../../../../../includes/cloud-shell-try-it.md)]
15+
16+
If you choose to install and use the CLI locally, this topic requires that you are running the Azure CLI version 2.0.73 or later. Run `az --version` to find the version. If you need to install or upgrade, see [Install Azure CLI](/cli/azure/install-azure-cli).
17+
18+
## Sample script
19+
20+
[!code-azurecli-interactive[main](../../../../../cli_scripts/cosmosdb/cassandra/create.sh "Create an Azure Cosmos DB Cassandra API account, keyspace, and table.")]
21+
22+
## Clean up deployment
23+
24+
After the script sample has been run, the following command can be used to remove the resource group and all resources associated with it.
25+
26+
```azurecli-interactive
27+
az group delete --name $resourceGroupName
28+
```
29+
30+
## Script explanation
31+
32+
This script uses the following commands. Each command in the table links to command specific documentation.
33+
34+
| Command | Notes |
35+
|---|---|
36+
| [az group create](/cli/azure/group#az-group-create) | Creates a resource group in which all resources are stored. |
37+
| [az cosmosdb create](/cli/azure/cosmosdb#az-cosmosdb-create) | Creates an Azure Cosmos DB account. |
38+
| [az cosmosdb cassandra keyspace create](/cli/azure/cosmosdb/cassandra/keyspace#az-cosmosdb-cassandra-keyspace-create) | Creates an Azure Cosmos Cassandra keyspace. |
39+
| [az cosmosdb cassandra table create](/cli/azure/cosmosdb/cassandra/table#az-cosmosdb-cassandra-table-create) | Creates an Azure Cosmos Cassandra table. |
40+
| [az group delete](/cli/azure/resource#az-resource-delete) | Deletes a resource group including all nested resources. |
41+
42+
## Next steps
43+
44+
For more information on the Azure Cosmos DB CLI, see [Azure Cosmos DB CLI documentation](/cli/azure/cosmosdb).
45+
46+
All Azure Cosmos DB CLI script samples can be found in the [Azure Cosmos DB CLI GitHub Repository](https://github.com/Azure-Samples/azure-cli-samples/tree/master/cosmosdb).

0 commit comments

Comments
 (0)