I have the following Azure Cli command that lists the files within a given storage account and container:
az storage blob list --container-name $web --account-name mystorageaccount
When this runs it properly returns all the results in JSON format.
I would like it to restrict results returned to those items which are currently utilizing the Cold Tier storage.
e.g. Where the properties.BlobTier is set to Cold.
e.g. One of the responses returned looks like the following:
{
"content": null,
"deleted": false,
"metadata": null,
"name": "index.html",
"properties": {
"appendBlobCommittedBlockCount": null,
"blobTier": "Cold",
"blobTierChangeTime": "2019-01-11T16:50:59+00:00",
"blobTierInferred": false,
"blobType": "BlockBlob",
"contentLength": 564,
"contentRange": null,
"contentSettings": {
"cacheControl": null,
"contentDisposition": null,
"contentEncoding": null,
"contentLanguage": null,
"contentMd5": "J46oaHVXow+85uEF58la/w==",
"contentType": "text/html"
},
"copy": {
"completionTime": null,
"id": null,
"progress": null,
"source": null,
"status": null,
"statusDescription": null
},
"creationTime": "2019-01-11T15:03:18+00:00",
"deletedTime": null,
"etag": "0x8D677E4F6791B3D",
"lastModified": "2019-01-11T16:50:59+00:00",
"lease": {
"duration": null,
"state": "available",
"status": "unlocked"
},
"pageBlobSequenceNumber": null,
"remainingRetentionDays": null,
"serverEncrypted": true
},
"snapshot": null
},
The documentation for the Azure CLI's storage blob list, states it supports the global parameter --query.
Based on my reading of that document, it seems like I should be able to do the following query, but it then gives no results (And I know some items are cold):
az storage blob list --container-name $web --account-name mystorageaccount --query 'properties[?blobTier == 'Cold']'
Does anyone know what I'm doing wrong?