Skip to main content
Jorge Bernhardt Jorge Bernhardt
  1. Posts/

How to create a Storage Account in Microsoft Azure

·765 words·4 mins· 100 views · 5 likes ·
Azure CLI Azure PowerShell Get-AzureRmLocation Get-AzureRmResourceGroup

This post is part of a series in which I will show how to create different resources in Microsoft Azure. Today I will show you how to create an essential component: a Storage Account.

An Azure storage account provides a unique namespace in the cloud to store and access your data objects in Azure Storage. A storage account contains any blobs, files, queues, tables, and disks that you create under that account.

This tutorial assumes that you already have a Microsoft Azure account set up.

Azure PowerShell Workaround>

Azure PowerShell Workaround #

If you want to know how to install the PowerShell Azure module on your machine, check out this link. The simplest way to get started is to sign in interactively at the command line.

Login-AzureRmAccount

This cmdlet will bring up a dialog box prompting you for your email address and password associated with your Azure account. If you have more than one subscription associated with your mail account, you can choose the default subscription. To perform this task, we will use the following commands:

Get-AzureRmSubscription
Select-AzureRmSubscription -Subscription "My Subscription"

Once you set your default subscription, you are ready to create a Storage Account with the New-AzureRmStorageAccount cmdlet.

New-AzureRmStorageAccount
To create a Storage Account with PowerShell, use the New-AzureRmStorageAccount cmdlet with the following syntax:

New-AzureRmStorageAccount `
    -Name <String> `
    -ResourceGroupName <String> `
    -Location <String> `
    -SkuName  <String>
-Name Parameter>

-Name Parameter #

When selecting your storage account name, remember these rules:

  • Storage account names must be between 3 and 24 characters in length and may only contain numbers and lowercase letters.
  • Your storage account name must be unique within Azure. No two storage accounts can have the same name.

You can check if the name of an Azure Storage account is valid and available to use with the Get-AzureRmStorageAccountNameAvailability cmdlet.

Get-AzureRmStorageAccountNameAvailability `
    -Name 'storagename'
-ResourceGroupName Parameter>

-ResourceGroupName Parameter #

With the following command in PowerShell, we obtain the list of existing resource groups in your subscription.

Get-AzureRmResourceGroup `
    | Select-Object ResourceGroupName, Location

Get-AzureRmResourceGroup
If you need to create a new resource group, check out this link.

-Location Parameter>

-Location Parameter #

With the following cmdlet in PowerShell, we obtain the list of existing locations in Azure.

Get-AzureRmLocation `
    | Select-Object DisplayName, Location

-SkuName Parameter>

-SkuName Parameter #

The SKU name is the name of the type of storage account that we are going to use. The storage account types and their names are:

  • Standard_LRS
  • Standard_ZRS
  • Standard_GRS
  • Standard_RAGRS
  • Premium_LRS

You can verify the task by running the Get-AzureRmStorageAccount cmdlet.

Get-AzureRmStorageAccount
Azure CLI Workaround>

Azure CLI Workaround #

You can use it in your browser with Azure Cloud Shell or install it on your machine. If you want to know how to install the Azure CLI, check out this link. The way to get started is to sign in interactively at the command line.

az login

This command will bring up a dialog box prompting you for your email address and password associated with your Azure account. If you have more than one subscription associated with your mail account, you can choose the default subscription. to perform this task, we will use the following commands:

az account list
az account set --subscription "Subscription Name"

To create a Storage Account with Azure CLI, use the following syntax:

az storage account create \
--name azstoragecli \
--resource-group RG-DEMOCLI \
--location westeurope \
--sku Standard_LRS
--Name Parameter>

--Name Parameter #

When selecting your storage account name, remember these rules:

  • Storage account names must be between 3 and 24 characters in length and may only contain numbers and lowercase letters.
  • Your storage account name must be unique within Azure. No two storage accounts can have the same name.
--resource-group Parameter>

--resource-group Parameter #

With the following command in Azure CLI, we obtain the list of existing resource groups in your subscription.

az group list

To create a new resource group with Azure CLI, check out this link.

--location Parameter>

--location Parameter #

With the following command, we obtain the list of existing locations in Azure.

az account list-locations
--sku Parameter>

--sku Parameter #

The SKU name is the name of the type of storage account that we are going to use. The storage account types and their names are:

  • Standard_LRS
  • Standard_ZRS
  • Standard_GRS
  • Standard_RAGRS
  • Premium_LRS

As you can see in the screenshot, you can use the online command help with the –help or -h parameter.

az storage account create &ndash;help
You can check the task by running the following command. The -g parameter indicates the Resource Group:

az storage account list \
-g RG-DEMOCLI

If you want to know more about Azure Storage Account, check out this link.