Skip to content

AzCopy Set Properties

Mohit Sharma edited this page Jul 4, 2022 · 2 revisions

AzCopy supports setting properties on the given location (Blob, File, ADLS Gen2) from release 10.16.0 onwards.

At present, we support setting following properties :-

Changing tier on blob

To change tier of a block blob

azcopy setprops "https://[account].blob.core.windows.net/[container]/[path/to/blob]" --block-blob-tier=[Hot/Cool/Archive]--rehydrate-priority=[Standard/High]

To change tier of a page blob

azcopy setprops "https://[account].blob.core.windows.net/[container]/[path/to/blob]" --page-blob-tier=[P10/P15/P20/P30/P4/P40/P50/P6]--rehydrate-priority=[Standard/High]

To recursively change tier of all the blobs in a directory

azcopy setprops "https://[account].blob.core.windows.net/[container]/[path/to/directory]" --recursive --block-blob-tier=[Hot/Cool/Archive]--rehydrate-priority=[Standard/High]

Note:

  • A blob in the Archive tier is offline — that is, it cannot be read or modified — until it is rehydrated. The rehydration process can take several hours and has associated costs. Please read the public documentation before proceeding.
  • The default rehydration priority is set to STANDARD.
  • If you are using DFS endpoint, it will be replaced by equivalent blob endpoints.

To learn more, refer to the public documentations here :-

Changing Blob Index Tags

To Change blob-index-tags of a blob to {key = "abc", val = "def"} and {key = "ghi", val = "jkl"}

azcopy setprops "https://[account].blob.core.windows.net/[container]/[path/to/blob]" --blob-tags=abc=def&ghi=jkl

To recursively change blob-index-tags of all the blobs in a directory, use --recursive flag.

azcopy setprops "https://[account].blob.core.windows.net/[container]/[path/to/directory]" --recursive --blob-tags=abc=def&ghi=jkl

Removing Blob Index Tags

To remove/clear existing blob-index-tags from blob

azcopy setprops "https://[account].blob.core.windows.net/[container]/[path/to/blob]" --blob-tags=clear

To recursively remove/clear existing blob-index-tags from all the blobs in a directory

azcopy setprops "https://[account].blob.core.windows.net/[container]/[path/to/directory]" --recursive --blob-tags=clear

Note:

  • Blob tags are a property of blobs only. So when setting blob tags, location must always be Blob / ADLS Gen2.
  • If you are using DFS endpoint, it will be replaced by equivalent blob endpoints.
  • Keys and values are URL encoded and the key-value pairs are separated by an ampersand('&')
  • Setting blob index tags can be performed by the Storage Blob Data Owner and by anyone with a Shared Access Signature that has permission to access the blob's tags (the t SAS permission).
  • In addition, RBAC users with the Microsoft.Storage/storageAccounts/blobServices/containers/blobs/tags/write permission can perform this operation.
  • Caution: AzCopy does not append blob-tags to existing blob-tags. The default behaviour is to clear the existing blob-tags and apply the provided blob-tags.

Changing Metadata

To change the metadata of blob to {key = "abc", val = "def"} and {key = "ghi", val = "jkl"}

azcopy setprops "https://[account].blob.core.windows.net/[container]/[path/to/blob]" --metadata=abc=def;ghi=jkl

To recursively change the metadata of all files in a directory to {key = "abc", val = "def"} and {key = "ghi", val = "jkl"}

azcopy setprops "https://[account].blob.core.windows.net/[container]/[path/to/virtual/dir]" --recursive --metadata=abc=def;ghi=jkl

Removing Metadata

To remove/clear all existing metadata from blob

azcopy setprops "https://[account].blob.core.windows.net/[container]/[path/to/blob]" --metadata=clear

To recursively remove/clear all existing metadata from all files in a directory

azcopy setprops "https://[account].blob.core.windows.net/[container]/[path/to/blob]" --recursive --metadata=clear

Note:

Clone this wiki locally