diff --git a/src/azure-cli/HISTORY.rst b/src/azure-cli/HISTORY.rst index bcaa567a24e..611ff4a271d 100644 --- a/src/azure-cli/HISTORY.rst +++ b/src/azure-cli/HISTORY.rst @@ -15,6 +15,7 @@ Release History * Fix issue #11658: `az group export` command does not support `--query` and `--output` parameters * Fix issue #10279: The exit code of `az group deployment validate` is 0 when the verification fails +* Fix issue #9916: Improve the error message of the conflict between tag and other filter conditions for `az resource list` command **IoT Central** diff --git a/src/azure-cli/azure/cli/command_modules/resource/custom.py b/src/azure-cli/azure/cli/command_modules/resource/custom.py index 5d369960dbb..351efc0e14e 100644 --- a/src/azure-cli/azure/cli/command_modules/resource/custom.py +++ b/src/azure-cli/azure/cli/command_modules/resource/custom.py @@ -510,6 +510,20 @@ def _deploy_arm_template_subscription_scope(cli_ctx, def _list_resources_odata_filter_builder(resource_group_name=None, resource_provider_namespace=None, resource_type=None, name=None, tag=None, location=None): """Build up OData filter string from parameters """ + if tag is not None: + if resource_group_name: + raise IncorrectUsageError('you cannot use \'--tag\' with \'--resource-group\'' + '(If the default value for resource group is set, please use \'az configure --defaults group=""\' command to clear it first)') + if resource_provider_namespace: + raise IncorrectUsageError('you cannot use \'--tag\' with \'--namespace\'') + if resource_type: + raise IncorrectUsageError('you cannot use \'--tag\' with \'--resource-type\'') + if name: + raise IncorrectUsageError('you cannot use \'--tag\' with \'--name\'') + if location: + raise IncorrectUsageError('you cannot use \'--tag\' with \'--location\'' + '(If the default value for location is set, please use \'az configure --defaults location=""\' command to clear it first)') + filters = [] if resource_group_name: @@ -537,9 +551,6 @@ def _list_resources_odata_filter_builder(resource_group_name=None, resource_prov raise CLIError('--namespace also requires --resource-type') if tag: - if name or location: - raise IncorrectUsageError('you cannot use the tag filter with other filters') - tag_name = list(tag.keys())[0] if isinstance(tag, dict) else tag tag_value = tag[tag_name] if isinstance(tag, dict) else '' if tag_name: diff --git a/src/azure-cli/azure/cli/command_modules/resource/tests/latest/recordings/test_tag_default_location_scenario.yaml b/src/azure-cli/azure/cli/command_modules/resource/tests/latest/recordings/test_tag_default_location_scenario.yaml new file mode 100644 index 00000000000..7f2035f236b --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/resource/tests/latest/recordings/test_tag_default_location_scenario.yaml @@ -0,0 +1,703 @@ +interactions: +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - resource create + Connection: + - keep-alive + ParameterSetName: + - -g -n --resource-type --is-full-object -p + User-Agent: + - python/3.8.0 (Windows-10-10.0.18362-SP0) msrest/0.6.10 msrest_azure/0.6.2 + azure-mgmt-resource/6.0.0 Azure-SDK-For-Python AZURECLI/2.0.80 + accept-language: + - en-US + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.RecoveryServices?api-version=2019-07-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.RecoveryServices","namespace":"Microsoft.RecoveryServices","authorizations":[{"applicationId":"262044b1-e2ce-469f-a196-69ab7ada62d3","roleDefinitionId":"21CEC436-F7D0-4ADE-8AD8-FEC5668484CC"},{"applicationId":"b8340c3b-9267-498f-b21a-15d5547fd85e","roleDefinitionId":"8A00C8EA-8F1B-45A7-8F64-F4CC61EEE9B6"},{"applicationId":"3b2fa68d-a091-48c9-95be-88d572e08fb7","roleDefinitionId":"47d68fae-99c7-4c10-b9db-2316116a061e"}],"resourceTypes":[{"resourceType":"vaults","locations":["West + US","East US","North Europe","West Europe","Brazil South","East Asia","Southeast + Asia","North Central US","South Central US","Japan East","Japan West","Australia + East","Australia Southeast","Central US","East US 2","Central India","South + India","West India","Canada Central","Canada East","West Central US","West + US 2","UK South","UK West","Korea Central","Korea South","France Central","Australia + Central","South Africa North","UAE North","Switzerland North","Central US + EUAP","East US 2 EUAP"],"apiVersions":["2019-05-13-preview","2019-05-13","2018-12-20-preview","2018-07-10-preview","2018-07-10","2018-01-10","2017-07-01-preview","2017-07-01","2016-12-01","2016-08-10","2016-06-01","2016-05-01","2015-12-15","2015-12-10","2015-11-10","2015-08-15","2015-08-10","2015-06-10","2015-03-15"],"apiProfiles":[{"profileVersion":"2018-06-01-profile","apiVersion":"2018-01-10"}],"capabilities":"CrossResourceGroupResourceMove, + CrossSubscriptionResourceMove, SystemAssignedResourceIdentity, SupportsTags, + SupportsLocation"},{"resourceType":"operations","locations":[],"apiVersions":["2016-08-10","2016-06-01","2015-12-15","2015-12-10","2015-11-10","2015-08-15","2015-08-10","2015-06-10","2015-03-15"],"apiProfiles":[{"profileVersion":"2018-06-01-profile","apiVersion":"2016-08-10"}],"capabilities":"None"},{"resourceType":"locations","locations":[],"apiVersions":["2017-07-01","2016-06-01"],"apiProfiles":[{"profileVersion":"2018-06-01-profile","apiVersion":"2016-06-01"}],"capabilities":"None"},{"resourceType":"locations/backupStatus","locations":["West + US","East US","North Europe","West Europe","Brazil South","East Asia","Southeast + Asia","North Central US","South Central US","Japan East","Japan West","Australia + East","Australia Southeast","Central US","East US 2","Central India","South + India","West India","West Central US","Canada Central","Canada East","West + US 2","UK South","UK West","Korea Central","Korea South","France Central","Australia + Central","South Africa North","UAE North","Switzerland North","Central US + EUAP","East US 2 EUAP"],"apiVersions":["2017-07-01","2016-06-01"],"apiProfiles":[{"profileVersion":"2018-06-01-profile","apiVersion":"2016-06-01"}],"capabilities":"None"},{"resourceType":"locations/checkNameAvailability","locations":["West + US","East US","North Europe","West Europe","Brazil South","East Asia","Southeast + Asia","North Central US","South Central US","Japan East","Japan West","Australia + East","Australia Southeast","Central US","East US 2","Central India","South + India","West India","West Central US","Canada Central","Canada East","West + US 2","UK South","UK West","Korea Central","Korea South","France Central","Australia + Central","South Africa North","UAE North","Switzerland North","Central US + EUAP","East US 2 EUAP"],"apiVersions":["2018-01-10"],"apiProfiles":[{"profileVersion":"2018-06-01-profile","apiVersion":"2018-01-10"}],"capabilities":"None"},{"resourceType":"locations/allocatedStamp","locations":["West + US","East US","North Europe","West Europe","Brazil South","East Asia","Southeast + Asia","North Central US","South Central US","Japan East","Japan West","Australia + East","Australia Southeast","Central US","East US 2","Central India","South + India","West India","West Central US","Canada Central","Canada East","West + US 2","UK South","UK West","Korea Central","Korea South","France Central","Australia + Central","South Africa North","UAE North","Switzerland North","Central US + EUAP","East US 2 EUAP"],"apiVersions":["2016-06-01"],"apiProfiles":[{"profileVersion":"2018-06-01-profile","apiVersion":"2016-06-01"}],"capabilities":"None"},{"resourceType":"locations/allocateStamp","locations":["West + US","East US","North Europe","West Europe","Brazil South","East Asia","Southeast + Asia","North Central US","South Central US","Japan East","Japan West","Australia + East","Australia Southeast","Central US","East US 2","Central India","South + India","West India","West Central US","Canada Central","Canada East","West + US 2","UK South","UK West","Korea Central","Korea South","France Central","Australia + Central","South Africa North","UAE North","Switzerland North","Central US + EUAP","East US 2 EUAP"],"apiVersions":["2016-06-01"],"apiProfiles":[{"profileVersion":"2018-06-01-profile","apiVersion":"2016-06-01"}],"capabilities":"None"},{"resourceType":"locations/backupValidateFeatures","locations":["West + US","East US","North Europe","West Europe","Brazil South","East Asia","Southeast + Asia","North Central US","South Central US","Japan East","Japan West","Australia + East","Australia Southeast","Central US","East US 2","Central India","South + India","West India","West Central US","Canada Central","Canada East","West + US 2","UK South","UK West","Korea Central","Korea South","France Central","Australia + Central","South Africa North","UAE North","Switzerland North","Central US + EUAP","East US 2 EUAP"],"apiVersions":["2017-07-01"],"apiProfiles":[{"profileVersion":"2018-06-01-profile","apiVersion":"2017-07-01"}],"capabilities":"None"},{"resourceType":"locations/backupPreValidateProtection","locations":["West + US","East US","North Europe","West Europe","Brazil South","East Asia","Southeast + Asia","North Central US","South Central US","Japan East","Japan West","Australia + East","Australia Southeast","Central US","East US 2","Central India","South + India","West India","West Central US","Canada Central","Canada East","West + US 2","UK South","UK West","Korea Central","Korea South","France Central","Australia + Central","South Africa North","UAE North","Switzerland North","Central US + EUAP","East US 2 EUAP"],"apiVersions":["2017-07-01"],"apiProfiles":[{"profileVersion":"2018-06-01-profile","apiVersion":"2017-07-01"}],"capabilities":"None"},{"resourceType":"locations/backupCrrJobs","locations":["West + US","East US","North Europe","West Europe","Brazil South","East Asia","Southeast + Asia","North Central US","South Central US","Japan East","Japan West","Australia + East","Australia Southeast","Central US","East US 2","Central India","South + India","West India","West Central US","Canada Central","Canada East","West + US 2","UK South","UK West","Korea Central","Korea South","France Central","Australia + Central","South Africa North","UAE North","Switzerland North","Central US + EUAP","East US 2 EUAP"],"apiVersions":["2018-12-20-preview"],"apiProfiles":[{"profileVersion":"2018-06-01-profile","apiVersion":"2018-12-20-preview"}],"capabilities":"None"},{"resourceType":"locations/backupCrrJob","locations":["West + US","East US","North Europe","West Europe","Brazil South","East Asia","Southeast + Asia","North Central US","South Central US","Japan East","Japan West","Australia + East","Australia Southeast","Central US","East US 2","Central India","South + India","West India","West Central US","Canada Central","Canada East","West + US 2","UK South","UK West","Korea Central","Korea South","France Central","Australia + Central","South Africa North","UAE North","Switzerland North","Central US + EUAP","East US 2 EUAP"],"apiVersions":["2018-12-20-preview"],"apiProfiles":[{"profileVersion":"2018-06-01-profile","apiVersion":"2018-12-20-preview"}],"capabilities":"None"},{"resourceType":"locations/backupAadProperties","locations":["West + US","East US","North Europe","West Europe","Brazil South","East Asia","Southeast + Asia","North Central US","South Central US","Japan East","Japan West","Australia + East","Australia Southeast","Central US","East US 2","Central India","South + India","West India","West Central US","Canada Central","Canada East","West + US 2","UK South","UK West","Korea Central","Korea South","France Central","Australia + Central","South Africa North","UAE North","Switzerland North","Central US + EUAP","East US 2 EUAP"],"apiVersions":["2018-12-20-preview"],"apiProfiles":[{"profileVersion":"2018-06-01-profile","apiVersion":"2018-12-20-preview"}],"capabilities":"None"},{"resourceType":"locations/backupCrossRegionRestore","locations":["West + US","East US","North Europe","West Europe","Brazil South","East Asia","Southeast + Asia","North Central US","South Central US","Japan East","Japan West","Australia + East","Australia Southeast","Central US","East US 2","Central India","South + India","West India","West Central US","Canada Central","Canada East","West + US 2","UK South","UK West","Korea Central","Korea South","France Central","Australia + Central","South Africa North","UAE North","Switzerland North","Central US + EUAP","East US 2 EUAP"],"apiVersions":["2018-12-20-preview"],"apiProfiles":[{"profileVersion":"2018-06-01-profile","apiVersion":"2018-12-20-preview"}],"capabilities":"None"},{"resourceType":"locations/backupCrrOperationResults","locations":["West + US","East US","North Europe","West Europe","Brazil South","East Asia","Southeast + Asia","North Central US","South Central US","Japan East","Japan West","Australia + East","Australia Southeast","Central US","East US 2","Central India","South + India","West India","West Central US","Canada Central","Canada East","West + US 2","UK South","UK West","Korea Central","Korea South","France Central","Australia + Central","South Africa North","UAE North","Switzerland North","Central US + EUAP","East US 2 EUAP"],"apiVersions":["2018-12-20-preview"],"apiProfiles":[{"profileVersion":"2018-06-01-profile","apiVersion":"2018-12-20-preview"}],"capabilities":"None"},{"resourceType":"locations/backupCrrOperationsStatus","locations":["West + US","East US","North Europe","West Europe","Brazil South","East Asia","Southeast + Asia","North Central US","South Central US","Japan East","Japan West","Australia + East","Australia Southeast","Central US","East US 2","Central India","South + India","West India","West Central US","Canada Central","Canada East","West + US 2","UK South","UK West","Korea Central","Korea South","France Central","Australia + Central","South Africa North","UAE North","Switzerland North","Central US + EUAP","East US 2 EUAP"],"apiVersions":["2018-12-20-preview"],"apiProfiles":[{"profileVersion":"2018-06-01-profile","apiVersion":"2018-12-20-preview"}],"capabilities":"None"},{"resourceType":"backupProtectedItems","locations":["West + US","East US","North Europe","West Europe","Brazil South","East Asia","Southeast + Asia","North Central US","South Central US","Japan East","Japan West","Australia + East","Australia Southeast","Central US","East US 2","Central India","South + India","West India","West Central US","Canada Central","Canada East","West + US 2","UK South","UK West","Korea Central","Korea South","France Central","Australia + Central","South Africa North","UAE North","Switzerland North","Central US + EUAP","East US 2 EUAP"],"apiVersions":["2017-07-01-preview"],"apiProfiles":[{"profileVersion":"2018-06-01-profile","apiVersion":"2017-07-01-preview"}],"capabilities":"SupportsExtension"},{"resourceType":"replicationEligibilityResults","locations":["West + US","East US","North Europe","West Europe","Brazil South","East Asia","Southeast + Asia","North Central US","South Central US","Japan East","Japan West","Australia + East","Australia Southeast","Central US","East US 2","Central India","South + India","West India","West Central US","Canada Central","Canada East","West + US 2","UK South","UK West","Korea Central","Korea South","France Central","Australia + Central","South Africa North","UAE North","Switzerland North","Central US + EUAP","East US 2 EUAP"],"apiVersions":["2018-07-10"],"apiProfiles":[{"profileVersion":"2018-06-01-profile","apiVersion":"2018-07-10"}],"capabilities":"SupportsExtension"}],"registrationState":"Registered","registrationPolicy":"RegistrationRequired"}' + headers: + cache-control: + - no-cache + content-length: + - '12029' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 15 Jan 2020 08:04:03 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: '{"location": "westus", "properties": {}, "sku": {"name": "Standard"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - resource create + Connection: + - keep-alive + Content-Length: + - '69' + Content-Type: + - application/json; charset=utf-8 + ParameterSetName: + - -g -n --resource-type --is-full-object -p + User-Agent: + - python/3.8.0 (Windows-10-10.0.18362-SP0) msrest/0.6.10 msrest_azure/0.6.2 + azure-mgmt-resource/6.0.0 Azure-SDK-For-Python AZURECLI/2.0.80 + accept-language: + - en-US + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_tag_default_location_scenario000001/providers/Microsoft.RecoveryServices/vaults/vault-000002?api-version=2019-05-13 + response: + body: + string: '{"location":"westus","name":"vault-000002","etag":"W/\"datetime''2020-01-15T08%3A04%3A12.9979157Z''\"","properties":{"provisioningState":"Succeeded"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_tag_default_location_scenario000001/providers/Microsoft.RecoveryServices/vaults/vault-000002","type":"Microsoft.RecoveryServices/vaults","sku":{"name":"Standard"}}' + headers: + cache-control: + - no-cache + content-length: + - '460' + content-type: + - application/json + date: + - Wed, 15 Jan 2020 08:04:14 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-resource-requests: + - '199' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - resource tag + Connection: + - keep-alive + ParameterSetName: + - --ids --tags + User-Agent: + - python/3.8.0 (Windows-10-10.0.18362-SP0) msrest/0.6.10 msrest_azure/0.6.2 + azure-mgmt-resource/6.0.0 Azure-SDK-For-Python AZURECLI/2.0.80 + accept-language: + - en-US + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.RecoveryServices?api-version=2019-07-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.RecoveryServices","namespace":"Microsoft.RecoveryServices","authorizations":[{"applicationId":"262044b1-e2ce-469f-a196-69ab7ada62d3","roleDefinitionId":"21CEC436-F7D0-4ADE-8AD8-FEC5668484CC"},{"applicationId":"b8340c3b-9267-498f-b21a-15d5547fd85e","roleDefinitionId":"8A00C8EA-8F1B-45A7-8F64-F4CC61EEE9B6"},{"applicationId":"3b2fa68d-a091-48c9-95be-88d572e08fb7","roleDefinitionId":"47d68fae-99c7-4c10-b9db-2316116a061e"}],"resourceTypes":[{"resourceType":"vaults","locations":["West + US","East US","North Europe","West Europe","Brazil South","East Asia","Southeast + Asia","North Central US","South Central US","Japan East","Japan West","Australia + East","Australia Southeast","Central US","East US 2","Central India","South + India","West India","Canada Central","Canada East","West Central US","West + US 2","UK South","UK West","Korea Central","Korea South","France Central","Australia + Central","South Africa North","UAE North","Switzerland North","Central US + EUAP","East US 2 EUAP"],"apiVersions":["2019-05-13-preview","2019-05-13","2018-12-20-preview","2018-07-10-preview","2018-07-10","2018-01-10","2017-07-01-preview","2017-07-01","2016-12-01","2016-08-10","2016-06-01","2016-05-01","2015-12-15","2015-12-10","2015-11-10","2015-08-15","2015-08-10","2015-06-10","2015-03-15"],"apiProfiles":[{"profileVersion":"2018-06-01-profile","apiVersion":"2018-01-10"}],"capabilities":"CrossResourceGroupResourceMove, + CrossSubscriptionResourceMove, SystemAssignedResourceIdentity, SupportsTags, + SupportsLocation"},{"resourceType":"operations","locations":[],"apiVersions":["2016-08-10","2016-06-01","2015-12-15","2015-12-10","2015-11-10","2015-08-15","2015-08-10","2015-06-10","2015-03-15"],"apiProfiles":[{"profileVersion":"2018-06-01-profile","apiVersion":"2016-08-10"}],"capabilities":"None"},{"resourceType":"locations","locations":[],"apiVersions":["2017-07-01","2016-06-01"],"apiProfiles":[{"profileVersion":"2018-06-01-profile","apiVersion":"2016-06-01"}],"capabilities":"None"},{"resourceType":"locations/backupStatus","locations":["West + US","East US","North Europe","West Europe","Brazil South","East Asia","Southeast + Asia","North Central US","South Central US","Japan East","Japan West","Australia + East","Australia Southeast","Central US","East US 2","Central India","South + India","West India","West Central US","Canada Central","Canada East","West + US 2","UK South","UK West","Korea Central","Korea South","France Central","Australia + Central","South Africa North","UAE North","Switzerland North","Central US + EUAP","East US 2 EUAP"],"apiVersions":["2017-07-01","2016-06-01"],"apiProfiles":[{"profileVersion":"2018-06-01-profile","apiVersion":"2016-06-01"}],"capabilities":"None"},{"resourceType":"locations/checkNameAvailability","locations":["West + US","East US","North Europe","West Europe","Brazil South","East Asia","Southeast + Asia","North Central US","South Central US","Japan East","Japan West","Australia + East","Australia Southeast","Central US","East US 2","Central India","South + India","West India","West Central US","Canada Central","Canada East","West + US 2","UK South","UK West","Korea Central","Korea South","France Central","Australia + Central","South Africa North","UAE North","Switzerland North","Central US + EUAP","East US 2 EUAP"],"apiVersions":["2018-01-10"],"apiProfiles":[{"profileVersion":"2018-06-01-profile","apiVersion":"2018-01-10"}],"capabilities":"None"},{"resourceType":"locations/allocatedStamp","locations":["West + US","East US","North Europe","West Europe","Brazil South","East Asia","Southeast + Asia","North Central US","South Central US","Japan East","Japan West","Australia + East","Australia Southeast","Central US","East US 2","Central India","South + India","West India","West Central US","Canada Central","Canada East","West + US 2","UK South","UK West","Korea Central","Korea South","France Central","Australia + Central","South Africa North","UAE North","Switzerland North","Central US + EUAP","East US 2 EUAP"],"apiVersions":["2016-06-01"],"apiProfiles":[{"profileVersion":"2018-06-01-profile","apiVersion":"2016-06-01"}],"capabilities":"None"},{"resourceType":"locations/allocateStamp","locations":["West + US","East US","North Europe","West Europe","Brazil South","East Asia","Southeast + Asia","North Central US","South Central US","Japan East","Japan West","Australia + East","Australia Southeast","Central US","East US 2","Central India","South + India","West India","West Central US","Canada Central","Canada East","West + US 2","UK South","UK West","Korea Central","Korea South","France Central","Australia + Central","South Africa North","UAE North","Switzerland North","Central US + EUAP","East US 2 EUAP"],"apiVersions":["2016-06-01"],"apiProfiles":[{"profileVersion":"2018-06-01-profile","apiVersion":"2016-06-01"}],"capabilities":"None"},{"resourceType":"locations/backupValidateFeatures","locations":["West + US","East US","North Europe","West Europe","Brazil South","East Asia","Southeast + Asia","North Central US","South Central US","Japan East","Japan West","Australia + East","Australia Southeast","Central US","East US 2","Central India","South + India","West India","West Central US","Canada Central","Canada East","West + US 2","UK South","UK West","Korea Central","Korea South","France Central","Australia + Central","South Africa North","UAE North","Switzerland North","Central US + EUAP","East US 2 EUAP"],"apiVersions":["2017-07-01"],"apiProfiles":[{"profileVersion":"2018-06-01-profile","apiVersion":"2017-07-01"}],"capabilities":"None"},{"resourceType":"locations/backupPreValidateProtection","locations":["West + US","East US","North Europe","West Europe","Brazil South","East Asia","Southeast + Asia","North Central US","South Central US","Japan East","Japan West","Australia + East","Australia Southeast","Central US","East US 2","Central India","South + India","West India","West Central US","Canada Central","Canada East","West + US 2","UK South","UK West","Korea Central","Korea South","France Central","Australia + Central","South Africa North","UAE North","Switzerland North","Central US + EUAP","East US 2 EUAP"],"apiVersions":["2017-07-01"],"apiProfiles":[{"profileVersion":"2018-06-01-profile","apiVersion":"2017-07-01"}],"capabilities":"None"},{"resourceType":"locations/backupCrrJobs","locations":["West + US","East US","North Europe","West Europe","Brazil South","East Asia","Southeast + Asia","North Central US","South Central US","Japan East","Japan West","Australia + East","Australia Southeast","Central US","East US 2","Central India","South + India","West India","West Central US","Canada Central","Canada East","West + US 2","UK South","UK West","Korea Central","Korea South","France Central","Australia + Central","South Africa North","UAE North","Switzerland North","Central US + EUAP","East US 2 EUAP"],"apiVersions":["2018-12-20-preview"],"apiProfiles":[{"profileVersion":"2018-06-01-profile","apiVersion":"2018-12-20-preview"}],"capabilities":"None"},{"resourceType":"locations/backupCrrJob","locations":["West + US","East US","North Europe","West Europe","Brazil South","East Asia","Southeast + Asia","North Central US","South Central US","Japan East","Japan West","Australia + East","Australia Southeast","Central US","East US 2","Central India","South + India","West India","West Central US","Canada Central","Canada East","West + US 2","UK South","UK West","Korea Central","Korea South","France Central","Australia + Central","South Africa North","UAE North","Switzerland North","Central US + EUAP","East US 2 EUAP"],"apiVersions":["2018-12-20-preview"],"apiProfiles":[{"profileVersion":"2018-06-01-profile","apiVersion":"2018-12-20-preview"}],"capabilities":"None"},{"resourceType":"locations/backupAadProperties","locations":["West + US","East US","North Europe","West Europe","Brazil South","East Asia","Southeast + Asia","North Central US","South Central US","Japan East","Japan West","Australia + East","Australia Southeast","Central US","East US 2","Central India","South + India","West India","West Central US","Canada Central","Canada East","West + US 2","UK South","UK West","Korea Central","Korea South","France Central","Australia + Central","South Africa North","UAE North","Switzerland North","Central US + EUAP","East US 2 EUAP"],"apiVersions":["2018-12-20-preview"],"apiProfiles":[{"profileVersion":"2018-06-01-profile","apiVersion":"2018-12-20-preview"}],"capabilities":"None"},{"resourceType":"locations/backupCrossRegionRestore","locations":["West + US","East US","North Europe","West Europe","Brazil South","East Asia","Southeast + Asia","North Central US","South Central US","Japan East","Japan West","Australia + East","Australia Southeast","Central US","East US 2","Central India","South + India","West India","West Central US","Canada Central","Canada East","West + US 2","UK South","UK West","Korea Central","Korea South","France Central","Australia + Central","South Africa North","UAE North","Switzerland North","Central US + EUAP","East US 2 EUAP"],"apiVersions":["2018-12-20-preview"],"apiProfiles":[{"profileVersion":"2018-06-01-profile","apiVersion":"2018-12-20-preview"}],"capabilities":"None"},{"resourceType":"locations/backupCrrOperationResults","locations":["West + US","East US","North Europe","West Europe","Brazil South","East Asia","Southeast + Asia","North Central US","South Central US","Japan East","Japan West","Australia + East","Australia Southeast","Central US","East US 2","Central India","South + India","West India","West Central US","Canada Central","Canada East","West + US 2","UK South","UK West","Korea Central","Korea South","France Central","Australia + Central","South Africa North","UAE North","Switzerland North","Central US + EUAP","East US 2 EUAP"],"apiVersions":["2018-12-20-preview"],"apiProfiles":[{"profileVersion":"2018-06-01-profile","apiVersion":"2018-12-20-preview"}],"capabilities":"None"},{"resourceType":"locations/backupCrrOperationsStatus","locations":["West + US","East US","North Europe","West Europe","Brazil South","East Asia","Southeast + Asia","North Central US","South Central US","Japan East","Japan West","Australia + East","Australia Southeast","Central US","East US 2","Central India","South + India","West India","West Central US","Canada Central","Canada East","West + US 2","UK South","UK West","Korea Central","Korea South","France Central","Australia + Central","South Africa North","UAE North","Switzerland North","Central US + EUAP","East US 2 EUAP"],"apiVersions":["2018-12-20-preview"],"apiProfiles":[{"profileVersion":"2018-06-01-profile","apiVersion":"2018-12-20-preview"}],"capabilities":"None"},{"resourceType":"backupProtectedItems","locations":["West + US","East US","North Europe","West Europe","Brazil South","East Asia","Southeast + Asia","North Central US","South Central US","Japan East","Japan West","Australia + East","Australia Southeast","Central US","East US 2","Central India","South + India","West India","West Central US","Canada Central","Canada East","West + US 2","UK South","UK West","Korea Central","Korea South","France Central","Australia + Central","South Africa North","UAE North","Switzerland North","Central US + EUAP","East US 2 EUAP"],"apiVersions":["2017-07-01-preview"],"apiProfiles":[{"profileVersion":"2018-06-01-profile","apiVersion":"2017-07-01-preview"}],"capabilities":"SupportsExtension"},{"resourceType":"replicationEligibilityResults","locations":["West + US","East US","North Europe","West Europe","Brazil South","East Asia","Southeast + Asia","North Central US","South Central US","Japan East","Japan West","Australia + East","Australia Southeast","Central US","East US 2","Central India","South + India","West India","West Central US","Canada Central","Canada East","West + US 2","UK South","UK West","Korea Central","Korea South","France Central","Australia + Central","South Africa North","UAE North","Switzerland North","Central US + EUAP","East US 2 EUAP"],"apiVersions":["2018-07-10"],"apiProfiles":[{"profileVersion":"2018-06-01-profile","apiVersion":"2018-07-10"}],"capabilities":"SupportsExtension"}],"registrationState":"Registered","registrationPolicy":"RegistrationRequired"}' + headers: + cache-control: + - no-cache + content-length: + - '12029' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 15 Jan 2020 08:04:14 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - resource tag + Connection: + - keep-alive + ParameterSetName: + - --ids --tags + User-Agent: + - python/3.8.0 (Windows-10-10.0.18362-SP0) msrest/0.6.10 msrest_azure/0.6.2 + azure-mgmt-resource/6.0.0 Azure-SDK-For-Python AZURECLI/2.0.80 + accept-language: + - en-US + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_tag_default_location_scenario000001/providers/Microsoft.RecoveryServices/vaults/vault-000002?api-version=2019-05-13 + response: + body: + string: '{"location":"westus","name":"vault-000002","etag":"W/\"datetime''2020-01-15T08%3A04%3A12.9979157Z''\"","properties":{"provisioningState":"Succeeded"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_tag_default_location_scenario000001/providers/Microsoft.RecoveryServices/vaults/vault-000002","type":"Microsoft.RecoveryServices/vaults","sku":{"name":"Standard"}}' + headers: + cache-control: + - no-cache + content-length: + - '460' + content-type: + - application/json + date: + - Wed, 15 Jan 2020 08:04:15 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: '{"tags": {"cli-test": "test"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - resource tag + Connection: + - keep-alive + Content-Length: + - '30' + Content-Type: + - application/json; charset=utf-8 + ParameterSetName: + - --ids --tags + User-Agent: + - python/3.8.0 (Windows-10-10.0.18362-SP0) msrest/0.6.10 msrest_azure/0.6.2 + azure-mgmt-resource/6.0.0 Azure-SDK-For-Python AZURECLI/2.0.80 + accept-language: + - en-US + method: PATCH + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_tag_default_location_scenario000001/providers/Microsoft.RecoveryServices/vaults/vault-000002?api-version=2019-05-13 + response: + body: + string: '{"location":"westus","name":"vault-000002","etag":"W/\"datetime''2020-01-15T08%3A04%3A16.891578Z''\"","tags":{"cli-test":"test"},"properties":{"provisioningState":"Succeeded"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_tag_default_location_scenario000001/providers/Microsoft.RecoveryServices/vaults/vault-000002","type":"Microsoft.RecoveryServices/vaults","sku":{"name":"Standard"}}' + headers: + cache-control: + - no-cache + content-length: + - '486' + content-type: + - application/json + date: + - Wed, 15 Jan 2020 08:04:19 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-resource-requests: + - '199' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - resource list + Connection: + - keep-alive + ParameterSetName: + - --tag + User-Agent: + - python/3.8.0 (Windows-10-10.0.18362-SP0) msrest/0.6.10 msrest_azure/0.6.2 + azure-mgmt-resource/6.0.0 Azure-SDK-For-Python AZURECLI/2.0.80 + accept-language: + - en-US + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resources?$filter=tagname%20eq%20%27cli-test%27%20and%20tagvalue%20eq%20%27test%27&api-version=2019-07-01 + response: + body: + string: '{"value":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_tag_default_location_scenario000001/providers/Microsoft.RecoveryServices/vaults/vault-000002","name":"vault-000002","type":"Microsoft.RecoveryServices/vaults","sku":{"name":"Standard"},"location":"westus"}]}' + headers: + cache-control: + - no-cache + content-length: + - '367' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 15 Jan 2020 08:04:20 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - resource delete + Connection: + - keep-alive + ParameterSetName: + - --id + User-Agent: + - python/3.8.0 (Windows-10-10.0.18362-SP0) msrest/0.6.10 msrest_azure/0.6.2 + azure-mgmt-resource/6.0.0 Azure-SDK-For-Python AZURECLI/2.0.80 + accept-language: + - en-US + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.RecoveryServices?api-version=2019-07-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.RecoveryServices","namespace":"Microsoft.RecoveryServices","authorizations":[{"applicationId":"262044b1-e2ce-469f-a196-69ab7ada62d3","roleDefinitionId":"21CEC436-F7D0-4ADE-8AD8-FEC5668484CC"},{"applicationId":"b8340c3b-9267-498f-b21a-15d5547fd85e","roleDefinitionId":"8A00C8EA-8F1B-45A7-8F64-F4CC61EEE9B6"},{"applicationId":"3b2fa68d-a091-48c9-95be-88d572e08fb7","roleDefinitionId":"47d68fae-99c7-4c10-b9db-2316116a061e"}],"resourceTypes":[{"resourceType":"vaults","locations":["West + US","East US","North Europe","West Europe","Brazil South","East Asia","Southeast + Asia","North Central US","South Central US","Japan East","Japan West","Australia + East","Australia Southeast","Central US","East US 2","Central India","South + India","West India","Canada Central","Canada East","West Central US","West + US 2","UK South","UK West","Korea Central","Korea South","France Central","Australia + Central","South Africa North","UAE North","Switzerland North","Central US + EUAP","East US 2 EUAP"],"apiVersions":["2019-05-13-preview","2019-05-13","2018-12-20-preview","2018-07-10-preview","2018-07-10","2018-01-10","2017-07-01-preview","2017-07-01","2016-12-01","2016-08-10","2016-06-01","2016-05-01","2015-12-15","2015-12-10","2015-11-10","2015-08-15","2015-08-10","2015-06-10","2015-03-15"],"apiProfiles":[{"profileVersion":"2018-06-01-profile","apiVersion":"2018-01-10"}],"capabilities":"CrossResourceGroupResourceMove, + CrossSubscriptionResourceMove, SystemAssignedResourceIdentity, SupportsTags, + SupportsLocation"},{"resourceType":"operations","locations":[],"apiVersions":["2016-08-10","2016-06-01","2015-12-15","2015-12-10","2015-11-10","2015-08-15","2015-08-10","2015-06-10","2015-03-15"],"apiProfiles":[{"profileVersion":"2018-06-01-profile","apiVersion":"2016-08-10"}],"capabilities":"None"},{"resourceType":"locations","locations":[],"apiVersions":["2017-07-01","2016-06-01"],"apiProfiles":[{"profileVersion":"2018-06-01-profile","apiVersion":"2016-06-01"}],"capabilities":"None"},{"resourceType":"locations/backupStatus","locations":["West + US","East US","North Europe","West Europe","Brazil South","East Asia","Southeast + Asia","North Central US","South Central US","Japan East","Japan West","Australia + East","Australia Southeast","Central US","East US 2","Central India","South + India","West India","West Central US","Canada Central","Canada East","West + US 2","UK South","UK West","Korea Central","Korea South","France Central","Australia + Central","South Africa North","UAE North","Switzerland North","Central US + EUAP","East US 2 EUAP"],"apiVersions":["2017-07-01","2016-06-01"],"apiProfiles":[{"profileVersion":"2018-06-01-profile","apiVersion":"2016-06-01"}],"capabilities":"None"},{"resourceType":"locations/checkNameAvailability","locations":["West + US","East US","North Europe","West Europe","Brazil South","East Asia","Southeast + Asia","North Central US","South Central US","Japan East","Japan West","Australia + East","Australia Southeast","Central US","East US 2","Central India","South + India","West India","West Central US","Canada Central","Canada East","West + US 2","UK South","UK West","Korea Central","Korea South","France Central","Australia + Central","South Africa North","UAE North","Switzerland North","Central US + EUAP","East US 2 EUAP"],"apiVersions":["2018-01-10"],"apiProfiles":[{"profileVersion":"2018-06-01-profile","apiVersion":"2018-01-10"}],"capabilities":"None"},{"resourceType":"locations/allocatedStamp","locations":["West + US","East US","North Europe","West Europe","Brazil South","East Asia","Southeast + Asia","North Central US","South Central US","Japan East","Japan West","Australia + East","Australia Southeast","Central US","East US 2","Central India","South + India","West India","West Central US","Canada Central","Canada East","West + US 2","UK South","UK West","Korea Central","Korea South","France Central","Australia + Central","South Africa North","UAE North","Switzerland North","Central US + EUAP","East US 2 EUAP"],"apiVersions":["2016-06-01"],"apiProfiles":[{"profileVersion":"2018-06-01-profile","apiVersion":"2016-06-01"}],"capabilities":"None"},{"resourceType":"locations/allocateStamp","locations":["West + US","East US","North Europe","West Europe","Brazil South","East Asia","Southeast + Asia","North Central US","South Central US","Japan East","Japan West","Australia + East","Australia Southeast","Central US","East US 2","Central India","South + India","West India","West Central US","Canada Central","Canada East","West + US 2","UK South","UK West","Korea Central","Korea South","France Central","Australia + Central","South Africa North","UAE North","Switzerland North","Central US + EUAP","East US 2 EUAP"],"apiVersions":["2016-06-01"],"apiProfiles":[{"profileVersion":"2018-06-01-profile","apiVersion":"2016-06-01"}],"capabilities":"None"},{"resourceType":"locations/backupValidateFeatures","locations":["West + US","East US","North Europe","West Europe","Brazil South","East Asia","Southeast + Asia","North Central US","South Central US","Japan East","Japan West","Australia + East","Australia Southeast","Central US","East US 2","Central India","South + India","West India","West Central US","Canada Central","Canada East","West + US 2","UK South","UK West","Korea Central","Korea South","France Central","Australia + Central","South Africa North","UAE North","Switzerland North","Central US + EUAP","East US 2 EUAP"],"apiVersions":["2017-07-01"],"apiProfiles":[{"profileVersion":"2018-06-01-profile","apiVersion":"2017-07-01"}],"capabilities":"None"},{"resourceType":"locations/backupPreValidateProtection","locations":["West + US","East US","North Europe","West Europe","Brazil South","East Asia","Southeast + Asia","North Central US","South Central US","Japan East","Japan West","Australia + East","Australia Southeast","Central US","East US 2","Central India","South + India","West India","West Central US","Canada Central","Canada East","West + US 2","UK South","UK West","Korea Central","Korea South","France Central","Australia + Central","South Africa North","UAE North","Switzerland North","Central US + EUAP","East US 2 EUAP"],"apiVersions":["2017-07-01"],"apiProfiles":[{"profileVersion":"2018-06-01-profile","apiVersion":"2017-07-01"}],"capabilities":"None"},{"resourceType":"locations/backupCrrJobs","locations":["West + US","East US","North Europe","West Europe","Brazil South","East Asia","Southeast + Asia","North Central US","South Central US","Japan East","Japan West","Australia + East","Australia Southeast","Central US","East US 2","Central India","South + India","West India","West Central US","Canada Central","Canada East","West + US 2","UK South","UK West","Korea Central","Korea South","France Central","Australia + Central","South Africa North","UAE North","Switzerland North","Central US + EUAP","East US 2 EUAP"],"apiVersions":["2018-12-20-preview"],"apiProfiles":[{"profileVersion":"2018-06-01-profile","apiVersion":"2018-12-20-preview"}],"capabilities":"None"},{"resourceType":"locations/backupCrrJob","locations":["West + US","East US","North Europe","West Europe","Brazil South","East Asia","Southeast + Asia","North Central US","South Central US","Japan East","Japan West","Australia + East","Australia Southeast","Central US","East US 2","Central India","South + India","West India","West Central US","Canada Central","Canada East","West + US 2","UK South","UK West","Korea Central","Korea South","France Central","Australia + Central","South Africa North","UAE North","Switzerland North","Central US + EUAP","East US 2 EUAP"],"apiVersions":["2018-12-20-preview"],"apiProfiles":[{"profileVersion":"2018-06-01-profile","apiVersion":"2018-12-20-preview"}],"capabilities":"None"},{"resourceType":"locations/backupAadProperties","locations":["West + US","East US","North Europe","West Europe","Brazil South","East Asia","Southeast + Asia","North Central US","South Central US","Japan East","Japan West","Australia + East","Australia Southeast","Central US","East US 2","Central India","South + India","West India","West Central US","Canada Central","Canada East","West + US 2","UK South","UK West","Korea Central","Korea South","France Central","Australia + Central","South Africa North","UAE North","Switzerland North","Central US + EUAP","East US 2 EUAP"],"apiVersions":["2018-12-20-preview"],"apiProfiles":[{"profileVersion":"2018-06-01-profile","apiVersion":"2018-12-20-preview"}],"capabilities":"None"},{"resourceType":"locations/backupCrossRegionRestore","locations":["West + US","East US","North Europe","West Europe","Brazil South","East Asia","Southeast + Asia","North Central US","South Central US","Japan East","Japan West","Australia + East","Australia Southeast","Central US","East US 2","Central India","South + India","West India","West Central US","Canada Central","Canada East","West + US 2","UK South","UK West","Korea Central","Korea South","France Central","Australia + Central","South Africa North","UAE North","Switzerland North","Central US + EUAP","East US 2 EUAP"],"apiVersions":["2018-12-20-preview"],"apiProfiles":[{"profileVersion":"2018-06-01-profile","apiVersion":"2018-12-20-preview"}],"capabilities":"None"},{"resourceType":"locations/backupCrrOperationResults","locations":["West + US","East US","North Europe","West Europe","Brazil South","East Asia","Southeast + Asia","North Central US","South Central US","Japan East","Japan West","Australia + East","Australia Southeast","Central US","East US 2","Central India","South + India","West India","West Central US","Canada Central","Canada East","West + US 2","UK South","UK West","Korea Central","Korea South","France Central","Australia + Central","South Africa North","UAE North","Switzerland North","Central US + EUAP","East US 2 EUAP"],"apiVersions":["2018-12-20-preview"],"apiProfiles":[{"profileVersion":"2018-06-01-profile","apiVersion":"2018-12-20-preview"}],"capabilities":"None"},{"resourceType":"locations/backupCrrOperationsStatus","locations":["West + US","East US","North Europe","West Europe","Brazil South","East Asia","Southeast + Asia","North Central US","South Central US","Japan East","Japan West","Australia + East","Australia Southeast","Central US","East US 2","Central India","South + India","West India","West Central US","Canada Central","Canada East","West + US 2","UK South","UK West","Korea Central","Korea South","France Central","Australia + Central","South Africa North","UAE North","Switzerland North","Central US + EUAP","East US 2 EUAP"],"apiVersions":["2018-12-20-preview"],"apiProfiles":[{"profileVersion":"2018-06-01-profile","apiVersion":"2018-12-20-preview"}],"capabilities":"None"},{"resourceType":"backupProtectedItems","locations":["West + US","East US","North Europe","West Europe","Brazil South","East Asia","Southeast + Asia","North Central US","South Central US","Japan East","Japan West","Australia + East","Australia Southeast","Central US","East US 2","Central India","South + India","West India","West Central US","Canada Central","Canada East","West + US 2","UK South","UK West","Korea Central","Korea South","France Central","Australia + Central","South Africa North","UAE North","Switzerland North","Central US + EUAP","East US 2 EUAP"],"apiVersions":["2017-07-01-preview"],"apiProfiles":[{"profileVersion":"2018-06-01-profile","apiVersion":"2017-07-01-preview"}],"capabilities":"SupportsExtension"},{"resourceType":"replicationEligibilityResults","locations":["West + US","East US","North Europe","West Europe","Brazil South","East Asia","Southeast + Asia","North Central US","South Central US","Japan East","Japan West","Australia + East","Australia Southeast","Central US","East US 2","Central India","South + India","West India","West Central US","Canada Central","Canada East","West + US 2","UK South","UK West","Korea Central","Korea South","France Central","Australia + Central","South Africa North","UAE North","Switzerland North","Central US + EUAP","East US 2 EUAP"],"apiVersions":["2018-07-10"],"apiProfiles":[{"profileVersion":"2018-06-01-profile","apiVersion":"2018-07-10"}],"capabilities":"SupportsExtension"}],"registrationState":"Registered","registrationPolicy":"RegistrationRequired"}' + headers: + cache-control: + - no-cache + content-length: + - '12029' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 15 Jan 2020 08:04:22 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - resource delete + Connection: + - keep-alive + Content-Length: + - '0' + ParameterSetName: + - --id + User-Agent: + - python/3.8.0 (Windows-10-10.0.18362-SP0) msrest/0.6.10 msrest_azure/0.6.2 + azure-mgmt-resource/6.0.0 Azure-SDK-For-Python AZURECLI/2.0.80 + accept-language: + - en-US + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_tag_default_location_scenario000001/providers/Microsoft.RecoveryServices/vaults/vault-000002?api-version=2019-05-13 + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Wed, 15 Jan 2020 08:04:28 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-resource-requests: + - '199' + status: + code: 200 + message: OK +version: 1 diff --git a/src/azure-cli/azure/cli/command_modules/resource/tests/latest/test_resource.py b/src/azure-cli/azure/cli/command_modules/resource/tests/latest/test_resource.py index 9d210b694f3..564ddd68446 100644 --- a/src/azure-cli/azure/cli/command_modules/resource/tests/latest/test_resource.py +++ b/src/azure-cli/azure/cli/command_modules/resource/tests/latest/test_resource.py @@ -9,6 +9,7 @@ import mock import unittest +from azure.cli.core.parser import IncorrectUsageError from azure_devtools.scenario_tests.const import MOCKED_SUBSCRIPTION_ID from azure_devtools.scenario_tests import AllowLargeResponse from azure.cli.testsdk import ScenarioTest, LiveScenarioTest, ResourceGroupPreparer, create_random_name, live_only, record_only @@ -318,6 +319,55 @@ def test_tag_update_by_patch(self, resource_group, resource_group_location): self.cmd('resource delete --id {vault_id}', checks=self.is_empty()) + @ResourceGroupPreparer(name_prefix='cli_test_tag_default_location_scenario', location='westus') + def test_tag_default_location_scenario(self, resource_group, resource_group_location): + + self.kwargs.update({ + 'loc': resource_group_location, + 'vault': self.create_random_name('vault-', 30), + 'tag': 'cli-test=test' + }) + + resource = self.cmd( + 'resource create -g {rg} -n {vault} --resource-type Microsoft.RecoveryServices/vaults --is-full-object -p ' + '"{{\\"properties\\":{{}},\\"location\\":\\"{loc}\\",\\"sku\\":{{\\"name\\":\\"Standard\\"}}}}"', + checks=self.check('name', '{vault}')).get_output_in_json() + + self.kwargs['vault_id'] = resource['id'] + + self.cmd('resource tag --ids {vault_id} --tags {tag}', checks=self.check('tags', {'cli-test': 'test'})) + + # Scenarios with default location + self.cmd('configure --defaults location={loc}') + + with self.assertRaises(IncorrectUsageError): + self.cmd('resource list --tag {tag}') + + with self.assertRaises(IncorrectUsageError): + self.cmd('resource list --tag {tag} -l westus') + + with self.assertRaises(IncorrectUsageError): + self.cmd('resource list --tag {tag} --l westus') + + with self.assertRaises(IncorrectUsageError): + self.cmd('resource list --tag {tag} --location westus') + + # Scenarios without default location + self.cmd('configure --defaults location=""') + + self.cmd('resource list --tag {tag}', checks=self.check('[0].id', '{vault_id}')) + + with self.assertRaises(IncorrectUsageError): + self.cmd('resource list --tag {tag} -l westus') + + with self.assertRaises(IncorrectUsageError): + self.cmd('resource list --tag {tag} --l westus') + + with self.assertRaises(IncorrectUsageError): + self.cmd('resource list --tag {tag} --location westus') + + self.cmd('resource delete --id {vault_id}', checks=self.is_empty()) + class ProviderRegistrationTest(ScenarioTest):