Create a storage account using the Azure CLI

The Azure CLI is used to create and manage Azure resources from the command line or in scripts. This Quickstart details using the Azure CLI to create an Azure Storage account.

If you don't have an Azure subscription, create a free account before you begin.

Launch Azure Cloud Shell

The Azure Cloud Shell is a free Bash shell that you can run directly within the Azure portal. It has the Azure CLI preinstalled and configured to use with your account. Click the Cloud Shell button on the menu in the upper-right of the Azure portal.

Cloud Shell

The button launches an interactive shell that you can use to run the steps in this topic:

Screenshot showing the Cloud Shell window in the portal

If you choose to install and use the CLI locally, this quickstart requires that you are running the Azure CLI version 2.0.4 or later. Run az --version to find the version. If you need to install or upgrade, see Install Azure CLI 2.0.

Create resource group

Create an Azure resource group with the az group create command. A resource group is a logical container into which Azure resources are deployed and managed. This example creates a resource group named myResourceGroup in the eastus region.

az group create \
    --name myResourceGroup \
    --location eastus

If you're unsure which region to specify for the --location parameter, you can retrieve a list of supported regions for your subscription with the az account list-locations command.

az account list-locations \
    --query "[].{Region:name}" \
    --out table

Create a general-purpose standard storage account

There are several types of storage accounts appropriate for different usage scenarios, each of which supports one or more of the storage services (blobs, files, tables, or queues). The following table details the available storage account types.

Type of storage account General-purpose Standard General-purpose Premium Blob storage, hot and cool access tiers
Services supported Blob, File, Table, Queue services Blob service Blob service
Types of blobs supported Block blobs, page blobs, append blobs Page blobs Block blobs and append blobs

Create a general-purpose standard storage account with the az storage account create command.

az storage account create \
    --name mystorageaccount \
    --resource-group myResourceGroup \
    --location eastus \
    --sku Standard_LRS \
    --encryption blob

Clean up resources

If you no longer need any of the resources in your resource group, including the storage account you created in this Quickstart, delete the resource group with the az group delete command.

az group delete --name myResourceGroup

Next steps

In this Quickstart, you created a resource group and a general-purpose standard storage account. To learn how to transfer data to and from your storage account, continue to the Blob storage Quickstart.