-
Notifications
You must be signed in to change notification settings - Fork 338
/
Copy pathipfirewall.sh
26 lines (21 loc) · 978 Bytes
/
ipfirewall.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
#!/bin/bash
# Passed validation in Cloud Shell on 2/20/2022
# <FullScript>
# Create an Azure Cosmos Account with IP Firewall
# Variable block
let "randomIdentifier=$RANDOM*$RANDOM"
location="East US"
resourceGroup="msdocs-cosmosdb-rg-$randomIdentifier"
tag="ipfirewall-cosmosdb"
account="msdocs-account-cosmos-$randomIdentifier" #needs to be lower case
# Create a resource group
echo "Creating $resourceGroup in $location..."
az group create --name $resourceGroup --location "$location" --tags $tag
# Create a Cosmos DB account with default values and IP Firewall enabled
# Use appropriate values for --kind or --capabilities for other APIs
# Replace the values for the ip-range-filter with appropriate values for your environment
echo "Creating $account for CosmosDB"
az cosmosdb create --name $account --resource-group $resourceGroup --ip-range-filter '0.0.0.0','255.255.255.255'
# </FullScript>
# echo "Deleting all resources"
# az group delete --name $resourceGroup -y