Skip to content

Commit

Permalink
Merge pull request Azure#4539 from WilliamAntonRohm/W-cosmos-arm-temp…
Browse files Browse the repository at this point in the history
…late

Cosmos DB combined ARM template (was Azure#4489)
  • Loading branch information
bmoore-msft committed Apr 24, 2018
2 parents dea9876 + 4eefd16 commit f040c97
Show file tree
Hide file tree
Showing 4 changed files with 95 additions and 0 deletions.
19 changes: 19 additions & 0 deletions 101-cosmosdb-create-arm-template/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Create an Azure Cosmos DB account for an API type

<a href="https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2FAzure%2Fazure-quickstart-templates%2Fmaster%2F101-cosmosdb-create-arm-template%2Fazuredeploy.json" target="_blank">
<img src="http://azuredeploy.net/deploybutton.png"/>
</a>

<a href="http://armviz.io/#/?load=https%3A%2F%2Fraw.githubusercontent.com%2FAzure%2Fazure-quickstart-templates%2Fmaster%2F101-cosmosdb-create-arm-template%2Fazuredeploy.json" target="_blank">
<img src="http://armviz.io/visualizebutton.png"/>
</a>

This template creates an Azure Cosmos DB API account with the provided API type and a generated database account name, and the offer type set to `Standard`. The API type can be one of `Cassandra`, `Gremlin`, `MongoDB`, `SQL`, or `Table`, for example:

```json
"apiType": {
"value": "Cassandra"
},
```

By not setting the optional consistency level parameter `consistencyLevel`, the account will be created with the default consistency level of `Session`. To set the consistency level to another value, see [101-create-documentdb-account-consistencypolicy](https://github.com/Azure/azure-quickstart-templates/tree/master/101-documentdb-account-consistencypolicy-create).
60 changes: 60 additions & 0 deletions 101-cosmosdb-create-arm-template/azuredeploy.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"apiType": {
"type": "string",
"metadata": {
"description": "The Azure Cosmos DB API type, by default Cassandra; otherwise one of Gremlin, MongoDB, SQL, or Table"
},
"allowedValues": [
"Cassandra",
"Gremlin",
"MongoDB",
"SQL",
"Table"
],
"defaultValue": "Cassandra"
},
"databaseAccountName": {
"type": "string",
"metadata": {
"description": "The Azure Cosmos DB account name."
}
}
},
"variables": {
"offerType": "Standard"
},
"resources": [
{
"apiVersion": "2015-04-08",
"type": "Microsoft.DocumentDB/databaseAccounts",
"kind": "[if(equals(parameters('apiType'), 'MongoDB'), 'MongoDB', 'GlobalDocumentDB')]",
"name": "[parameters('databaseAccountName')]",
"location": "[resourceGroup().location]",
"properties": {
"name": "[parameters('databaseAccountName')]",
"databaseAccountOfferType": "[variables('offerType')]",
"locations": [
{
"locationName": "[resourceGroup().location]",
"failoverPriority": 0
},
{
"locationName": "[resourceGroup().location]",
"failoverPriority": 1
}
],
"capabilities": [
{
"name": "[if(equals(parameters('apiType'), 'Cassandra'), 'EnableCassandra', if(equals(parameters('apiType'), 'Gremlin'), 'EnableGremlin', if(equals(parameters('apiType'), 'MongoDB'), '', if(equals(parameters('apiType'), 'SQL'), '', if(equals(parameters('apiType'), 'Table'), 'EnableTable', '')))))]"
}
]
},
"tags": {
"defaultExperience": "[if(equals(parameters('apiType'), 'Cassandra'), 'Cassandra', if(equals(parameters('apiType'), 'Gremlin'), 'Graph', if(equals(parameters('apiType'), 'MongoDB'), 'MongoDB', if(equals(parameters('apiType'), 'SQL'), 'DocumentDB', if(equals(parameters('apiType'), 'Table'), 'Table', '')))))]"
}
}
]
}
9 changes: 9 additions & 0 deletions 101-cosmosdb-create-arm-template/azuredeploy.parameters.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"databaseAccountName": {
"value": "GEN-UNIQUE"
}
}
}
7 changes: 7 additions & 0 deletions 101-cosmosdb-create-arm-template/metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"itemDisplayName": "Create an Azure Cosmos DB API account",
"description": "This template creates an Azure Cosmos DB API account with the provided API type and the offer type set to 'Standard'. The API type can be one of 'Cassandra', 'Gremlin', 'MongoDB', 'SQL', or 'Table'",
"summary": "Create an Azure Cosmos DB API account (Cassandra, Gremlin, MongoDB, SQL or Table)",
"githubUsername": "dmakwana",
"dateUpdated": "2018-04-12"
}

0 comments on commit f040c97

Please sign in to comment.