如何解决有没有办法在 azure blob 存储中按层过滤
我想列出存储在特定层中的所有文件。这是我试过的:
az storage fs file list \
--file-system 'cold-backup' \
--query "[?contains(properties.blobTier,'Cold')==\`true\`].properties.blobTier"
但它不起作用。我也只尝试过“blobTier”。没有运气。
这是我得到的错误:
为 '--query' 提供的无效 jmespath 查询:在函数 contains() 中,值的无效类型:None,预期之一:['array','string'],收到:“null”
解决方法
命令 az storage fs file list
用于 ADLS Gen2 文件系统,输出中没有 blobTier
属性,因此您无法使用它进行查询,blobTier
也应为 {{1 }} 而不是 Cool
。
如果你想用 Cold
列出文件过滤器,你可以使用 az storage blob list
,它适用于 blob 存储,但它也可以用于 ADLS Gen2 文件系统。
示例:
blobTier
如果要输出 az storage blob list --account-name '<storage-account-name>' --account-key 'xxxxxx' --container-name 'cold-backup' --query "[?properties.blobTier=='Cool']"
,请在命令中使用 blobTier
。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。