How to Create an Azure Storage Account: Step-by-Step Guide
To create a storage account in Azure, use the
az storage account create command with required parameters like --name, --resource-group, and --location. This command sets up a scalable cloud storage service for your data.Syntax
The basic command to create an Azure Storage Account uses the Azure CLI tool. You specify the storage account name, resource group, and location. Optional parameters control the account type and replication.
- az storage account create: The command to create the storage account.
--name: Unique name for your storage account.--resource-group: The resource group to contain the storage account.--location: Azure region where the account will be created.--sku: Defines the performance and replication type (e.g., Standard_LRS).--kind: Type of storage account (e.g., StorageV2 for general purpose v2).
bash
az storage account create --name <storage_account_name> --resource-group <resource_group_name> --location <location> --sku Standard_LRS --kind StorageV2
Example
This example creates a storage account named mystorageacct123 in the resource group myResourceGroup located in eastus. It uses the Standard locally-redundant storage (LRS) SKU and StorageV2 kind for general purpose storage.
bash
az storage account create --name mystorageacct123 --resource-group myResourceGroup --location eastus --sku Standard_LRS --kind StorageV2
Output
{
"accessTier": null,
"creationTime": "2024-06-01T12:00:00Z",
"customDomain": null,
"enableHttpsTrafficOnly": true,
"encryption": {
"services": {
"blob": {"enabled": true},
"file": {"enabled": true}
},
"keySource": "Microsoft.Storage"
},
"id": "/subscriptions/xxxx/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/mystorageacct123",
"kind": "StorageV2",
"location": "eastus",
"name": "mystorageacct123",
"primaryEndpoints": {
"blob": "https://mystorageacct123.blob.core.windows.net/",
"file": "https://mystorageacct123.file.core.windows.net/",
"queue": "https://mystorageacct123.queue.core.windows.net/",
"table": "https://mystorageacct123.table.core.windows.net/"
},
"primaryLocation": "eastus",
"provisioningState": "Succeeded",
"resourceGroup": "myResourceGroup",
"sku": {"name": "Standard_LRS"},
"statusOfPrimary": "available",
"tags": {},
"type": "Microsoft.Storage/storageAccounts"
}
Common Pitfalls
Common mistakes when creating an Azure Storage Account include:
- Using a storage account name that is not globally unique. The name must be between 3 and 24 characters and use only lowercase letters and numbers.
- Not specifying the correct resource group or location, which can cause deployment failures.
- Choosing an unsupported SKU or kind for your needs.
- Forgetting to install or log in to Azure CLI before running the command.
Always check your Azure CLI login status with az login and verify your resource group exists.
bash
Wrong: az storage account create --name MyStorageAccount --resource-group myResourceGroup --location eastus Right: az storage account create --name mystorageacct123 --resource-group myResourceGroup --location eastus --sku Standard_LRS --kind StorageV2
Quick Reference
Here is a quick summary of key parameters for creating an Azure Storage Account:
| Parameter | Description | Example |
|---|---|---|
| --name | Unique storage account name (3-24 lowercase letters/numbers) | mystorageacct123 |
| --resource-group | Azure resource group name | myResourceGroup |
| --location | Azure region for the account | eastus |
| --sku | Performance and replication type | Standard_LRS |
| --kind | Storage account type | StorageV2 |
Key Takeaways
Use the Azure CLI command az storage account create with required parameters to create a storage account.
Storage account names must be globally unique and lowercase with 3-24 characters.
Specify the resource group and location correctly to avoid deployment errors.
Choose the right SKU and kind based on your storage needs.
Always log in to Azure CLI with az login before creating resources.