Azure Database operations using CLI
- Create an Azure SQL for mysql using CLI with reusable script
-
Refer Here for the script created
- Exercise: Try Creating a flexible server for postgres
- Create an Azure Cosmosdb with noSQL API using CLI with reusable script
#!/bin/bash
assign_default_if_empty() {
value=$1
default=$2
if [[ -z $value ]]; then
echo $default
else
echo $value
fi
}
LOCATION=$(assign_default_if_empty $1 'eastus')
RESOURCE_GROUP=$(assign_default_if_empty $2 'cosmosdemo')
COSMOS_ACC_NAME=$(assign_default_if_empty $3 'qtcosomosdbdemo')
az group create --location $LOCATION --name $RESOURCE_GROUP
az cosmosdb create --name $COSMOS_ACC_NAME \
--resource-group $RESOURCE_GROUP
