我想通过以下方式获取/检查 azure 资源ID
from azure.mgmt.resource import ResourceManagementClient
resource_client = ResourceManagementClient(credentials, subscription_id)
resource_client.resources.check_existence_by_id(
'/subscriptions/<any_subscr>/resourceGroups/random_group'
'/providers/Microsoft.Compute/virtualMachines/test_vm',
api_version='2017-12-01')
失败:
ClientRequestError: Error occurred in request., RetryError: HTTPSConnectionPool(host='management.azure.com', port=443): Max retries exceeded with url: /subscriptions/<any_subscr>/resourceGroups/random_group/providers/Microsoft.Compute/virtualMachines/test_vm?api-version=2017-12-01 (Caused by ResponseError('too many 503 error responses',))
api_version取自另一个错误。如果我尝试运行相同的命令api_version=resource_client.api_version并获得:
CloudError: Azure Error: NoRegisteredProviderFound
Message: No registered resource provider found for location 'eastus2' and API version '2017-05-10' 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'. The supported locations are 'eastus, eastus2, westus, centralus, northcentralus, southcentralus, northeurope, westeurope, eastasia, southeastasia, japaneast, japanwest, australiaeast, australiasoutheast, brazilsouth, southindia, centralindia, westindia, canadacentral, canadaeast, westus2, westcentralus, uksouth, ukwest, koreacentral, koreasouth'.
但.get_by_id()同样的api_version工作正常。
有什么问题check_existence_by_id吗?