Skip to content

Commit d4f1afb

Browse files
committed
Merge branch 'master' of https://github.com/MicrosoftDocs/azure-docs-pr into rolyon-availability-zones-regions
2 parents fb8d596 + 9bd10ee commit d4f1afb

12 files changed

+910
-78
lines changed

articles/azure-resource-manager/templates/template-functions-comparison.md

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,88 @@ ms.date: 04/27/2020
88

99
Resource Manager provides several functions for making comparisons in your Azure Resource Manager (ARM) templates.
1010

11+
* [coalesce](#coalesce)
1112
* [equals](#equals)
1213
* [greater](#greater)
1314
* [greaterOrEquals](#greaterorequals)
1415
* [less](#less)
1516
* [lessOrEquals](#lessorequals)
1617

18+
## coalesce
19+
20+
`coalesce(arg1, arg2, arg3, ...)`
21+
22+
Returns first non-null value from the parameters. Empty strings, empty arrays, and empty objects are not null.
23+
24+
### Parameters
25+
26+
| Parameter | Required | Type | Description |
27+
|:--- |:--- |:--- |:--- |
28+
| arg1 |Yes |int, string, array, or object |The first value to test for null. |
29+
| additional args |No |int, string, array, or object |Additional values to test for null. |
30+
31+
### Return value
32+
33+
The value of the first non-null parameters, which can be a string, int, array, or object. Null if all parameters are null.
34+
35+
### Example
36+
37+
The following [example template](https://github.com/Azure/azure-docs-json-samples/blob/master/azure-resource-manager/functions/coalesce.json) shows the output from different uses of coalesce.
38+
39+
```json
40+
{
41+
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
42+
"contentVersion": "1.0.0.0",
43+
"parameters": {
44+
"objectToTest": {
45+
"type": "object",
46+
"defaultValue": {
47+
"null1": null,
48+
"null2": null,
49+
"string": "default",
50+
"int": 1,
51+
"object": {"first": "default"},
52+
"array": [1]
53+
}
54+
}
55+
},
56+
"resources": [
57+
],
58+
"outputs": {
59+
"stringOutput": {
60+
"type": "string",
61+
"value": "[coalesce(parameters('objectToTest').null1, parameters('objectToTest').null2, parameters('objectToTest').string)]"
62+
},
63+
"intOutput": {
64+
"type": "int",
65+
"value": "[coalesce(parameters('objectToTest').null1, parameters('objectToTest').null2, parameters('objectToTest').int)]"
66+
},
67+
"objectOutput": {
68+
"type": "object",
69+
"value": "[coalesce(parameters('objectToTest').null1, parameters('objectToTest').null2, parameters('objectToTest').object)]"
70+
},
71+
"arrayOutput": {
72+
"type": "array",
73+
"value": "[coalesce(parameters('objectToTest').null1, parameters('objectToTest').null2, parameters('objectToTest').array)]"
74+
},
75+
"emptyOutput": {
76+
"type": "bool",
77+
"value": "[empty(coalesce(parameters('objectToTest').null1, parameters('objectToTest').null2))]"
78+
}
79+
}
80+
}
81+
```
82+
83+
The output from the preceding example with the default values is:
84+
85+
| Name | Type | Value |
86+
| ---- | ---- | ----- |
87+
| stringOutput | String | default |
88+
| intOutput | Int | 1 |
89+
| objectOutput | Object | {"first": "default"} |
90+
| arrayOutput | Array | [1] |
91+
| emptyOutput | Bool | True |
92+
1793
## equals
1894

1995
`equals(arg1, arg2)`

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

Lines changed: 193 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
---
22
title: Resource Manager templates for Azure Cosmos DB Cassandra API
33
description: Use Azure Resource Manager templates to create and configure Azure Cosmos DB Cassandra API.
4-
author: TheovanKraay
4+
author: markjbrown
55
ms.service: cosmos-db
66
ms.topic: conceptual
7-
ms.date: 11/12/2019
8-
ms.author: thvankra
7+
ms.date: 04/27/2020
8+
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 SQL 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.
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.
1414

1515
## Create Azure Cosmos account, keyspace and table <a id="create-resource"></a>
1616

@@ -20,7 +20,190 @@ Create Azure Cosmos DB resources using an Azure Resource Manager template. This
2020
> Account names must be lowercase and 44 or fewer characters.
2121
> To update RU/s, resubmit the template with updated throughput property values.
2222
23-
:::code language="json" source="~/quickstart-templates/101-cosmosdb-cassandra/azuredeploy.json":::
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+
```
24207

25208
## Deploy with the Azure CLI
26209

@@ -33,22 +216,21 @@ read -p 'Enter the location (i.e. westus2): ' location
33216
read -p 'Enter the account name: ' accountName
34217
read -p 'Enter the primary region (i.e. westus2): ' primaryRegion
35218
read -p 'Enter the secondary region (i.e. eastus2): ' secondaryRegion
36-
read -p 'Enter the keyset name: ' keysetName
37-
read -p 'Enter the first table name: ' table1Name
38-
read -p 'Enter the second table name: ' table2Name
219+
read -p 'Enter the keyspace name: ' keyspaceName
220+
read -p 'Enter the table name: ' tableName
221+
read -p 'Enter the throughput: ' throughput
39222
40223
az group create --name $resourceGroupName --location $location
41224
az group deployment create --resource-group $resourceGroupName \
42225
--template-uri https://raw.githubusercontent.com/azure/azure-quickstart-templates/master/101-cosmosdb-cassandra/azuredeploy.json \
43-
--parameters accountName=$accountName primaryRegion=$primaryRegion secondaryRegion=$secondaryRegion keysetName=$keysetName \
44-
table1Name=$table1Name table2Name=$table2Name
226+
--parameters accountName=$accountName primaryRegion=$primaryRegion secondaryRegion=$secondaryRegion keyspaceName=$keyspaceName \
227+
tableName=$tableName throughput=$throughput
45228
46229
az cosmosdb show --resource-group $resourceGroupName --name accountName --output tsv
47230
```
48231

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

51-
52234
## Next steps
53235

54236
Here are some additional resources:

0 commit comments

Comments
 (0)