LinuxCommandLibrary

az-storage-account

Manage Azure storage accounts

TLDR

Create an storage account

$ az storage account create [[-n|--name]] [storage_account_name] [[-g|--resource-group]] [azure_resource_group] --location [azure_location] --sku [storage_account_sku]
copy

Generate a shared access signature for a specific storage account
$ az storage account generate-sas --account-name [storage_account_name] [[-n|--name]] [account_name] --permissions [sas_permissions] --expiry [expiry_date] --services [storage_services] --resource-types [resource_types]
copy

List storage accounts
$ az storage account list [[-g|--resource-group]] [azure_resource_group]
copy

Delete a specific storage account
$ az storage account delete [[-n|--name]] [storage_account_name] [[-g|--resource-group]] [azure_resource_group]
copy

SYNOPSIS

az storage account subcommand [options]

Examples:
az storage account create --name myaccountname --resource-group myresourcegroup --location eastus --sku Standard_LRS
az storage account show --name myaccountname --resource-group myresourcegroup
az storage account list --resource-group myresourcegroup
az storage account delete --name myaccountname --resource-group myresourcegroup --yes

PARAMETERS

--name / -n account_name
    The name of the storage account. Required for most operations on a specific account.

--resource-group / -g group_name
    Name of the resource group the storage account belongs to. Required for most operations.

--location / -l location
    The Azure region where the storage account will be created (e.g., 'eastus', 'westus2'). Used with 'create'.

--sku sku_name
    The storage account SKU (e.g., Standard_LRS, Standard_GRS, Premium_LRS). Used with 'create' or 'update'.

--kind kind_name
    The kind of storage account to create (e.g., StorageV2, BlobStorage, FileStorage). Used with 'create'.

--output / -o format
    Output format for the command result. Common formats include json, jsonc, table, tsv, yaml. Default is json.

--query JMESPath_string
    JMESPath query string to filter or transform the command output.

--subscription ID_or_Name
    Name or ID of the Azure subscription to use. You can configure the default subscription using `az account set`.

--verbose
    Increases logging verbosity.

--debug
    Increases logging verbosity to show all debug logs.

--help / -h
    Shows help message for the command or subcommand.

DESCRIPTION

az storage account is a command group within the Azure Command-Line Interface (Azure CLI) that provides tools for managing Azure Storage accounts. Storage accounts are core Azure services that offer highly available, durable, scalable, and redundant storage for data objects like blobs, files, queues, and tables.

This command group allows users to perform a wide range of operations, including creating new storage accounts, retrieving their properties, listing existing accounts, updating configurations (e.g., SKU, access tiers, network rules), deleting accounts, and managing associated services like blob and file service properties, encryption scopes, and private endpoint connections. It simplifies the automation and scripting of storage account management tasks directly from a command-line environment or CI/CD pipelines.

CAVEATS

Using az storage account commands requires that the Azure CLI is correctly installed and authenticated to an Azure subscription. Users must have appropriate Azure Role-Based Access Control (RBAC) permissions on the subscription or resource group to perform storage account operations.

Storage account names must be globally unique across all of Azure. Deleting a storage account is a destructive operation and will remove all data within it; confirmation is usually required unless `--yes` is specified. Creating or updating storage accounts can incur costs based on the chosen SKU, redundancy options, and data stored.

KEY SUBCOMMANDS

The az storage account group includes many subcommands for specific tasks:

  • create: Provisions a new storage account.
  • show: Retrieves details of a specific storage account.
  • list: Lists all storage accounts in a subscription or resource group.
  • update: Modifies properties of an existing storage account.
  • delete: Permanently removes a storage account.
  • network-rule: Manages IP and virtual network rules for network access.
  • show-connection-string: Displays the connection string for accessing the storage account.

SKU AND KIND CONSIDERATIONS

When creating a storage account, the --sku and --kind parameters are critical.

  • The SKU determines redundancy (LRS, GRS, ZRS, GZRS), performance tier (Standard, Premium), and replication options.
  • The Kind determines the supported features (e.g., StorageV2 for general purpose, BlobStorage for blobs only, FileStorage for premium files). Choosing the right combination impacts cost and capabilities.

HISTORY

The Azure CLI, including the az storage account command group, was developed by Microsoft as a cross-platform command-line experience for managing Azure resources. It was designed to be more consistent and user-friendly than previous Azure management tools and has been continuously updated to support new Azure services and features, including various additions to Azure Storage capabilities (e.g., private endpoints, encryption scopes, data lake features) since its initial release. It is open-source and primarily developed in Python.

SEE ALSO

az(1), az storage(1), az group(1), az resource(1)

Copied to clipboard