天蓝色斑点存储CLI计数

时间:2020-05-11 08:08:20

标签: azure azure-cli

我正在测试一些脚本,需要一种方法来计算容器中有多少个blob。

我可以使用以下方式列出blob:

az storage blob list --container-name "xxx" --account-key "xxx" --account-name "xxx" -o table

但是我如何计数?

我尝试使用--query长度,但是不起作用。

1 个答案:

答案 0 :(得分:4)

如果要使用Azure CLI在一个容器中获取大量的blob,请在命令中添加--query "length(@)"

az storage blob list -c "xxx" --account-key "xxx" --account-name "xxx" --query "length(@)" -o table

enter image description here