forked from Azure-Samples/azure-cli-samples
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
25f15da
commit 1e93dba
Showing
5 changed files
with
103 additions
and
101 deletions.
There are no files selected for viewing
96 changes: 48 additions & 48 deletions
96
cosmosdb/create-cosmosdb-mongodb-account/create-cosmosdb-mongodb-account.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,48 @@ | ||
#!/bin/bash | ||
|
||
# Generate a unique 10 character alphanumeric string to ensure unique resource names | ||
uniqueId=$(env LC_CTYPE=C tr -dc 'a-z0-9' < /dev/urandom | fold -w 10 | head -n 1) | ||
|
||
# Set variables for the new MongoDB API account and database | ||
resourceGroupName='myResourceGroup' | ||
location='southcentralus' | ||
accountName="mycosmosaccount-$uniqueId" #needs to be lower case | ||
databaseName='myDatabase' | ||
collectionName='myCollection' | ||
partitionKeyPath='/myPartitionKey' #property to partition data on | ||
throughput=400 | ||
|
||
|
||
# Create a resource group | ||
az group create \ | ||
--name $resourceGroupName \ | ||
--location $location | ||
|
||
|
||
# Create a MongoDB API Cosmos account with consistent prefix (Local) consistency, | ||
# multi-master enabled with replicas in two regions | ||
az cosmosdb create \ | ||
--resource-group $resourceGroupName \ | ||
--name $accountName \ | ||
--kind MongoDB \ | ||
--locations regionName="South Central US" failoverPriority=0 \ | ||
--locations regionName="North Central US" failoverPriority=1 \ | ||
--default-consistency-level "ConsistentPrefix" \ | ||
--enable-multiple-write-locations true | ||
|
||
|
||
# Create a database | ||
az cosmosdb database create \ | ||
--resource-group $resourceGroupName \ | ||
--name $accountName \ | ||
--db-name $databaseName | ||
|
||
|
||
# Create a MongoDB collection with a partition key and 400 RU/s | ||
az cosmosdb collection create \ | ||
--resource-group $resourceGroupName \ | ||
--collection-name $collectionName \ | ||
--name $accountName \ | ||
--db-name $databaseName \ | ||
--partition-key-path $partitionKeyPath \ | ||
--throughput $throughput | ||
#!/bin/bash | ||
|
||
# Generate a unique 10 character alphanumeric string to ensure unique resource names | ||
uniqueId=$(env LC_CTYPE=C tr -dc 'a-z0-9' < /dev/urandom | fold -w 10 | head -n 1) | ||
|
||
# Set variables for the new MongoDB API account and database | ||
resourceGroupName='myResourceGroup' | ||
location='southcentralus' | ||
accountName="mycosmosaccount-$uniqueId" #needs to be lower case | ||
databaseName='myDatabase' | ||
collectionName='myCollection' | ||
partitionKeyPath='/myPartitionKey' #property to partition data on | ||
throughput=400 | ||
|
||
|
||
# Create a resource group | ||
az group create \ | ||
--name $resourceGroupName \ | ||
--location $location | ||
|
||
|
||
# Create a MongoDB API Cosmos account with consistent prefix (Local) consistency, | ||
# multi-master enabled with replicas in two regions | ||
az cosmosdb create \ | ||
--resource-group $resourceGroupName \ | ||
--name $accountName \ | ||
--kind MongoDB \ | ||
--locations regionName="South Central US" failoverPriority=0 \ | ||
--locations regionName="North Central US" failoverPriority=1 \ | ||
--default-consistency-level "ConsistentPrefix" \ | ||
--enable-multiple-write-locations true | ||
|
||
|
||
# Create a database | ||
az cosmosdb database create \ | ||
--resource-group $resourceGroupName \ | ||
--name $accountName \ | ||
--db-name $databaseName | ||
|
||
|
||
# Create a MongoDB collection with a partition key and 400 RU/s | ||
az cosmosdb collection create \ | ||
--resource-group $resourceGroupName \ | ||
--collection-name $collectionName \ | ||
--name $accountName \ | ||
--db-name $databaseName \ | ||
--partition-key-path $partitionKeyPath \ | ||
--throughput $throughput |
90 changes: 45 additions & 45 deletions
90
cosmosdb/create-cosmosdb-table-account/create-cosmosdb-table-account.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,45 @@ | ||
#!/bin/bash | ||
|
||
# Generate a unique 10 character alphanumeric string to ensure unique resource names | ||
uniqueId=$(env LC_CTYPE=C tr -dc 'a-z0-9' < /dev/urandom | fold -w 10 | head -n 1) | ||
|
||
# Set variables for the new Table API account, database, and table | ||
resourceGroupName='myResourceGroup' | ||
location='southcentralus' | ||
accountName="mycosmosaccount-$uniqueId" #needs to be lower case | ||
databaseName='myDatabase' | ||
tableName='myTable' | ||
throughput=400 | ||
|
||
# Create a resource group | ||
az group create \ | ||
--name $resourceGroupName \ | ||
--location $location | ||
|
||
|
||
# Create a Table API Cosmos DB account with Session level consistency | ||
# multi-master enabled with replicas in two regions | ||
az cosmosdb create \ | ||
--resource-group $resourceGroupName \ | ||
--name $accountName \ | ||
--capabilities EnableTable \ | ||
--locations regionName="South Central US" failoverPriority=0 \ | ||
--locations regionName="North Central US" failoverPriority=1 \ | ||
--default-consistency-level "Session" \ | ||
--enable-multiple-write-locations true | ||
|
||
|
||
# Create a database | ||
az cosmosdb database create \ | ||
--resource-group $resourceGroupName \ | ||
--name $accountName \ | ||
--db-name $databaseName | ||
|
||
|
||
# Create a Table API table with 400 RU/s | ||
az cosmosdb collection create \ | ||
--resource-group $resourceGroupName \ | ||
--collection-name $tableName \ | ||
--name $accountName \ | ||
--db-name $databaseName \ | ||
--throughput $throughput | ||
#!/bin/bash | ||
|
||
# Generate a unique 10 character alphanumeric string to ensure unique resource names | ||
uniqueId=$(env LC_CTYPE=C tr -dc 'a-z0-9' < /dev/urandom | fold -w 10 | head -n 1) | ||
|
||
# Set variables for the new Table API account, database, and table | ||
resourceGroupName='myResourceGroup' | ||
location='southcentralus' | ||
accountName="mycosmosaccount-$uniqueId" #needs to be lower case | ||
databaseName='myDatabase' | ||
tableName='myTable' | ||
throughput=400 | ||
|
||
# Create a resource group | ||
az group create \ | ||
--name $resourceGroupName \ | ||
--location $location | ||
|
||
|
||
# Create a Table API Cosmos DB account with Session level consistency | ||
# multi-master enabled with replicas in two regions | ||
az cosmosdb create \ | ||
--resource-group $resourceGroupName \ | ||
--name $accountName \ | ||
--capabilities EnableTable \ | ||
--locations regionName="South Central US" failoverPriority=0 \ | ||
--locations regionName="North Central US" failoverPriority=1 \ | ||
--default-consistency-level "Session" \ | ||
--enable-multiple-write-locations true | ||
|
||
|
||
# Create a database | ||
az cosmosdb database create \ | ||
--resource-group $resourceGroupName \ | ||
--name $accountName \ | ||
--db-name $databaseName | ||
|
||
|
||
# Create a Table API table with 400 RU/s | ||
az cosmosdb collection create \ | ||
--resource-group $resourceGroupName \ | ||
--collection-name $tableName \ | ||
--name $accountName \ | ||
--db-name $databaseName \ | ||
--throughput $throughput |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters