Skip to content

Instantly share code, notes, and snippets.

@willis7
Last active July 30, 2020 13:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save willis7/5513651d44ac94ef275749191a2f890b to your computer and use it in GitHub Desktop.
Save willis7/5513651d44ac94ef275749191a2f890b to your computer and use it in GitHub Desktop.
Create a storage account on Azure for terraform
RESOURCE_GROUP_NAME=devops_tfstate
STORAGE_ACCOUNT_NAME=devops_tfstate$RANDOM
CONTAINER_NAME=github_tfstate
# Create resource group
az group create --name $RESOURCE_GROUP_NAME --location southuk
# Create storage account
az storage account create --resource-group $RESOURCE_GROUP_NAME --name $STORAGE_ACCOUNT_NAME --sku Standard_LRS --encryption-services blob
# Get storage account key
ACCOUNT_KEY=$(az storage account keys list --resource-group $RESOURCE_GROUP_NAME --account-name $STORAGE_ACCOUNT_NAME --query [0].value -o tsv)
# Create blob container
az storage container create --name $CONTAINER_NAME --account-name $STORAGE_ACCOUNT_NAME --account-key $ACCOUNT_KEY
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment