-
Notifications
You must be signed in to change notification settings - Fork 222
How to use blob index tag feature in AzCopy
Blob index tags categorize data in your storage account using key-value tag attributes. These tags are automatically indexed and exposed as a searchable multi-dimensional index to easily find data. This article shows you how to set, get, and find data using blob index tags.
As mentioned above, tags are key-value pair. So, to set tags
- key = "bla bla", value = "foo" and
- key = "bla bla 2", value = "bar"
you can use the following syntax :
azcopy cp "/source/path" "https://[account].blob.core.windows.net/[container]/[path/to/directory]?[SAS]" --blob-tags="bla%20bla=foo&bla%20bla%202=bar"
We also support s2s-preserve-blob-tags
flags when use wishes to preserve blob tags from source to destination. Needless to say that in this scenario source must always be a blob storage. To copy blobs from one blob storage to another and preserve the tags from source, use the following syntax :
azcopy cp "https://[account].blob.core.windows.net/[source_container]/[path/to/directory]?[SAS]" "https://[account].blob.core.windows.net/[destination_container]/[path/to/directory]?[SAS]" --s2s-preserve-blob-tags=true
- Please note that tags are a property of blobs only. So when setting blobs, destination must always be a blob store.
- Keys and values are URL encoded and the key-value pairs are separated by an ampersand('&')
- While setting tags on the blobs, there are additional permissions('t' for tags) in SAS without which the service will give authorization error back.
- Source can be a file or a folder or a remote source. But when source path points to a local folder or remote source containing multiple files, all the blobs thus copied will have the same tags specified by the command.
- When performing service to service copy, we do not preserve blob tags at source location unless specified explicitly. We set tags only when specified by the user explicitly through the command.
- For more information on tags, please refer to Blob Index Tags, Set Tags API, Get Tags API, and Find Blobs by Tags API
- AzCopy sets tags during upload/transfer itself but if the size of tags is more than 2000B, it is required to make additional
SetTags
API call which will incur extra charges. Please refer to official documentation for more information.