Using the Azure CLI to provide a storage account in Azure

MVP

 

Start the CloudShell in the Azure portal or go to the following URL: https://shell.azure.com/

Please start with the following steps to begin the deployment (the Hashtags are comments):

 

#Here you can find out which subscription you are working with
az account show

 

#View all subscriptions
az account list --all --output table

 

#change the subscription (if necessary)
az account set --subscription "Name of the Subscription"

 

#First, create a new resource group
az group create --name storage-resource-group --location westeurope

 

#If you're not sure which region to specify for the --location parameter, you can retrieve a list of supported regions for your subscription
az account list-locations --query "[].{Region:name}" --out table

 

#Next, create a general-purpose v2 storage account with read-access geo-redundant storage
az storage account create --name twstacloud2020 --resource-group storage-resource-group --location westeurope --sku Standard_RAGRS --kind StorageV2

 

Replication optionsku parameter
Locally redundant storage (LRS)Standard_LRS
Zone-redundant storage (ZRS)Standard_ZRS
Geo-redundant storage (GRS)Standard_GRS
Read-access geo-redundant storage (GRS)Standard_RAGRS
Geo-zone-redundant storage (GZRS)Standard_GZRS
Read-access geo-zone-redundant storage (RA-GZRS)Standard_RAGZRS

 

Now you have your own Storage Account deployed with the Azure CLI! Congratulations!

If you don't need the resource group (also to save costs) don't forget the clean up.

 

#Clean Up
az group delete --name storage-resource-group --yes

 

I hope this article was useful. Best regards, Tom Wechsler

 

P.S. All scripts (#PowerShell, @azure CLI, #Terraform, #ARM) that I use can be found on github! https://github.com/tomwechsler

 

0 Replies