Close
AlgoliaLogoLight
Close full mode
logo

Create Azure Storage Account

Git RepositoryEdit on Github

Prerequisite

  • Create an Azure account.
  • Setup Azure CLI.
  • Log in with Azure CLI.
  • Create a resource group.
  • To learn how to create all requirements step by step, please check Azure CLI content.

Create Azure Storage Account

az storage account create \
--name <STORAGE_ACCOUNT_NAME> \
--resource-group <RESOURCE_GROUP_NAME> \
--location <LOCATION_NAME> \
--sku <STORAGE_ACCOUNT_SKU> \
--kind <STORAGE_ACCOUNT_KIND> \
--access-tier <ACCESS_TIER>
  • For STORAGE_ACCOUNT_NAME, it can contain only lowercase letters and numbers and must be between 3 and 24 characters.
  • For LOCATION_NAME, use az account list-locations --output table. It is default to a location of a resource group if not specify.
  • For STORAGE_ACCOUNT_SKU, accepted values are: Premium_LRS, Premium_ZRS, Standard_GRS, Standard_GZRS, Standard_LRS, Standard_RAGRS, Standard_RAGZRS and Standard_ZRS.
    • LRS stands for locally redundant storage.
    • ZRS stands for zone redundant storage.
  • For STORAGE_ACCOUNT_KIND, accepted values are: BlobStorage, BlockBlobStorage, FileStorage, Storage, StorageV2.
  • For ACCESS_TIER, accepted values for access tier: Cool, Hot.
  • To learn more how to create storage account with CLI, please refer to Create a storage account document

Example code to create a standard general-purpose v2 storage account

$ az storage account create \
--name csexamplestorageaccount \
--resource-group codesanook-example-resource-group \
--location southeastasia \
--sku Standard_ZRS \
--kind StorageV2 \
--access-tier Hot

List all existing storage accounts

$ az storage account list \
--resource-group <RESOURCE_GROUP_NAME> \
--output table

Delete a storage account

$ az storage account delete \
--name <STORAGE_ACCOUNT_NAME> \
--resource-group <RESOURCE_GROUP_NAME>

Get connection string

$ az storage account show-connection-string \
--name <STORAGE_ACCOUNT_NAME> \
--resource-group <RESOURCE_GROUP_NAME>

Useful resources

Loading comments...