2021-10-05 17:51:12 +01:00
|
|
|
# az storage blob
|
|
|
|
|
|
|
|
> Manage blob storage containers and objects in Azure.
|
2023-10-15 08:42:29 +01:00
|
|
|
> Part of `azure-cli` (also known as `az`).
|
2022-10-04 16:06:23 +01:00
|
|
|
> More information: <https://learn.microsoft.com/cli/azure/storage/blob>.
|
2021-10-05 17:51:12 +01:00
|
|
|
|
2024-02-09 14:34:08 +00:00
|
|
|
- Download a blob to a [f]ile path specifying a [s]ource container:
|
2021-10-05 17:51:12 +01:00
|
|
|
|
|
|
|
`az storage blob download --account-name {{storage_account_name}} --account-key {{storage_account_key}} -c {{container_name}} -n {{path/to/blob}} -f {{path/to/local_file}}`
|
|
|
|
|
2024-02-09 14:34:08 +00:00
|
|
|
- [d]ownload blobs from a blob container recursively:
|
2021-10-05 17:51:12 +01:00
|
|
|
|
|
|
|
`az storage blob download-batch --account-name {{storage_account_name}} --account-key {{storage_account_key}} -s {{container_name}} -d {{path/to/remote}} --pattern {{filename_regex}} --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}} -n {{path/to/blob}} -f {{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}} -n {{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}} -n {{path/to/blob}} --permissions {{permission_set}} --expiry {{Y-m-d'T'H:M'Z'}} --https-only`
|