Skip to content

Commit 2b4727c

Browse files
Merge pull request #113433 from markjbrown/arm-autoscale
Autoscale and Free Tier Templates
2 parents 695dbe7 + 3d34ff7 commit 2b4727c

7 files changed

+177
-1640
lines changed

articles/cosmos-db/how-to-manage-database-account.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: Learn how to manage Azure Cosmos DB resources by using the Azure po
44
author: markjbrown
55
ms.service: cosmos-db
66
ms.topic: conceptual
7-
ms.date: 12/02/2019
7+
ms.date: 04/30/2020
88
ms.author: mjbrown
99
---
1010

@@ -24,11 +24,11 @@ Please see [Create an Azure Cosmos DB account with Azure CLI](manage-with-cli.md
2424

2525
### <a id="create-database-account-via-ps"></a>Azure PowerShell
2626

27-
Please see [Create an Azure Cosmos DB account with Powershell](manage-with-powershell.md#create-account)
27+
Please see [Create an Azure Cosmos DB account with PowerShell](manage-with-powershell.md#create-account)
2828

2929
### <a id="create-database-account-via-arm-template"></a>Azure Resource Manager template
3030

31-
This Azure Resource Manager template will create an Azure Cosmos account for SQL API configured with two regions and options to select consistency level, automatic failover, and multi-master. To deploy this template, click on Deploy to Azure on the readme page, [Create Azure Cosmos account](https://github.com/Azure/azure-quickstart-templates/tree/master/101-cosmosdb-sql)
31+
Please see [Create Azure Cosmos DB account with Azure Resource Manager templates](manage-sql-with-resource-manager.md)
3232

3333
## Add/remove regions from your database account
3434

@@ -56,7 +56,7 @@ Please see [Add or remove regions with Azure CLI](manage-with-cli.md#add-or-remo
5656

5757
### <a id="add-remove-regions-via-ps"></a>Azure PowerShell
5858

59-
Please see [Add or remove regions with Powershell](manage-with-powershell.md#update-account)
59+
Please see [Add or remove regions with PowerShell](manage-with-powershell.md#update-account)
6060

6161
## <a id="configure-multiple-write-regions"></a>Configure multiple write-regions
6262

@@ -72,7 +72,7 @@ Please see [Enable multiple-write regions with Azure CLI](manage-with-cli.md#ena
7272

7373
### <a id="configure-multiple-write-regions-ps"></a>Azure PowerShell
7474

75-
Please see [Enable multiple-write regions with Powershell](manage-with-powershell.md#multi-master)
75+
Please see [Enable multiple-write regions with PowerShell](manage-with-powershell.md#multi-master)
7676

7777
### <a id="configure-multiple-write-regions-arm"></a>Resource Manager template
7878

@@ -158,7 +158,7 @@ Please see [Enable automatic failover with Azure CLI](manage-with-cli.md#enable-
158158

159159
### <a id="enable-automatic-failover-via-ps"></a>Azure PowerShell
160160

161-
Please see [Enable automatic failover with Powershell](manage-with-powershell.md#enable-automatic-failover)
161+
Please see [Enable automatic failover with PowerShell](manage-with-powershell.md#enable-automatic-failover)
162162

163163
## Set failover priorities for your Azure Cosmos account
164164

@@ -189,7 +189,7 @@ Please see [Set failover priority with Azure CLI](manage-with-cli.md#set-failove
189189

190190
### <a id="set-failover-priorities-via-ps"></a>Azure PowerShell
191191

192-
Please see [Set failover priority with Powershell](manage-with-powershell.md#modify-failover-priority)
192+
Please see [Set failover priority with PowerShell](manage-with-powershell.md#modify-failover-priority)
193193

194194
## <a id="manual-failover"></a>Perform manual failover on an Azure Cosmos account
195195

@@ -221,7 +221,7 @@ Please see [Trigger manual failover with Azure CLI](manage-with-cli.md#trigger-m
221221

222222
### <a id="enable-manual-failover-via-ps"></a>Azure PowerShell
223223

224-
Please see [Trigger manual failover with Powershell](manage-with-powershell.md#trigger-manual-failover)
224+
Please see [Trigger manual failover with PowerShell](manage-with-powershell.md#trigger-manual-failover)
225225

226226
## Next steps
227227

articles/cosmos-db/manage-cassandra-with-resource-manager.md

Lines changed: 36 additions & 225 deletions
Original file line numberDiff line numberDiff line change
@@ -4,238 +4,49 @@ description: Use Azure Resource Manager templates to create and configure Azure
44
author: markjbrown
55
ms.service: cosmos-db
66
ms.topic: conceptual
7-
ms.date: 04/27/2020
7+
ms.date: 04/30/2020
88
ms.author: mjbrown
99
---
1010

1111
# Manage Azure Cosmos DB Cassandra API resources using Azure Resource Manager templates
1212

13-
This article describes how to perform different operations to automate management of your Azure Cosmos DB accounts, databases and containers using Azure Resource Manager templates. This article has examples for Cassandra API accounts only, to find examples for other API type accounts see: use Azure Resource Manager templates with Azure Cosmos DB's API for [SQL](manage-sql-with-resource-manager.md), [Gremlin](manage-gremlin-with-resource-manager.md), [MongoDB](manage-mongodb-with-resource-manager.md), [Table](manage-table-with-resource-manager.md) articles.
14-
15-
## Create Azure Cosmos account, keyspace and table <a id="create-resource"></a>
16-
17-
Create Azure Cosmos DB resources using an Azure Resource Manager template. This template will create an Azure Cosmos account for Cassandra API with two tables that share 400 RU/s throughput at the keyspace-level. Copy the template and deploy as shown below or visit [Azure Quickstart Gallery](https://azure.microsoft.com/resources/templates/101-cosmosdb-cassandra/) and deploy from the Azure portal. You can also download the template to your local computer or create a new template and specify the local path with the `--template-file` parameter.
18-
19-
> [!NOTE]
20-
> Account names must be lowercase and 44 or fewer characters.
21-
> To update RU/s, resubmit the template with updated throughput property values.
22-
23-
```json
24-
{
25-
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
26-
"contentVersion": "1.0.0.0",
27-
"parameters": {
28-
"accountName": {
29-
"type": "string",
30-
"defaultValue": "",
31-
"metadata": {
32-
"description": "Cosmos DB account name, max length 44 characters"
33-
}
34-
},
35-
"location": {
36-
"type": "string",
37-
"defaultValue": "[resourceGroup().location]",
38-
"metadata": {
39-
"description": "Location for the Cosmos DB account."
40-
}
41-
},
42-
"primaryRegion":{
43-
"type":"string",
44-
"metadata": {
45-
"description": "The primary replica region for the Cosmos DB account."
46-
}
47-
},
48-
"secondaryRegion":{
49-
"type":"string",
50-
"metadata": {
51-
"description": "The secondary replica region for the Cosmos DB account."
52-
}
53-
},
54-
"defaultConsistencyLevel": {
55-
"type": "string",
56-
"defaultValue": "Session",
57-
"allowedValues": [ "Eventual", "ConsistentPrefix", "Session", "BoundedStaleness", "Strong" ],
58-
"metadata": {
59-
"description": "The default consistency level of the Cosmos DB account."
60-
}
61-
},
62-
"maxStalenessPrefix": {
63-
"type": "int",
64-
"defaultValue": 100000,
65-
"minValue": 10,
66-
"maxValue": 1000000,
67-
"metadata": {
68-
"description": "Max stale requests. Required for BoundedStaleness. Valid ranges, Single Region: 10 to 1000000. Multi Region: 100000 to 1000000."
69-
}
70-
},
71-
"maxIntervalInSeconds": {
72-
"type": "int",
73-
"defaultValue": 300,
74-
"minValue": 5,
75-
"maxValue": 86400,
76-
"metadata": {
77-
"description": "Max lag time (seconds). Required for BoundedStaleness. Valid ranges, Single Region: 5 to 84600. Multi Region: 300 to 86400."
78-
}
79-
},
80-
"automaticFailover": {
81-
"type": "bool",
82-
"defaultValue": true,
83-
"allowedValues": [ true, false ],
84-
"metadata": {
85-
"description": "Enable automatic failover for regions"
86-
}
87-
},
88-
"keyspaceName": {
89-
"type": "string",
90-
"defaultValue": "Keyspace1",
91-
"metadata": {
92-
"description": "The name for the Cassandra Keyspace"
93-
}
94-
},
95-
"tableName": {
96-
"type": "string",
97-
"defaultValue": "Table1",
98-
"metadata": {
99-
"description": "The name for the Cassandra table"
100-
}
101-
},
102-
"throughput": {
103-
"type": "int",
104-
"defaultValue": 400,
105-
"minValue": 400,
106-
"maxValue": 1000000,
107-
"metadata": {
108-
"description": "The throughput for the Cassandra table"
109-
}
110-
}
111-
},
112-
"variables": {
113-
"accountName": "[toLower(parameters('accountName'))]",
114-
"consistencyPolicy": {
115-
"Eventual": {
116-
"defaultConsistencyLevel": "Eventual"
117-
},
118-
"ConsistentPrefix": {
119-
"defaultConsistencyLevel": "ConsistentPrefix"
120-
},
121-
"Session": {
122-
"defaultConsistencyLevel": "Session"
123-
},
124-
"BoundedStaleness": {
125-
"defaultConsistencyLevel": "BoundedStaleness",
126-
"maxStalenessPrefix": "[parameters('maxStalenessPrefix')]",
127-
"maxIntervalInSeconds": "[parameters('maxIntervalInSeconds')]"
128-
},
129-
"Strong": {
130-
"defaultConsistencyLevel": "Strong"
131-
}
132-
},
133-
"locations":
134-
[
135-
{
136-
"locationName": "[parameters('primaryRegion')]",
137-
"failoverPriority": 0,
138-
"isZoneRedundant": false
139-
},
140-
{
141-
"locationName": "[parameters('secondaryRegion')]",
142-
"failoverPriority": 1,
143-
"isZoneRedundant": false
144-
}
145-
]
146-
},
147-
"resources":
148-
[
149-
{
150-
"type": "Microsoft.DocumentDB/databaseAccounts",
151-
"name": "[variables('accountName')]",
152-
"apiVersion": "2020-03-01",
153-
"location": "[parameters('location')]",
154-
"kind": "GlobalDocumentDB",
155-
"properties": {
156-
"capabilities": [{ "name": "EnableCassandra" }],
157-
"consistencyPolicy": "[variables('consistencyPolicy')[parameters('defaultConsistencyLevel')]]",
158-
"locations": "[variables('locations')]",
159-
"databaseAccountOfferType": "Standard",
160-
"enableAutomaticFailover": "[parameters('automaticFailover')]"
161-
}
162-
},
163-
{
164-
"type": "Microsoft.DocumentDB/databaseAccounts/cassandraKeyspaces",
165-
"name": "[concat(variables('accountName'), '/', parameters('keyspaceName'))]",
166-
"apiVersion": "2020-03-01",
167-
"dependsOn": [ "[resourceId('Microsoft.DocumentDB/databaseAccounts/', variables('accountName'))]" ],
168-
"properties":{
169-
"resource":{
170-
"id": "[parameters('keyspaceName')]"
171-
}
172-
}
173-
},
174-
{
175-
"type": "Microsoft.DocumentDb/databaseAccounts/cassandraKeyspaces/tables",
176-
"name": "[concat(variables('accountName'), '/', parameters('keyspaceName'), '/', parameters('tableName'))]",
177-
"apiVersion": "2020-03-01",
178-
"dependsOn": [ "[resourceId('Microsoft.DocumentDB/databaseAccounts/cassandraKeyspaces', variables('accountName'), parameters('keyspaceName'))]" ],
179-
"properties":
180-
{
181-
"resource":{
182-
"id": "[parameters('tableName')]",
183-
"schema": {
184-
"columns": [
185-
{ "name": "loadid", "type": "uuid" },
186-
{ "name": "machine", "type": "uuid" },
187-
{ "name": "cpu", "type": "int" },
188-
{ "name": "mtime", "type": "int" },
189-
{ "name": "load", "type": "float" }
190-
],
191-
"partitionKeys": [
192-
{ "name": "machine" },
193-
{ "name": "cpu" },
194-
{ "name": "mtime" }
195-
],
196-
"clusterKeys": [
197-
{ "name": "loadid", "orderBy": "asc" }
198-
]
199-
},
200-
"options": { "throughput": "[parameters('throughput')]" }
201-
}
202-
}
203-
}
204-
]
205-
}
206-
```
207-
208-
## Deploy with the Azure CLI
209-
210-
To deploy the Azure Resource Manager template using the Azure CLI, **Copy** the script and select **Try it** to open Azure Cloud Shell. To paste the script, right-click the shell, and then select **Paste**:
211-
212-
```azurecli-interactive
213-
214-
read -p 'Enter the Resource Group name: ' resourceGroupName
215-
read -p 'Enter the location (i.e. westus2): ' location
216-
read -p 'Enter the account name: ' accountName
217-
read -p 'Enter the primary region (i.e. westus2): ' primaryRegion
218-
read -p 'Enter the secondary region (i.e. eastus2): ' secondaryRegion
219-
read -p 'Enter the keyspace name: ' keyspaceName
220-
read -p 'Enter the table name: ' tableName
221-
read -p 'Enter the throughput: ' throughput
222-
223-
az group create --name $resourceGroupName --location $location
224-
az group deployment create --resource-group $resourceGroupName \
225-
--template-uri https://raw.githubusercontent.com/azure/azure-quickstart-templates/master/101-cosmosdb-cassandra/azuredeploy.json \
226-
--parameters accountName=$accountName primaryRegion=$primaryRegion secondaryRegion=$secondaryRegion keyspaceName=$keyspaceName \
227-
tableName=$tableName throughput=$throughput
228-
229-
az cosmosdb show --resource-group $resourceGroupName --name accountName --output tsv
230-
```
231-
232-
The `az cosmosdb show` command shows the newly created Azure Cosmos account after it has been provisioned. If you choose to use a locally installed version of the Azure CLI instead of using Cloud Shell, see the [Azure CLI](/cli/azure/) article.
13+
In this article, you learn how to use Azure Resource Manager templates to help deploy and manage your Azure Cosmos DB accounts, keyspaces, and tables.
14+
15+
This article has examples for Cassandra API accounts only, to find examples for other API type accounts see: use Azure Resource Manager templates with Azure Cosmos DB's API for [SQL](manage-sql-with-resource-manager.md), [Gremlin](manage-gremlin-with-resource-manager.md), [MongoDB](manage-mongodb-with-resource-manager.md), [Table](manage-table-with-resource-manager.md) articles.
16+
17+
> [!IMPORTANT]
18+
>
19+
> * Account names are limited to 44 characters, all lowercase.
20+
> * To change the throughput values, redeploy the template with updated RU/s.
21+
> * When you add or remove locations to an Azure Cosmos account, you can't simultaneously modify other properties. These operations must be done separately.
22+
23+
To create any of the Azure Cosmos DB resources below, copy the following example template into a new json file. You can optionally create a parameters json file to use when deploying multiple instances of the same resource with different names and values. There are many ways to deploy Azure Resource Manager templates including, [Azure portal](../azure-resource-manager/templates/deploy-portal.md), [Azure CLI](../azure-resource-manager/templates/deploy-cli.md), [Azure PowerShell](../azure-resource-manager/templates/deploy-powershell.md) and [GitHub](../azure-resource-manager/templates/deploy-to-azure-button.md).
24+
25+
<a id="create-autoscale"></a>
26+
27+
## Azure Cosmos account for Cassandra with autoscale throughput
28+
29+
This template creates an Azure Cosmos account in two regions with options for consistency and failover, with a keyspace and table configured for autoscale throughput. This template is also available for one-click deploy from Azure Quickstart Templates Gallery.
30+
31+
[![Deploy to Azure](https://aka.ms/deploytoazurebutton)](https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2FAzure%2Fazure-quickstart-templates%2Fmaster%2F101-cosmosdb-cassandra-autosscale%2Fazuredeploy.json)
32+
33+
:::code language="json" source="~/quickstart-templates/101-cosmosdb-cassandra-autoscale/azuredeploy.json":::
34+
35+
<a id="create-manual"></a>
36+
37+
## Azure Cosmos account for Cassandra with manual throughput
38+
39+
This template creates an Azure Cosmos account in two regions with options for consistency and failover, with a keyspace and table configured for manual throughput. This template is also available for one-click deploy from Azure Quickstart Templates Gallery.
40+
41+
[![Deploy to Azure](https://aka.ms/deploytoazurebutton)](https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2FAzure%2Fazure-quickstart-templates%2Fmaster%2F101-cosmosdb-cassandra%2Fazuredeploy.json)
42+
43+
:::code language="json" source="~/quickstart-templates/101-cosmosdb-cassandra/azuredeploy.json":::
23344

23445
## Next steps
23546

23647
Here are some additional resources:
23748

238-
- [Azure Resource Manager documentation](/azure/azure-resource-manager/)
239-
- [Azure Cosmos DB resource provider schema](/azure/templates/microsoft.documentdb/allversions)
240-
- [Azure Cosmos DB Quickstart templates](https://azure.microsoft.com/resources/templates/?resourceType=Microsoft.DocumentDB&pageNumber=1&sort=Popular)
241-
- [Troubleshoot common Azure Resource Manager deployment errors](../azure-resource-manager/templates/common-deployment-errors.md)
49+
* [Azure Resource Manager documentation](/azure/azure-resource-manager/)
50+
* [Azure Cosmos DB resource provider schema](/azure/templates/microsoft.documentdb/allversions)
51+
* [Azure Cosmos DB Quickstart templates](https://azure.microsoft.com/resources/templates/?resourceType=Microsoft.DocumentDB&pageNumber=1&sort=Popular)
52+
* [Troubleshoot common Azure Resource Manager deployment errors](../azure-resource-manager/templates/common-deployment-errors.md)

0 commit comments

Comments
 (0)