我试图在给定订阅中收集我的 Azure 资源的完整 JSON 表示,但无法弄清楚我如何枚举给定资源类型的可用子资源。
例如,我可以获得 Microsoft.Web/sites/{name} 资源,但该响应中没有任何内容告诉我 Microsoft.Web/sites/{name}/config 存在。我也无法在 Provider 对象中找到对 /config 资源的任何引用。
Azure 资源资源管理器似乎以很少的性能开销动态枚举它们,所以我相信可以做到这一点。我只是不知道怎么做。使用 azure-arm-resource nom 包的 NodeJS 示例:
// Returns a data structure, but nothing about subtypes.
let p = client.providers.get("Microsoft.Web");
// Contains the resource, but not the resources subtypes (e.g. config/appsettings
let r = client.resources.getById(resourceId, apiVersion);
我在 API 中寻找可以给我一系列子类型的东西;在 Microsoft.Web/sites 的情况下,这将类似于 ["config"、"containerlogs"、"diagnostics"...] 等。