-
Notifications
You must be signed in to change notification settings - Fork 338
/
Copy pathcreate.sh
30 lines (24 loc) · 1.15 KB
/
create.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/bash
# Passed validation in Cloud Shell on 2/20/2022
# <FullScript>
# Create a Table API table
# Variable block
let "randomIdentifier=$RANDOM*$RANDOM"
location="East US"
failoverLocation="South Central US"
resourceGroup="msdocs-cosmosdb-rg-$randomIdentifier"
tag="create-table-cosmosdb"
account="msdocs-account-cosmos-$randomIdentifier" #needs to be lower case
table="msdocs-table-cosmos-$randomIdentifier"
# Create a resource group
echo "Creating $resourceGroup in $location..."
az group create --name $resourceGroup --location "$location" --tags $tag
# Create a Cosmos account for Table API
echo "Creating $account"
az cosmosdb create --name $account --resource-group $resourceGroup --capabilities EnableTable --default-consistency-level Eventual --locations regionName="$location" failoverPriority=0 isZoneRedundant=False --locations regionName="$failoverLocation" failoverPriority=1 isZoneRedundant=False
# Create a Table API Table
echo "Creating $table"
az cosmosdb table create --account-name $account --resource-group $resourceGroup --name $table --throughput 400
# </FullScript>
# echo "Deleting all resources"
# az group delete --name $resourceGroup -y