1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-04-21 21:22:06 +02:00
tldr/pages/common/az-storage-blob.md

1.5 KiB

az storage blob

Manage blob storage containers and objects in Azure. Part of azure-cli (also known as az). More information: https://learn.microsoft.com/cli/azure/storage/blob.

  • 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}}

  • [d]ownload 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}}

  • 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}}

  • 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}}

  • 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