LinuxCommandLibrary

az-storage-blob

Manage Azure Storage Blobs

TLDR

Download a blob to a file path specifying a source container

$ az storage blob download --account-name [storage_account_name] --account-key [storage_account_key] [[-c|--container-name]] [container_name] [[-n|--name]] [path/to/blob] [[-f|--file]] [path/to/local_file]
copy

Download blobs from a blob container recursively
$ az storage blob download-batch --account-name [storage_account_name] --account-key [storage_account_key] [[-s|--source]] [container_name] [[-d|--destination]] [path/to/remote] --pattern [filename_regex] [[-d|--destination]] [path/to/destination]
copy

Upload a local file to blob storage
$ az storage blob upload --account-name [storage_account_name] --account-key [storage_account_key] [[-c|--container-name]] [container_name] [[-n|--name]] [path/to/blob] [[-f|--file]] [path/to/local_file]
copy

Delete a blob object
$ az storage blob delete --account-name [storage_account_name] --account-key [storage_account_key] [[-c|--container-name]] [container_name] [[-n|--name]] [path/to/blob]
copy

Generate a shared access signature for a blob
$ az storage blob generate-sas --account-name [storage_account_name] --account-key [storage_account_key] [[-c|--container-name]] [container_name] [[-n|--name]] [path/to/blob] --permissions [permission_set] --expiry [Y-m-d'T'H:M'Z'] --https-only
copy

SYNOPSIS

az storage blob [command] [arguments]

PARAMETERS

--account-key
    Account key. Key used to perform authentication with Azure Storage. Environment variable: AZURE_STORAGE_KEY

--account-name
    Account name. The name of the storage account. Environment variable: AZURE_STORAGE_ACCOUNT

--connection-string
    Storage account connection string. Environment variable: AZURE_STORAGE_CONNECTION_STRING

--sas-token
    SAS token. A Shared Access Signature (SAS). Environment variable: AZURE_STORAGE_SAS_TOKEN

--auth-mode
    The mode in which to run the command. 'login' mode falls back to key for service principal authentication information. To use 'key' mode, provide account-name and account-key or account-name and sas-token. Possible values: 'login', 'key'.

--bypass
    Bypass traffic to Azure Resource Manager. Possible values: 'AzureServices', 'Logging', 'Metrics', 'None'. Default: None.

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

--help
    Show this help message and exit.

--only-show-errors
    Only show errors, suppressing warnings.

--query
    JMESPath query string. See http://jmespath.org/ for more information and examples.

--log-level
    Increase logging verbosity. Use --debug for full debug logs. Possible values: 'CRITICAL', 'ERROR', 'INFO', 'WARNING'.

--output
    Output format. Possible values: 'json', 'jsonc', 'table', 'tsv', 'yaml', 'yamlc'.

--subscription
    Name or ID of subscription.

--verbose
    Increase logging verbosity. Use --debug for full debug logs.

DESCRIPTION

The az storage blob command is part of the Azure CLI (Command-Line Interface) tool, specifically designed for managing Blob storage within Azure Storage accounts.

It allows users to interact with Azure Blob storage services directly from the command line, providing capabilities for uploading, downloading, deleting, and managing blobs and containers. This includes setting properties, managing access tiers, and performing various other operations related to blob storage.

It is suitable for both simple tasks like uploading files and complex scenarios involving automation and scripting. The az storage blob command is a powerful tool for DevOps engineers, system administrators, and developers working with Azure Blob storage. The command provides a consistent interface and can be integrated with other Azure services through the Azure CLI.
The command requires an Azure subscription, the Azure CLI to be properly configured, and appropriate permissions to access the storage account being used.

CAVEATS

Requires Azure CLI to be configured with a valid Azure subscription and appropriate permissions to access the storage account.

SUBCOMMANDS

The az storage blob command includes subcommands for specific actions, such as:
- upload: Uploads a local file to a blob.
- download: Downloads a blob to a local file.
- delete: Deletes a blob.
- list: Lists blobs in a container.
- show: Shows blob properties.
- generate-sas: Generates SAS token

HISTORY

The az storage blob command has evolved as part of the Azure CLI, initially focusing on basic blob management and expanding over time to include more advanced features such as access tier management, encryption, and integration with other Azure services. The command helps users automate Azure storage management tasks, simplifying deployment and administration. The command is actively maintained and receives updates with new features and improvements as the Azure platform evolves.

SEE ALSO

az storage account(1), az storage container(1)

Copied to clipboard