Edit

Share via


Create an Azure storage account

An Azure storage account contains all of your Azure Storage data objects: blobs, files, queues, and tables. The storage account provides a unique namespace for your Azure Storage data that is accessible from anywhere in the world over HTTP or HTTPS. For more information about Azure storage accounts, see Storage account overview. To create a storage account specifically for use with Azure Files, see Create an SMB file share.

In this how-to article, you learn to create a storage account using the Azure portal, Azure PowerShell, Azure CLI, or an Azure Resource Manager template.

Prerequisites

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

To create an Azure storage account with PowerShell, make sure you have installed the latest Azure Az PowerShell module. See Install the Azure PowerShell module.

Next, sign in to Azure.

Sign in to your Azure subscription with the Connect-AzAccount command and follow the on-screen directions to authenticate.

PowerShell
Connect-AzAccount

Create a storage account

A storage account is an Azure Resource Manager resource. Resource Manager is the deployment and management service for Azure. For more information, see Azure Resource Manager overview.

Every Resource Manager resource, including an Azure storage account, must belong to an Azure resource group. A resource group is a logical container for grouping your Azure services. When you create a storage account, you have the option to either create a new resource group, or use an existing resource group. This how-to shows how to create a new resource group.

Storage account type parameters

When you create a storage account using PowerShell, the Azure CLI, Bicep, Azure Templates, or the Azure Developer CLI, the storage account type is specified by the kind parameter (for example, StorageV2). The performance tier and redundancy configuration are specified together by the sku or SkuName parameter (for example, Standard_GRS). The following table shows which values to use for the kind parameter and the sku or SkuName parameter to create a particular type of storage account with the desired redundancy configuration.

Type of storage account Supported redundancy configurations Supported values for the kind parameter Supported values for the sku or SkuName parameter Supports hierarchical namespace
Standard general-purpose v2 LRS / GRS / RA-GRS / ZRS / GZRS / RA-GZRS StorageV2 Standard_LRS / Standard_GRS / Standard_RAGRS/ Standard_ZRS / Standard_GZRS / Standard_RAGZRS Yes
Premium block blobs LRS / ZRS BlockBlobStorage Premium_LRS / Premium_ZRS Yes
Premium file shares LRS / ZRS FileStorage Premium_LRS / Premium_ZRS No
Premium page blobs LRS StorageV2 Premium_LRS No
Legacy standard general-purpose v1 LRS / GRS / RA-GRS Storage Standard_LRS / Standard_GRS / Standard_RAGRS No
Legacy blob storage LRS / GRS / RA-GRS BlobStorage Standard_LRS / Standard_GRS / Standard_RAGRS No

To create a general-purpose v2 storage account with PowerShell, first create a new resource group by calling the New-AzResourceGroup command:

Azure PowerShell
$resourceGroup = "<resource-group>"
$location = "<location>"
New-AzResourceGroup -Name $resourceGroup -Location $location

If you're not sure which region to specify for the -Location parameter, you can retrieve a list of supported regions for your subscription with the Get-AzLocation command:

Azure PowerShell
Get-AzLocation | select Location

Next, create a standard general-purpose v2 storage account with read-access geo-redundant storage (RA-GRS) by using the New-AzStorageAccount command. Remember that the name of your storage account must be unique across Azure, so replace the placeholder value in brackets with your own unique value:

Azure PowerShell
New-AzStorageAccount -ResourceGroupName $resourceGroup `
  -Name <account-name> `
  -Location $location `
  -SkuName Standard_RAGRS `
  -Kind StorageV2 `
  -AllowBlobPublicAccess $false `
  -MinimumTlsVersion TLS1_2

To create an account with Azure DNS zone endpoints (preview), follow these steps:

  1. Register for the preview as described in Azure DNS zone endpoints (preview).

  2. Make sure you have the latest version of PowerShellGet installed.

    Azure PowerShell
    Install-Module PowerShellGet -Repository PSGallery -Force
    
  3. Close and reopen the PowerShell console.

  4. Install version 4.4.2-preview or later of the Az.Storage PowerShell module. You might need to uninstall other versions of the PowerShell module. For more information about installing Azure PowerShell, see Install Azure PowerShell with PowerShellGet.

    Azure PowerShell
    Install-Module Az.Storage -Repository PsGallery -RequiredVersion 4.4.2-preview -AllowClobber -AllowPrerelease -Force
    

Next, create the account, specifying AzureDnsZone for the -DnsEndpointType parameter. After the account is created, you can see the service endpoints by getting the PrimaryEndpoints and SecondaryEndpoints properties for the storage account.

Azure PowerShell
$rgName = "<resource-group>"
$accountName = "<storage-account>"

$account = New-AzStorageAccount -ResourceGroupName $rgName `
          -Name $accountName `
          -SkuName Standard_RAGRS `
          -Location <location> `
          -Kind StorageV2 `
          -AllowBlobPublicAccess $false `
          -MinimumTlsVersion TLS1_2 `
          -DnsEndpointType AzureDnsZone

$account.PrimaryEndpoints
$account.SecondaryEndpoints 

To enable a hierarchical namespace for the storage account to use Azure Data Lake Storage, set the EnableHierarchicalNamespace parameter to $True on the call to the New-AzStorageAccount command.

The following table shows which values to use for the SkuName and Kind parameters to create a particular type of storage account with the desired redundancy configuration.

Delete a storage account

Deleting a storage account deletes the entire account, including all data in the account. Be sure to back up any data you want to save before you delete the account.

Under certain circumstances, a deleted storage account might be recovered, but recovery is not guaranteed. For more information, see Recover a deleted storage account.

If you try to delete a storage account associated with an Azure virtual machine, you might get an error about the storage account still being in use. For help with troubleshooting this error, see Troubleshoot errors when you delete storage accounts.

To delete the storage account, use the Remove-AzStorageAccount command:

PowerShell
Remove-AzStorageAccount -Name <storage-account> -ResourceGroupName <resource-group>

Alternately, you can delete the resource group, which deletes the storage account and any other resources in that resource group. For more information about deleting a resource group, see Delete resource group and resources.

Create a general purpose v1 storage account

Note

Although Microsoft recommends general-purpose v2 accounts for most scenarios, Microsoft will continue to support general-purpose v1 accounts for new and existing customers. You can create general-purpose v1 storage accounts in new regions whenever Azure Storage is available in those regions. Microsoft does not currently have a plan to deprecate support for general-purpose v1 accounts and will provide at least one year's advance notice before deprecating any Azure Storage feature. Microsoft will continue to provide security updates for general-purpose v1 accounts, but no new feature development is expected for this account type.

For new Azure regions that have come online after October 1, 2020, pricing for general-purpose v1 accounts has changed and is equivalent to pricing for general-purpose v2 accounts in those regions. Pricing for general-purpose v1 accounts in Azure regions that existed prior to October 1, 2020 has not changed. For pricing details for general-purpose v1 accounts in a specific region, see the Azure Storage pricing page. Choose your region, and then next to Pricing offers, select Other.

General purpose v1 (GPv1) storage accounts can no longer be created from the Azure portal. If you need to create a GPv1 storage account, follow the steps in section Create a storage account for PowerShell, the Azure CLI, Bicep, or Azure Templates. For the kind parameter, specify Storage, and choose a sku or SkuName from the table of supported values.

Next steps