小编Dys*_*roz的帖子

为azure python delete_by_id方法获取正确的api版本

我正在研究根据附加到这些资源的标签自动删除 Azure 资源。

我正在使用 Azure SDK for python ( https://github.com/Azure/azure-sdk-for-python ) - 我找到了如何获取我的资源列表,并且我可以使用ResourceManagementClientresources.delete_by_id删除它们方法。但是,此方法需要 2 个参数 - 资源 ID(我从ResourceManagementClient列出的资源中获取)和 API 版本(每种资源类型都不同)。

如何确定应将哪个 API 版本传递给该方法?我试图在SDK的文档和代码中找到一些东西,但我无法找到合适的解决方案。

API 版本甚至可以进行硬编码,但它需要适用于所有资源类型。

当使用某些 api 版本(例如 2018-05-01)时,我收到某些资源类型的错误:

Azure Error: NoRegisteredProviderFound
Message: No registered resource provider found for location 'westeurope' and API version '['2018-05-01']' for type 'virtualMachines'. The supported api-versions are '2015-05-01-preview, 2015-06-15, 2016-03-30, 2016-04-30-preview, 2016-08-30, 2017-03-30, 2017-12-01, 2018-04-01, 2018-06-01, 2018-10-01, 2019-03-01'. The supported locations are 'eastus, eastus2, westus, centralus, northcentralus, southcentralus, northeurope, …
Run Code Online (Sandbox Code Playgroud)

python cloud api azure

4
推荐指数
1
解决办法
858
查看次数

标签 统计

api ×1

azure ×1

cloud ×1

python ×1