如何获取所有区域的所有 azure blob 容器的列表以及如何获取 Azure blob 容器的区域

How to get list of all azure blob containers of all regions and how to get Region of a Azure blob container

我需要帮助解决两个使用 java sdk 的问题:

  1. How to get a list of all Azure blob containers in all regions with their region name/ code?

我是否需要遍历所有存储帐户以获得 Blob 容器列表?

  1. How to get region Code of an azure account from a blobServiceClient or BlobContainerClient or BlobContainerItem?

据我所知,azure 没有容器区域,但区域与 Storage account 相关联(如果我错了请纠正我)。 如何从 blobServiceClient.

获取 storage account 的区域

我可以使用

获取帐户信息
blobServiceClient.getAccountInfo()

但是里面没有任何区域信息。

备注

我有 storage account key 用于生成 connection string 用于获得 blobServiceClient,但是无法获取该存储帐户的区域。

对于 infomation/operation 存储帐户资源(而不是存储帐户下的容器、blob 等),您可以使用管理客户端,如 sample

相关代码here。基本上列出所有存储帐户(按订阅或按资源组),然后检查其 region() 方法。