From 00b9235e01441ebee812fc25d334381ef0132fe8 Mon Sep 17 00:00:00 2001 From: Daniel Miller Date: Mon, 27 Apr 2020 01:13:19 -0700 Subject: [PATCH 01/14] {Docs} Remove stale reference in README to closed issue about extensions (#12771) --- doc/extensions/README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/doc/extensions/README.md b/doc/extensions/README.md index 2b6d1a01aef..46dd325ddbf 100644 --- a/doc/extensions/README.md +++ b/doc/extensions/README.md @@ -12,8 +12,6 @@ What is an Extension? - Currently, we support one extension type, a [Python Wheel](http://pythonwheels.com/). - All extension documentation here refers to this type of extension. -> Extensions should be built with wheel `0.29.0` or `0.30.0` until [#6441](https://github.com/Azure/azure-cli/issues/6441) is resolved - What an Extension is not ------------------------ From dc510d6493d43e2033d24c05d7fedd98cdebd746 Mon Sep 17 00:00:00 2001 From: Jorge Cotillo Date: Fri, 15 May 2020 19:31:28 -0700 Subject: [PATCH 02/14] added new export options --- .vscode/launch.json | 6 ++--- .../cli/command_modules/resource/custom.py | 25 ++++++++++++++++--- 2 files changed, 24 insertions(+), 7 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index a3bb8f78c2a..6564a4f2b07 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -5,7 +5,7 @@ "name": "Azure CLI Debug (Integrated Console)", "type": "python", "request": "launch", - "pythonPath": "${config:python.pythonPath}", + "pythonPath": "${config:python.interpreterPath}", "program": "${workspaceRoot}/src/azure-cli/azure/cli/__main__.py", "cwd": "${workspaceRoot}", "args": [ @@ -24,7 +24,7 @@ "type": "python", "request": "launch", "stopOnEntry": true, - "pythonPath": "${config:python.pythonPath}", + "pythonPath": "${config:python.interpreterPath}", "program": "${workspaceRoot}/src/azure-cli/azure/cli/__main__.py", "cwd": "${workspaceRoot}", "args": [ @@ -40,7 +40,7 @@ "name": "Azdev Scripts", "type": "python", "request": "launch", - "pythonPath": "${config:python.pythonPath}", + "pythonPath": "${config:python.interpreterPath}", "program": "${workspaceRoot}/tools/automation/__main__.py", "cwd": "${workspaceRoot}", "args": [ 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 463ec51f1f2..6678edbf71e 100644 --- a/src/azure-cli/azure/cli/command_modules/resource/custom.py +++ b/src/azure-cli/azure/cli/command_modules/resource/custom.py @@ -1025,11 +1025,14 @@ def update_resource_group(instance, tags=None): def export_group_as_template( - cmd, resource_group_name, include_comments=False, include_parameter_default_value=False): + cmd, resource_group_name, ids=None, include_comments=False, include_parameter_default_value=False, skip_resource_name_parameterization=False, skip_all_parameterization=False): """Captures a resource group as a template. - :param str resource_group_name:the name of the resoruce group. - :param bool include_comments:export template with comments. + :param str resource_group_name: the name of the resource group. + :param str ids: the space-separated resource ids to filter the export by. To export all resources, supply '*'. + :param bool include_comments: export template with comments. :param bool include_parameter_default_value: export template parameter with default value. + :param bool skip_resource_name_parameterization: export template and skip resource name parameterization. + :param bool skip_all_parameterization: export template parameter and skip all parameterization. """ rcf = _resource_client_factory(cmd.cli_ctx) @@ -1038,10 +1041,24 @@ def export_group_as_template( export_options.append('IncludeComments') if include_parameter_default_value: export_options.append('IncludeParameterDefaultValue') + if skip_all_parameterization: + export_options.append('SkipResourceNameParameterization') + if skip_all_parameterization: + export_options.append('SkipAllParameterization') + + resources = [] + if ids is None or ids == "*": + resources = ["*"] + else: + for i in ids.split(): + if is_valid_resource_id(i): + resources.append(i) + else: + raise CLIError('az resource: error: argument --ids: invalid ResourceId value: \'%s\'' % i) options = ','.join(export_options) if export_options else None - result = rcf.resource_groups.export_template(resource_group_name, ['*'], options=options) + result = rcf.resource_groups.export_template(resource_group_name, resources, options=options) # pylint: disable=no-member # On error, server still returns 200, with details in the error attribute From b9b8fb640bd0f7132cfec8ab9eda73631cda01c8 Mon Sep 17 00:00:00 2001 From: Jorge Cotillo Date: Sun, 17 May 2020 09:28:47 -0700 Subject: [PATCH 03/14] fixed parameter reference --- src/azure-cli/azure/cli/command_modules/resource/custom.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 6678edbf71e..4000ae4b19e 100644 --- a/src/azure-cli/azure/cli/command_modules/resource/custom.py +++ b/src/azure-cli/azure/cli/command_modules/resource/custom.py @@ -1041,7 +1041,7 @@ def export_group_as_template( export_options.append('IncludeComments') if include_parameter_default_value: export_options.append('IncludeParameterDefaultValue') - if skip_all_parameterization: + if skip_resource_name_parameterization: export_options.append('SkipResourceNameParameterization') if skip_all_parameterization: export_options.append('SkipAllParameterization') From 20b80e4fa15974ec48b6428094e30cca3a7093cf Mon Sep 17 00:00:00 2001 From: Jorge Cotillo Date: Mon, 18 May 2020 15:51:50 -0700 Subject: [PATCH 04/14] renamed argument --- .../azure/cli/command_modules/resource/custom.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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 4000ae4b19e..2f1166728b7 100644 --- a/src/azure-cli/azure/cli/command_modules/resource/custom.py +++ b/src/azure-cli/azure/cli/command_modules/resource/custom.py @@ -1025,10 +1025,10 @@ def update_resource_group(instance, tags=None): def export_group_as_template( - cmd, resource_group_name, ids=None, include_comments=False, include_parameter_default_value=False, skip_resource_name_parameterization=False, skip_all_parameterization=False): + cmd, resource_group_name, resource_ids=None, include_comments=False, include_parameter_default_value=False, skip_resource_name_parameterization=False, skip_all_parameterization=False): """Captures a resource group as a template. :param str resource_group_name: the name of the resource group. - :param str ids: the space-separated resource ids to filter the export by. To export all resources, supply '*'. + :param str resource_ids: a string containing space-separated resource ids to filter the export by. To export all resources, do not specify this argument or supply "*". :param bool include_comments: export template with comments. :param bool include_parameter_default_value: export template parameter with default value. :param bool skip_resource_name_parameterization: export template and skip resource name parameterization. @@ -1047,14 +1047,14 @@ def export_group_as_template( export_options.append('SkipAllParameterization') resources = [] - if ids is None or ids == "*": + if resource_ids is None or resource_ids == "*": resources = ["*"] else: - for i in ids.split(): + for i in resource_ids.split(): if is_valid_resource_id(i): resources.append(i) else: - raise CLIError('az resource: error: argument --ids: invalid ResourceId value: \'%s\'' % i) + raise CLIError('az resource: error: argument --resource_ids: invalid ResourceId value: \'%s\'' % i) options = ','.join(export_options) if export_options else None From 2518451852920d8c5ccf2b3485877f651530d760 Mon Sep 17 00:00:00 2001 From: Jorge Cotillo Date: Mon, 18 May 2020 16:58:22 -0700 Subject: [PATCH 05/14] unit tests --- ...roup_export_skip_all_parameterization.yaml | 339 ++++++++++++++++++ ...t_skip_resource_name_parameterization.yaml | 339 ++++++++++++++++++ .../resource/tests/latest/test_resource.py | 35 ++ 3 files changed, 713 insertions(+) create mode 100644 src/azure-cli/azure/cli/command_modules/resource/tests/latest/recordings/test_resource_group_export_skip_all_parameterization.yaml create mode 100644 src/azure-cli/azure/cli/command_modules/resource/tests/latest/recordings/test_resource_group_export_skip_resource_name_parameterization.yaml diff --git a/src/azure-cli/azure/cli/command_modules/resource/tests/latest/recordings/test_resource_group_export_skip_all_parameterization.yaml b/src/azure-cli/azure/cli/command_modules/resource/tests/latest/recordings/test_resource_group_export_skip_all_parameterization.yaml new file mode 100644 index 00000000000..6080727f463 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/resource/tests/latest/recordings/test_resource_group_export_skip_all_parameterization.yaml @@ -0,0 +1,339 @@ +interactions: +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network vnet create + Connection: + - keep-alive + ParameterSetName: + - -g -n + User-Agent: + - python/3.7.7 (Windows-10-10.0.18362-SP0) msrest/0.6.9 msrest_azure/0.6.3 azure-mgmt-resource/9.0.0 + Azure-SDK-For-Python AZURECLI/2.5.1 + accept-language: + - en-US + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_rg_scenario000001?api-version=2019-07-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_rg_scenario000001","name":"cli_test_rg_scenario000001","type":"Microsoft.Resources/resourceGroups","location":"westus","tags":{"product":"azurecli","cause":"automation","date":"2020-05-18T23:46:45Z","StorageType":"testStrogae"},"properties":{"provisioningState":"Succeeded"}}' + headers: + cache-control: + - no-cache + content-length: + - '456' + content-type: + - application/json; charset=utf-8 + date: + - Mon, 18 May 2020 23:46:47 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", "tags": {}, "properties": {"addressSpace": {"addressPrefixes": + ["10.0.0.0/16"]}, "dhcpOptions": {}}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network vnet create + Connection: + - keep-alive + Content-Length: + - '123' + Content-Type: + - application/json; charset=utf-8 + ParameterSetName: + - -g -n + User-Agent: + - python/3.7.7 (Windows-10-10.0.18362-SP0) msrest/0.6.9 msrest_azure/0.6.3 azure-mgmt-network/10.1.0 + Azure-SDK-For-Python AZURECLI/2.5.1 + accept-language: + - en-US + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_rg_scenario000001/providers/Microsoft.Network/virtualNetworks/vnet1?api-version=2020-03-01 + response: + body: + string: "{\r\n \"name\": \"vnet1\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_rg_scenario000001/providers/Microsoft.Network/virtualNetworks/vnet1\",\r\n + \ \"etag\": \"W/\\\"51a90ebb-d881-483f-a680-0aa873cf1114\\\"\",\r\n \"type\": + \"Microsoft.Network/virtualNetworks\",\r\n \"location\": \"westus\",\r\n + \ \"tags\": {\r\n \"costCenter\": \"Contoso/IT/PROD/123456\"\r\n },\r\n + \ \"properties\": {\r\n \"provisioningState\": \"Updating\",\r\n \"resourceGuid\": + \"14195e14-ac7b-436f-aac3-e35a2d5ee9b5\",\r\n \"addressSpace\": {\r\n \"addressPrefixes\": + [\r\n \"10.0.0.0/16\"\r\n ]\r\n },\r\n \"dhcpOptions\": + {\r\n \"dnsServers\": []\r\n },\r\n \"subnets\": [],\r\n \"virtualNetworkPeerings\": + [],\r\n \"enableDdosProtection\": false,\r\n \"enableVmProtection\": + false\r\n }\r\n}" + headers: + azure-asyncnotification: + - Enabled + azure-asyncoperation: + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/westus/operations/7a36ec80-d2b6-44f5-b592-02c8c7c48788?api-version=2020-03-01 + cache-control: + - no-cache + content-length: + - '814' + content-type: + - application/json; charset=utf-8 + date: + - Mon, 18 May 2020 23:46:48 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-arm-service-request-id: + - b0da63d7-92ca-44de-8745-051c928e5634 + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network vnet create + Connection: + - keep-alive + ParameterSetName: + - -g -n + User-Agent: + - python/3.7.7 (Windows-10-10.0.18362-SP0) msrest/0.6.9 msrest_azure/0.6.3 azure-mgmt-network/10.1.0 + Azure-SDK-For-Python AZURECLI/2.5.1 + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/westus/operations/7a36ec80-d2b6-44f5-b592-02c8c7c48788?api-version=2020-03-01 + response: + body: + string: "{\r\n \"status\": \"Succeeded\"\r\n}" + headers: + cache-control: + - no-cache + content-length: + - '29' + content-type: + - application/json; charset=utf-8 + date: + - Mon, 18 May 2020 23:46:51 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-arm-service-request-id: + - 3298fa83-18da-40af-a357-064348d2a55b + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network vnet create + Connection: + - keep-alive + ParameterSetName: + - -g -n + User-Agent: + - python/3.7.7 (Windows-10-10.0.18362-SP0) msrest/0.6.9 msrest_azure/0.6.3 azure-mgmt-network/10.1.0 + Azure-SDK-For-Python AZURECLI/2.5.1 + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_rg_scenario000001/providers/Microsoft.Network/virtualNetworks/vnet1?api-version=2020-03-01 + response: + body: + string: "{\r\n \"name\": \"vnet1\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_rg_scenario000001/providers/Microsoft.Network/virtualNetworks/vnet1\",\r\n + \ \"etag\": \"W/\\\"ce272e45-4f5e-4a39-ac37-9544e850a08f\\\"\",\r\n \"type\": + \"Microsoft.Network/virtualNetworks\",\r\n \"location\": \"westus\",\r\n + \ \"tags\": {\r\n \"costCenter\": \"Contoso/IT/PROD/123456\"\r\n },\r\n + \ \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n \"resourceGuid\": + \"14195e14-ac7b-436f-aac3-e35a2d5ee9b5\",\r\n \"addressSpace\": {\r\n \"addressPrefixes\": + [\r\n \"10.0.0.0/16\"\r\n ]\r\n },\r\n \"dhcpOptions\": + {\r\n \"dnsServers\": []\r\n },\r\n \"subnets\": [],\r\n \"virtualNetworkPeerings\": + [],\r\n \"enableDdosProtection\": false,\r\n \"enableVmProtection\": + false\r\n }\r\n}" + headers: + cache-control: + - no-cache + content-length: + - '815' + content-type: + - application/json; charset=utf-8 + date: + - Mon, 18 May 2020 23:46:51 GMT + etag: + - W/"ce272e45-4f5e-4a39-ac37-9544e850a08f" + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-arm-service-request-id: + - a9d2e083-e9b8-449d-be56-ffa852972bdd + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network vnet show + Connection: + - keep-alive + ParameterSetName: + - -g -n + User-Agent: + - python/3.7.7 (Windows-10-10.0.18362-SP0) msrest/0.6.9 msrest_azure/0.6.3 azure-mgmt-network/10.1.0 + Azure-SDK-For-Python AZURECLI/2.5.1 + accept-language: + - en-US + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_rg_scenario000001/providers/Microsoft.Network/virtualNetworks/vnet1?api-version=2020-03-01 + response: + body: + string: "{\r\n \"name\": \"vnet1\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_rg_scenario000001/providers/Microsoft.Network/virtualNetworks/vnet1\",\r\n + \ \"etag\": \"W/\\\"ce272e45-4f5e-4a39-ac37-9544e850a08f\\\"\",\r\n \"type\": + \"Microsoft.Network/virtualNetworks\",\r\n \"location\": \"westus\",\r\n + \ \"tags\": {\r\n \"costCenter\": \"Contoso/IT/PROD/123456\"\r\n },\r\n + \ \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n \"resourceGuid\": + \"14195e14-ac7b-436f-aac3-e35a2d5ee9b5\",\r\n \"addressSpace\": {\r\n \"addressPrefixes\": + [\r\n \"10.0.0.0/16\"\r\n ]\r\n },\r\n \"dhcpOptions\": + {\r\n \"dnsServers\": []\r\n },\r\n \"subnets\": [],\r\n \"virtualNetworkPeerings\": + [],\r\n \"enableDdosProtection\": false,\r\n \"enableVmProtection\": + false\r\n }\r\n}" + headers: + cache-control: + - no-cache + content-length: + - '815' + content-type: + - application/json; charset=utf-8 + date: + - Mon, 18 May 2020 23:46:52 GMT + etag: + - W/"ce272e45-4f5e-4a39-ac37-9544e850a08f" + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-arm-service-request-id: + - d9e8d0ef-a3b2-4806-ac0f-502e62365638 + status: + code: 200 + message: OK +- request: + body: 'b''{"resources": ["/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_rg_scenario000001/providers/Microsoft.Network/virtualNetworks/vnet1"], + "options": "SkipAllParameterization"}''' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - group export + Connection: + - keep-alive + Content-Length: + - '249' + Content-Type: + - application/json; charset=utf-8 + ParameterSetName: + - --name --resource-ids --skip-all-parameterization --query + User-Agent: + - python/3.7.7 (Windows-10-10.0.18362-SP0) msrest/0.6.9 msrest_azure/0.6.3 azure-mgmt-resource/9.0.0 + Azure-SDK-For-Python AZURECLI/2.5.1 + accept-language: + - en-US + method: POST + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_rg_scenario000001/exportTemplate?api-version=2019-07-01 + response: + body: + string: '{"template":{"$schema":"https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#","contentVersion":"1.0.0.0","parameters":{},"variables":{},"resources":[{"type":"Microsoft.Network/virtualNetworks","apiVersion":"2020-03-01","name":"vnet1","location":"westus","tags":{"costCenter":"Contoso/IT/PROD/123456"},"properties":{"addressSpace":{"addressPrefixes":["10.0.0.0/16"]},"dhcpOptions":{"dnsServers":[]},"subnets":[],"virtualNetworkPeerings":[],"enableDdosProtection":false,"enableVmProtection":false}}]}}' + headers: + cache-control: + - no-cache + content-length: + - '526' + content-type: + - application/json; charset=utf-8 + date: + - Mon, 18 May 2020 23:46:53 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 +version: 1 diff --git a/src/azure-cli/azure/cli/command_modules/resource/tests/latest/recordings/test_resource_group_export_skip_resource_name_parameterization.yaml b/src/azure-cli/azure/cli/command_modules/resource/tests/latest/recordings/test_resource_group_export_skip_resource_name_parameterization.yaml new file mode 100644 index 00000000000..4c3fbfa5e09 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/resource/tests/latest/recordings/test_resource_group_export_skip_resource_name_parameterization.yaml @@ -0,0 +1,339 @@ +interactions: +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network vnet create + Connection: + - keep-alive + ParameterSetName: + - -g -n + User-Agent: + - python/3.7.7 (Windows-10-10.0.18362-SP0) msrest/0.6.9 msrest_azure/0.6.3 azure-mgmt-resource/9.0.0 + Azure-SDK-For-Python AZURECLI/2.5.1 + accept-language: + - en-US + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_rg_scenario000001?api-version=2019-07-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_rg_scenario000001","name":"cli_test_rg_scenario000001","type":"Microsoft.Resources/resourceGroups","location":"westus","tags":{"product":"azurecli","cause":"automation","date":"2020-05-18T23:46:54Z","StorageType":"testStrogae"},"properties":{"provisioningState":"Succeeded"}}' + headers: + cache-control: + - no-cache + content-length: + - '456' + content-type: + - application/json; charset=utf-8 + date: + - Mon, 18 May 2020 23:46:56 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", "tags": {}, "properties": {"addressSpace": {"addressPrefixes": + ["10.0.0.0/16"]}, "dhcpOptions": {}}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network vnet create + Connection: + - keep-alive + Content-Length: + - '123' + Content-Type: + - application/json; charset=utf-8 + ParameterSetName: + - -g -n + User-Agent: + - python/3.7.7 (Windows-10-10.0.18362-SP0) msrest/0.6.9 msrest_azure/0.6.3 azure-mgmt-network/10.1.0 + Azure-SDK-For-Python AZURECLI/2.5.1 + accept-language: + - en-US + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_rg_scenario000001/providers/Microsoft.Network/virtualNetworks/vnet1?api-version=2020-03-01 + response: + body: + string: "{\r\n \"name\": \"vnet1\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_rg_scenario000001/providers/Microsoft.Network/virtualNetworks/vnet1\",\r\n + \ \"etag\": \"W/\\\"6474a4c5-c46e-4ad3-87e7-5885ad3aa66b\\\"\",\r\n \"type\": + \"Microsoft.Network/virtualNetworks\",\r\n \"location\": \"westus\",\r\n + \ \"tags\": {\r\n \"costCenter\": \"Contoso/IT/PROD/123456\"\r\n },\r\n + \ \"properties\": {\r\n \"provisioningState\": \"Updating\",\r\n \"resourceGuid\": + \"85ad0dce-e3b6-4a7b-909d-5f9b68136d49\",\r\n \"addressSpace\": {\r\n \"addressPrefixes\": + [\r\n \"10.0.0.0/16\"\r\n ]\r\n },\r\n \"dhcpOptions\": + {\r\n \"dnsServers\": []\r\n },\r\n \"subnets\": [],\r\n \"virtualNetworkPeerings\": + [],\r\n \"enableDdosProtection\": false,\r\n \"enableVmProtection\": + false\r\n }\r\n}" + headers: + azure-asyncnotification: + - Enabled + azure-asyncoperation: + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/westus/operations/a0c13c66-3f75-4888-9e94-c5f42a5e6bfc?api-version=2020-03-01 + cache-control: + - no-cache + content-length: + - '814' + content-type: + - application/json; charset=utf-8 + date: + - Mon, 18 May 2020 23:46:57 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-arm-service-request-id: + - f64fdc53-8400-41d2-85dd-9f694abf9c17 + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network vnet create + Connection: + - keep-alive + ParameterSetName: + - -g -n + User-Agent: + - python/3.7.7 (Windows-10-10.0.18362-SP0) msrest/0.6.9 msrest_azure/0.6.3 azure-mgmt-network/10.1.0 + Azure-SDK-For-Python AZURECLI/2.5.1 + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/westus/operations/a0c13c66-3f75-4888-9e94-c5f42a5e6bfc?api-version=2020-03-01 + response: + body: + string: "{\r\n \"status\": \"Succeeded\"\r\n}" + headers: + cache-control: + - no-cache + content-length: + - '29' + content-type: + - application/json; charset=utf-8 + date: + - Mon, 18 May 2020 23:47:00 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-arm-service-request-id: + - d4df6dfd-df90-4be1-a8ff-24c7f1f6c7c1 + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network vnet create + Connection: + - keep-alive + ParameterSetName: + - -g -n + User-Agent: + - python/3.7.7 (Windows-10-10.0.18362-SP0) msrest/0.6.9 msrest_azure/0.6.3 azure-mgmt-network/10.1.0 + Azure-SDK-For-Python AZURECLI/2.5.1 + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_rg_scenario000001/providers/Microsoft.Network/virtualNetworks/vnet1?api-version=2020-03-01 + response: + body: + string: "{\r\n \"name\": \"vnet1\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_rg_scenario000001/providers/Microsoft.Network/virtualNetworks/vnet1\",\r\n + \ \"etag\": \"W/\\\"0e99a63d-cfbd-4122-bb66-eb79db06b0c4\\\"\",\r\n \"type\": + \"Microsoft.Network/virtualNetworks\",\r\n \"location\": \"westus\",\r\n + \ \"tags\": {\r\n \"costCenter\": \"Contoso/IT/PROD/123456\"\r\n },\r\n + \ \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n \"resourceGuid\": + \"85ad0dce-e3b6-4a7b-909d-5f9b68136d49\",\r\n \"addressSpace\": {\r\n \"addressPrefixes\": + [\r\n \"10.0.0.0/16\"\r\n ]\r\n },\r\n \"dhcpOptions\": + {\r\n \"dnsServers\": []\r\n },\r\n \"subnets\": [],\r\n \"virtualNetworkPeerings\": + [],\r\n \"enableDdosProtection\": false,\r\n \"enableVmProtection\": + false\r\n }\r\n}" + headers: + cache-control: + - no-cache + content-length: + - '815' + content-type: + - application/json; charset=utf-8 + date: + - Mon, 18 May 2020 23:47:00 GMT + etag: + - W/"0e99a63d-cfbd-4122-bb66-eb79db06b0c4" + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-arm-service-request-id: + - 715f0612-b49c-4683-9a13-8d62ea9f4356 + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network vnet show + Connection: + - keep-alive + ParameterSetName: + - -g -n + User-Agent: + - python/3.7.7 (Windows-10-10.0.18362-SP0) msrest/0.6.9 msrest_azure/0.6.3 azure-mgmt-network/10.1.0 + Azure-SDK-For-Python AZURECLI/2.5.1 + accept-language: + - en-US + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_rg_scenario000001/providers/Microsoft.Network/virtualNetworks/vnet1?api-version=2020-03-01 + response: + body: + string: "{\r\n \"name\": \"vnet1\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_rg_scenario000001/providers/Microsoft.Network/virtualNetworks/vnet1\",\r\n + \ \"etag\": \"W/\\\"0e99a63d-cfbd-4122-bb66-eb79db06b0c4\\\"\",\r\n \"type\": + \"Microsoft.Network/virtualNetworks\",\r\n \"location\": \"westus\",\r\n + \ \"tags\": {\r\n \"costCenter\": \"Contoso/IT/PROD/123456\"\r\n },\r\n + \ \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n \"resourceGuid\": + \"85ad0dce-e3b6-4a7b-909d-5f9b68136d49\",\r\n \"addressSpace\": {\r\n \"addressPrefixes\": + [\r\n \"10.0.0.0/16\"\r\n ]\r\n },\r\n \"dhcpOptions\": + {\r\n \"dnsServers\": []\r\n },\r\n \"subnets\": [],\r\n \"virtualNetworkPeerings\": + [],\r\n \"enableDdosProtection\": false,\r\n \"enableVmProtection\": + false\r\n }\r\n}" + headers: + cache-control: + - no-cache + content-length: + - '815' + content-type: + - application/json; charset=utf-8 + date: + - Mon, 18 May 2020 23:47:01 GMT + etag: + - W/"0e99a63d-cfbd-4122-bb66-eb79db06b0c4" + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-arm-service-request-id: + - fc33041e-51b5-499e-92ca-374f67f01ff1 + status: + code: 200 + message: OK +- request: + body: 'b''{"resources": ["/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_rg_scenario000001/providers/Microsoft.Network/virtualNetworks/vnet1"], + "options": "SkipResourceNameParameterization"}''' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - group export + Connection: + - keep-alive + Content-Length: + - '258' + Content-Type: + - application/json; charset=utf-8 + ParameterSetName: + - --name --resource-ids --skip-resource-name-parameterization --query + User-Agent: + - python/3.7.7 (Windows-10-10.0.18362-SP0) msrest/0.6.9 msrest_azure/0.6.3 azure-mgmt-resource/9.0.0 + Azure-SDK-For-Python AZURECLI/2.5.1 + accept-language: + - en-US + method: POST + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_rg_scenario000001/exportTemplate?api-version=2019-07-01 + response: + body: + string: '{"template":{"$schema":"https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#","contentVersion":"1.0.0.0","parameters":{},"variables":{},"resources":[{"type":"Microsoft.Network/virtualNetworks","apiVersion":"2020-03-01","name":"vnet1","location":"westus","tags":{"costCenter":"Contoso/IT/PROD/123456"},"properties":{"addressSpace":{"addressPrefixes":["10.0.0.0/16"]},"dhcpOptions":{"dnsServers":[]},"subnets":[],"virtualNetworkPeerings":[],"enableDdosProtection":false,"enableVmProtection":false}}]}}' + headers: + cache-control: + - no-cache + content-length: + - '526' + content-type: + - application/json; charset=utf-8 + date: + - Mon, 18 May 2020 23:47:02 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 +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 af4baf12343..7d7cc3bff97 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 @@ -55,6 +55,41 @@ def test_resource_group(self, resource_group): self.assertEqual('"1.0.0.0"\n', result.output) + @ResourceGroupPreparer(name_prefix='cli_test_rg_scenario') + def test_resource_group_export_skip_all_parameterization(self, resource_group): + + self.kwargs.update({ + 'vnet': 'vnet1' + }) + + self.cmd('network vnet create -g {rg} -n {vnet}') + self.kwargs['vnet_id'] = self.cmd('network vnet show -g {rg} -n {vnet}').get_output_in_json()['id'] + #rg_id = self.cmd('group show -g {rg}').get_output_in_json()['id'] + + #self.kwargs['rg_id'] = rg_id + + result = self.cmd('group export --name {rg} --resource-ids "{vnet_id}" --skip-all-parameterization --query "contentVersion"') + + self.assertEqual('"1.0.0.0"\n', result.output) + + + @ResourceGroupPreparer(name_prefix='cli_test_rg_scenario') + def test_resource_group_export_skip_resource_name_parameterization(self, resource_group): + + self.kwargs.update({ + 'vnet': 'vnet1' + }) + + self.cmd('network vnet create -g {rg} -n {vnet}') + self.kwargs['vnet_id'] = self.cmd('network vnet show -g {rg} -n {vnet}').get_output_in_json()['id'] + #rg_id = self.cmd('group show -g {rg}').get_output_in_json()['id'] + + #self.kwargs['rg_id'] = rg_id + + result = self.cmd('group export --name {rg} --resource-ids "{vnet_id}" --skip-resource-name-parameterization --query "contentVersion"') + + self.assertEqual('"1.0.0.0"\n', result.output) + class ResourceGroupNoWaitScenarioTest(ScenarioTest): From 15003b52fdb8e055065052482af422924a953ac6 Mon Sep 17 00:00:00 2001 From: Jorge Cotillo Date: Mon, 18 May 2020 17:04:59 -0700 Subject: [PATCH 06/14] fixed style issues --- .../resource/tests/latest/test_resource.py | 9 --------- 1 file changed, 9 deletions(-) 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 7d7cc3bff97..edf55f828b9 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 @@ -64,15 +64,10 @@ def test_resource_group_export_skip_all_parameterization(self, resource_group): self.cmd('network vnet create -g {rg} -n {vnet}') self.kwargs['vnet_id'] = self.cmd('network vnet show -g {rg} -n {vnet}').get_output_in_json()['id'] - #rg_id = self.cmd('group show -g {rg}').get_output_in_json()['id'] - - #self.kwargs['rg_id'] = rg_id - result = self.cmd('group export --name {rg} --resource-ids "{vnet_id}" --skip-all-parameterization --query "contentVersion"') self.assertEqual('"1.0.0.0"\n', result.output) - @ResourceGroupPreparer(name_prefix='cli_test_rg_scenario') def test_resource_group_export_skip_resource_name_parameterization(self, resource_group): @@ -82,10 +77,6 @@ def test_resource_group_export_skip_resource_name_parameterization(self, resourc self.cmd('network vnet create -g {rg} -n {vnet}') self.kwargs['vnet_id'] = self.cmd('network vnet show -g {rg} -n {vnet}').get_output_in_json()['id'] - #rg_id = self.cmd('group show -g {rg}').get_output_in_json()['id'] - - #self.kwargs['rg_id'] = rg_id - result = self.cmd('group export --name {rg} --resource-ids "{vnet_id}" --skip-resource-name-parameterization --query "contentVersion"') self.assertEqual('"1.0.0.0"\n', result.output) From 422e831d91b6e5972d5f45373365a3f689c9fc54 Mon Sep 17 00:00:00 2001 From: Jorge Cotillo Date: Thu, 21 May 2020 23:03:48 -0700 Subject: [PATCH 07/14] reverted launch.json and updated based on feedback --- .vscode/launch.json | 6 +++--- .../azure/cli/command_modules/resource/custom.py | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index 6564a4f2b07..a3bb8f78c2a 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -5,7 +5,7 @@ "name": "Azure CLI Debug (Integrated Console)", "type": "python", "request": "launch", - "pythonPath": "${config:python.interpreterPath}", + "pythonPath": "${config:python.pythonPath}", "program": "${workspaceRoot}/src/azure-cli/azure/cli/__main__.py", "cwd": "${workspaceRoot}", "args": [ @@ -24,7 +24,7 @@ "type": "python", "request": "launch", "stopOnEntry": true, - "pythonPath": "${config:python.interpreterPath}", + "pythonPath": "${config:python.pythonPath}", "program": "${workspaceRoot}/src/azure-cli/azure/cli/__main__.py", "cwd": "${workspaceRoot}", "args": [ @@ -40,7 +40,7 @@ "name": "Azdev Scripts", "type": "python", "request": "launch", - "pythonPath": "${config:python.interpreterPath}", + "pythonPath": "${config:python.pythonPath}", "program": "${workspaceRoot}/tools/automation/__main__.py", "cwd": "${workspaceRoot}", "args": [ 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 2f1166728b7..cc423dd2740 100644 --- a/src/azure-cli/azure/cli/command_modules/resource/custom.py +++ b/src/azure-cli/azure/cli/command_modules/resource/custom.py @@ -1025,14 +1025,14 @@ def update_resource_group(instance, tags=None): def export_group_as_template( - cmd, resource_group_name, resource_ids=None, include_comments=False, include_parameter_default_value=False, skip_resource_name_parameterization=False, skip_all_parameterization=False): + cmd, resource_group_name, include_comments=False, include_parameter_default_value=False, resource_ids=None, skip_resource_name_params=False, skip_all_params=False): """Captures a resource group as a template. :param str resource_group_name: the name of the resource group. :param str resource_ids: a string containing space-separated resource ids to filter the export by. To export all resources, do not specify this argument or supply "*". :param bool include_comments: export template with comments. :param bool include_parameter_default_value: export template parameter with default value. - :param bool skip_resource_name_parameterization: export template and skip resource name parameterization. - :param bool skip_all_parameterization: export template parameter and skip all parameterization. + :param bool skip_resource_name_params: export template and skip resource name parameterization. + :param bool skip_all_params: export template parameter and skip all parameterization. """ rcf = _resource_client_factory(cmd.cli_ctx) @@ -1041,9 +1041,9 @@ def export_group_as_template( export_options.append('IncludeComments') if include_parameter_default_value: export_options.append('IncludeParameterDefaultValue') - if skip_resource_name_parameterization: + if skip_resource_name_params: export_options.append('SkipResourceNameParameterization') - if skip_all_parameterization: + if skip_all_params: export_options.append('SkipAllParameterization') resources = [] @@ -1054,7 +1054,7 @@ def export_group_as_template( if is_valid_resource_id(i): resources.append(i) else: - raise CLIError('az resource: error: argument --resource_ids: invalid ResourceId value: \'%s\'' % i) + raise CLIError('az resource: error: argument --resource-ids: invalid ResourceId value: \'%s\'' % i) options = ','.join(export_options) if export_options else None From c06cdb4e6317689e4e13a66bce6cbb20e62493a8 Mon Sep 17 00:00:00 2001 From: Jorge Cotillo Date: Thu, 21 May 2020 23:28:17 -0700 Subject: [PATCH 08/14] added validation to skip params --- .../resource/tests/latest/test_resource.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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 edf55f828b9..15aaa66589d 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 @@ -64,9 +64,9 @@ def test_resource_group_export_skip_all_parameterization(self, resource_group): self.cmd('network vnet create -g {rg} -n {vnet}') self.kwargs['vnet_id'] = self.cmd('network vnet show -g {rg} -n {vnet}').get_output_in_json()['id'] - result = self.cmd('group export --name {rg} --resource-ids "{vnet_id}" --skip-all-parameterization --query "contentVersion"') + result = self.cmd('group export --name {rg} --resource-ids "{vnet_id}" --skip-all-params --query "parameters"') - self.assertEqual('"1.0.0.0"\n', result.output) + self.assertEqual('{}\n', result.output) @ResourceGroupPreparer(name_prefix='cli_test_rg_scenario') def test_resource_group_export_skip_resource_name_parameterization(self, resource_group): @@ -77,9 +77,9 @@ def test_resource_group_export_skip_resource_name_parameterization(self, resourc self.cmd('network vnet create -g {rg} -n {vnet}') self.kwargs['vnet_id'] = self.cmd('network vnet show -g {rg} -n {vnet}').get_output_in_json()['id'] - result = self.cmd('group export --name {rg} --resource-ids "{vnet_id}" --skip-resource-name-parameterization --query "contentVersion"') + result = self.cmd('group export --name {rg} --resource-ids "{vnet_id}" --skip-resource-name-params --query "parameters"') - self.assertEqual('"1.0.0.0"\n', result.output) + self.assertEqual('{}\n', result.output) class ResourceGroupNoWaitScenarioTest(ScenarioTest): From 6d683f02dabf9c7fa03f78ecf318971ee3c2004d Mon Sep 17 00:00:00 2001 From: Jorge Cotillo Date: Fri, 22 May 2020 08:57:15 -0700 Subject: [PATCH 09/14] updated recordings --- ...roup_export_skip_all_parameterization.yaml | 44 +++++++++---------- ...t_skip_resource_name_parameterization.yaml | 44 +++++++++---------- 2 files changed, 44 insertions(+), 44 deletions(-) diff --git a/src/azure-cli/azure/cli/command_modules/resource/tests/latest/recordings/test_resource_group_export_skip_all_parameterization.yaml b/src/azure-cli/azure/cli/command_modules/resource/tests/latest/recordings/test_resource_group_export_skip_all_parameterization.yaml index 6080727f463..bb1bc59967d 100644 --- a/src/azure-cli/azure/cli/command_modules/resource/tests/latest/recordings/test_resource_group_export_skip_all_parameterization.yaml +++ b/src/azure-cli/azure/cli/command_modules/resource/tests/latest/recordings/test_resource_group_export_skip_all_parameterization.yaml @@ -21,7 +21,7 @@ interactions: uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_rg_scenario000001?api-version=2019-07-01 response: body: - string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_rg_scenario000001","name":"cli_test_rg_scenario000001","type":"Microsoft.Resources/resourceGroups","location":"westus","tags":{"product":"azurecli","cause":"automation","date":"2020-05-18T23:46:45Z","StorageType":"testStrogae"},"properties":{"provisioningState":"Succeeded"}}' + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_rg_scenario000001","name":"cli_test_rg_scenario000001","type":"Microsoft.Resources/resourceGroups","location":"westus","tags":{"product":"azurecli","cause":"automation","date":"2020-05-22T15:40:15Z","StorageType":"testStrogae"},"properties":{"provisioningState":"Succeeded"}}' headers: cache-control: - no-cache @@ -30,7 +30,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Mon, 18 May 2020 23:46:47 GMT + - Fri, 22 May 2020 15:40:18 GMT expires: - '-1' pragma: @@ -72,11 +72,11 @@ interactions: response: body: string: "{\r\n \"name\": \"vnet1\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_rg_scenario000001/providers/Microsoft.Network/virtualNetworks/vnet1\",\r\n - \ \"etag\": \"W/\\\"51a90ebb-d881-483f-a680-0aa873cf1114\\\"\",\r\n \"type\": + \ \"etag\": \"W/\\\"4ab3a7c9-361e-421f-97b2-2eb40ac32d71\\\"\",\r\n \"type\": \"Microsoft.Network/virtualNetworks\",\r\n \"location\": \"westus\",\r\n \ \"tags\": {\r\n \"costCenter\": \"Contoso/IT/PROD/123456\"\r\n },\r\n \ \"properties\": {\r\n \"provisioningState\": \"Updating\",\r\n \"resourceGuid\": - \"14195e14-ac7b-436f-aac3-e35a2d5ee9b5\",\r\n \"addressSpace\": {\r\n \"addressPrefixes\": + \"d9fde871-853e-4cc0-9219-044af361fc9d\",\r\n \"addressSpace\": {\r\n \"addressPrefixes\": [\r\n \"10.0.0.0/16\"\r\n ]\r\n },\r\n \"dhcpOptions\": {\r\n \"dnsServers\": []\r\n },\r\n \"subnets\": [],\r\n \"virtualNetworkPeerings\": [],\r\n \"enableDdosProtection\": false,\r\n \"enableVmProtection\": @@ -85,7 +85,7 @@ interactions: azure-asyncnotification: - Enabled azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/westus/operations/7a36ec80-d2b6-44f5-b592-02c8c7c48788?api-version=2020-03-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/westus/operations/1f5c211c-2a8a-411c-b9c6-90a63c440741?api-version=2020-03-01 cache-control: - no-cache content-length: @@ -93,7 +93,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Mon, 18 May 2020 23:46:48 GMT + - Fri, 22 May 2020 15:40:18 GMT expires: - '-1' pragma: @@ -106,7 +106,7 @@ interactions: x-content-type-options: - nosniff x-ms-arm-service-request-id: - - b0da63d7-92ca-44de-8745-051c928e5634 + - 645b9fc2-998d-47eb-95e2-d7d397cb0620 x-ms-ratelimit-remaining-subscription-writes: - '1199' status: @@ -129,7 +129,7 @@ interactions: - python/3.7.7 (Windows-10-10.0.18362-SP0) msrest/0.6.9 msrest_azure/0.6.3 azure-mgmt-network/10.1.0 Azure-SDK-For-Python AZURECLI/2.5.1 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/westus/operations/7a36ec80-d2b6-44f5-b592-02c8c7c48788?api-version=2020-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/westus/operations/1f5c211c-2a8a-411c-b9c6-90a63c440741?api-version=2020-03-01 response: body: string: "{\r\n \"status\": \"Succeeded\"\r\n}" @@ -141,7 +141,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Mon, 18 May 2020 23:46:51 GMT + - Fri, 22 May 2020 15:40:22 GMT expires: - '-1' pragma: @@ -158,7 +158,7 @@ interactions: x-content-type-options: - nosniff x-ms-arm-service-request-id: - - 3298fa83-18da-40af-a357-064348d2a55b + - 790c0381-a351-4dd5-b70c-2b9f170191e4 status: code: 200 message: OK @@ -183,11 +183,11 @@ interactions: response: body: string: "{\r\n \"name\": \"vnet1\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_rg_scenario000001/providers/Microsoft.Network/virtualNetworks/vnet1\",\r\n - \ \"etag\": \"W/\\\"ce272e45-4f5e-4a39-ac37-9544e850a08f\\\"\",\r\n \"type\": + \ \"etag\": \"W/\\\"5a361e39-3d8f-4978-be33-221f3422b44e\\\"\",\r\n \"type\": \"Microsoft.Network/virtualNetworks\",\r\n \"location\": \"westus\",\r\n \ \"tags\": {\r\n \"costCenter\": \"Contoso/IT/PROD/123456\"\r\n },\r\n \ \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n \"resourceGuid\": - \"14195e14-ac7b-436f-aac3-e35a2d5ee9b5\",\r\n \"addressSpace\": {\r\n \"addressPrefixes\": + \"d9fde871-853e-4cc0-9219-044af361fc9d\",\r\n \"addressSpace\": {\r\n \"addressPrefixes\": [\r\n \"10.0.0.0/16\"\r\n ]\r\n },\r\n \"dhcpOptions\": {\r\n \"dnsServers\": []\r\n },\r\n \"subnets\": [],\r\n \"virtualNetworkPeerings\": [],\r\n \"enableDdosProtection\": false,\r\n \"enableVmProtection\": @@ -200,9 +200,9 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Mon, 18 May 2020 23:46:51 GMT + - Fri, 22 May 2020 15:40:22 GMT etag: - - W/"ce272e45-4f5e-4a39-ac37-9544e850a08f" + - W/"5a361e39-3d8f-4978-be33-221f3422b44e" expires: - '-1' pragma: @@ -219,7 +219,7 @@ interactions: x-content-type-options: - nosniff x-ms-arm-service-request-id: - - a9d2e083-e9b8-449d-be56-ffa852972bdd + - 45319a93-343e-49ca-9009-45106027acdd status: code: 200 message: OK @@ -246,11 +246,11 @@ interactions: response: body: string: "{\r\n \"name\": \"vnet1\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_rg_scenario000001/providers/Microsoft.Network/virtualNetworks/vnet1\",\r\n - \ \"etag\": \"W/\\\"ce272e45-4f5e-4a39-ac37-9544e850a08f\\\"\",\r\n \"type\": + \ \"etag\": \"W/\\\"5a361e39-3d8f-4978-be33-221f3422b44e\\\"\",\r\n \"type\": \"Microsoft.Network/virtualNetworks\",\r\n \"location\": \"westus\",\r\n \ \"tags\": {\r\n \"costCenter\": \"Contoso/IT/PROD/123456\"\r\n },\r\n \ \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n \"resourceGuid\": - \"14195e14-ac7b-436f-aac3-e35a2d5ee9b5\",\r\n \"addressSpace\": {\r\n \"addressPrefixes\": + \"d9fde871-853e-4cc0-9219-044af361fc9d\",\r\n \"addressSpace\": {\r\n \"addressPrefixes\": [\r\n \"10.0.0.0/16\"\r\n ]\r\n },\r\n \"dhcpOptions\": {\r\n \"dnsServers\": []\r\n },\r\n \"subnets\": [],\r\n \"virtualNetworkPeerings\": [],\r\n \"enableDdosProtection\": false,\r\n \"enableVmProtection\": @@ -263,9 +263,9 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Mon, 18 May 2020 23:46:52 GMT + - Fri, 22 May 2020 15:40:22 GMT etag: - - W/"ce272e45-4f5e-4a39-ac37-9544e850a08f" + - W/"5a361e39-3d8f-4978-be33-221f3422b44e" expires: - '-1' pragma: @@ -282,7 +282,7 @@ interactions: x-content-type-options: - nosniff x-ms-arm-service-request-id: - - d9e8d0ef-a3b2-4806-ac0f-502e62365638 + - 1e50c6d0-dc23-437e-bba2-a0c6ae8aeae7 status: code: 200 message: OK @@ -303,7 +303,7 @@ interactions: Content-Type: - application/json; charset=utf-8 ParameterSetName: - - --name --resource-ids --skip-all-parameterization --query + - --name --resource-ids --skip-all-params --query User-Agent: - python/3.7.7 (Windows-10-10.0.18362-SP0) msrest/0.6.9 msrest_azure/0.6.3 azure-mgmt-resource/9.0.0 Azure-SDK-For-Python AZURECLI/2.5.1 @@ -322,7 +322,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Mon, 18 May 2020 23:46:53 GMT + - Fri, 22 May 2020 15:40:36 GMT expires: - '-1' pragma: diff --git a/src/azure-cli/azure/cli/command_modules/resource/tests/latest/recordings/test_resource_group_export_skip_resource_name_parameterization.yaml b/src/azure-cli/azure/cli/command_modules/resource/tests/latest/recordings/test_resource_group_export_skip_resource_name_parameterization.yaml index 4c3fbfa5e09..45f13dd1334 100644 --- a/src/azure-cli/azure/cli/command_modules/resource/tests/latest/recordings/test_resource_group_export_skip_resource_name_parameterization.yaml +++ b/src/azure-cli/azure/cli/command_modules/resource/tests/latest/recordings/test_resource_group_export_skip_resource_name_parameterization.yaml @@ -21,7 +21,7 @@ interactions: uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_rg_scenario000001?api-version=2019-07-01 response: body: - string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_rg_scenario000001","name":"cli_test_rg_scenario000001","type":"Microsoft.Resources/resourceGroups","location":"westus","tags":{"product":"azurecli","cause":"automation","date":"2020-05-18T23:46:54Z","StorageType":"testStrogae"},"properties":{"provisioningState":"Succeeded"}}' + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_rg_scenario000001","name":"cli_test_rg_scenario000001","type":"Microsoft.Resources/resourceGroups","location":"westus","tags":{"product":"azurecli","cause":"automation","date":"2020-05-22T15:40:38Z","StorageType":"testStrogae"},"properties":{"provisioningState":"Succeeded"}}' headers: cache-control: - no-cache @@ -30,7 +30,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Mon, 18 May 2020 23:46:56 GMT + - Fri, 22 May 2020 15:40:41 GMT expires: - '-1' pragma: @@ -72,11 +72,11 @@ interactions: response: body: string: "{\r\n \"name\": \"vnet1\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_rg_scenario000001/providers/Microsoft.Network/virtualNetworks/vnet1\",\r\n - \ \"etag\": \"W/\\\"6474a4c5-c46e-4ad3-87e7-5885ad3aa66b\\\"\",\r\n \"type\": + \ \"etag\": \"W/\\\"348b1572-2645-4e10-9b96-4d2e74f402a6\\\"\",\r\n \"type\": \"Microsoft.Network/virtualNetworks\",\r\n \"location\": \"westus\",\r\n \ \"tags\": {\r\n \"costCenter\": \"Contoso/IT/PROD/123456\"\r\n },\r\n \ \"properties\": {\r\n \"provisioningState\": \"Updating\",\r\n \"resourceGuid\": - \"85ad0dce-e3b6-4a7b-909d-5f9b68136d49\",\r\n \"addressSpace\": {\r\n \"addressPrefixes\": + \"ead32d82-629a-495d-83ad-4db46be44cd1\",\r\n \"addressSpace\": {\r\n \"addressPrefixes\": [\r\n \"10.0.0.0/16\"\r\n ]\r\n },\r\n \"dhcpOptions\": {\r\n \"dnsServers\": []\r\n },\r\n \"subnets\": [],\r\n \"virtualNetworkPeerings\": [],\r\n \"enableDdosProtection\": false,\r\n \"enableVmProtection\": @@ -85,7 +85,7 @@ interactions: azure-asyncnotification: - Enabled azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/westus/operations/a0c13c66-3f75-4888-9e94-c5f42a5e6bfc?api-version=2020-03-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/westus/operations/e843e374-9b9c-434c-a8f1-3c9a4e036dba?api-version=2020-03-01 cache-control: - no-cache content-length: @@ -93,7 +93,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Mon, 18 May 2020 23:46:57 GMT + - Fri, 22 May 2020 15:40:44 GMT expires: - '-1' pragma: @@ -106,7 +106,7 @@ interactions: x-content-type-options: - nosniff x-ms-arm-service-request-id: - - f64fdc53-8400-41d2-85dd-9f694abf9c17 + - 6b8c93bc-c946-4ceb-9524-ca64d9825515 x-ms-ratelimit-remaining-subscription-writes: - '1199' status: @@ -129,7 +129,7 @@ interactions: - python/3.7.7 (Windows-10-10.0.18362-SP0) msrest/0.6.9 msrest_azure/0.6.3 azure-mgmt-network/10.1.0 Azure-SDK-For-Python AZURECLI/2.5.1 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/westus/operations/a0c13c66-3f75-4888-9e94-c5f42a5e6bfc?api-version=2020-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/westus/operations/e843e374-9b9c-434c-a8f1-3c9a4e036dba?api-version=2020-03-01 response: body: string: "{\r\n \"status\": \"Succeeded\"\r\n}" @@ -141,7 +141,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Mon, 18 May 2020 23:47:00 GMT + - Fri, 22 May 2020 15:40:47 GMT expires: - '-1' pragma: @@ -158,7 +158,7 @@ interactions: x-content-type-options: - nosniff x-ms-arm-service-request-id: - - d4df6dfd-df90-4be1-a8ff-24c7f1f6c7c1 + - 91ec07b9-c5cd-4eeb-8dbf-a7c26af5b16c status: code: 200 message: OK @@ -183,11 +183,11 @@ interactions: response: body: string: "{\r\n \"name\": \"vnet1\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_rg_scenario000001/providers/Microsoft.Network/virtualNetworks/vnet1\",\r\n - \ \"etag\": \"W/\\\"0e99a63d-cfbd-4122-bb66-eb79db06b0c4\\\"\",\r\n \"type\": + \ \"etag\": \"W/\\\"dbee63ca-7935-4e21-b760-5c296c1e8849\\\"\",\r\n \"type\": \"Microsoft.Network/virtualNetworks\",\r\n \"location\": \"westus\",\r\n \ \"tags\": {\r\n \"costCenter\": \"Contoso/IT/PROD/123456\"\r\n },\r\n \ \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n \"resourceGuid\": - \"85ad0dce-e3b6-4a7b-909d-5f9b68136d49\",\r\n \"addressSpace\": {\r\n \"addressPrefixes\": + \"ead32d82-629a-495d-83ad-4db46be44cd1\",\r\n \"addressSpace\": {\r\n \"addressPrefixes\": [\r\n \"10.0.0.0/16\"\r\n ]\r\n },\r\n \"dhcpOptions\": {\r\n \"dnsServers\": []\r\n },\r\n \"subnets\": [],\r\n \"virtualNetworkPeerings\": [],\r\n \"enableDdosProtection\": false,\r\n \"enableVmProtection\": @@ -200,9 +200,9 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Mon, 18 May 2020 23:47:00 GMT + - Fri, 22 May 2020 15:40:47 GMT etag: - - W/"0e99a63d-cfbd-4122-bb66-eb79db06b0c4" + - W/"dbee63ca-7935-4e21-b760-5c296c1e8849" expires: - '-1' pragma: @@ -219,7 +219,7 @@ interactions: x-content-type-options: - nosniff x-ms-arm-service-request-id: - - 715f0612-b49c-4683-9a13-8d62ea9f4356 + - 2a070ed9-bb4a-4cd7-88c4-a55bbf2035f7 status: code: 200 message: OK @@ -246,11 +246,11 @@ interactions: response: body: string: "{\r\n \"name\": \"vnet1\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_rg_scenario000001/providers/Microsoft.Network/virtualNetworks/vnet1\",\r\n - \ \"etag\": \"W/\\\"0e99a63d-cfbd-4122-bb66-eb79db06b0c4\\\"\",\r\n \"type\": + \ \"etag\": \"W/\\\"dbee63ca-7935-4e21-b760-5c296c1e8849\\\"\",\r\n \"type\": \"Microsoft.Network/virtualNetworks\",\r\n \"location\": \"westus\",\r\n \ \"tags\": {\r\n \"costCenter\": \"Contoso/IT/PROD/123456\"\r\n },\r\n \ \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n \"resourceGuid\": - \"85ad0dce-e3b6-4a7b-909d-5f9b68136d49\",\r\n \"addressSpace\": {\r\n \"addressPrefixes\": + \"ead32d82-629a-495d-83ad-4db46be44cd1\",\r\n \"addressSpace\": {\r\n \"addressPrefixes\": [\r\n \"10.0.0.0/16\"\r\n ]\r\n },\r\n \"dhcpOptions\": {\r\n \"dnsServers\": []\r\n },\r\n \"subnets\": [],\r\n \"virtualNetworkPeerings\": [],\r\n \"enableDdosProtection\": false,\r\n \"enableVmProtection\": @@ -263,9 +263,9 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Mon, 18 May 2020 23:47:01 GMT + - Fri, 22 May 2020 15:40:47 GMT etag: - - W/"0e99a63d-cfbd-4122-bb66-eb79db06b0c4" + - W/"dbee63ca-7935-4e21-b760-5c296c1e8849" expires: - '-1' pragma: @@ -282,7 +282,7 @@ interactions: x-content-type-options: - nosniff x-ms-arm-service-request-id: - - fc33041e-51b5-499e-92ca-374f67f01ff1 + - 9e1a8a88-92e1-40b3-9954-1c32a00065aa status: code: 200 message: OK @@ -303,7 +303,7 @@ interactions: Content-Type: - application/json; charset=utf-8 ParameterSetName: - - --name --resource-ids --skip-resource-name-parameterization --query + - --name --resource-ids --skip-resource-name-params --query User-Agent: - python/3.7.7 (Windows-10-10.0.18362-SP0) msrest/0.6.9 msrest_azure/0.6.3 azure-mgmt-resource/9.0.0 Azure-SDK-For-Python AZURECLI/2.5.1 @@ -322,7 +322,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Mon, 18 May 2020 23:47:02 GMT + - Fri, 22 May 2020 15:40:48 GMT expires: - '-1' pragma: From 4061af8ce6e02aed732e73fdefcf0f42f3f75992 Mon Sep 17 00:00:00 2001 From: Jorge Cotillo Date: Fri, 22 May 2020 11:55:08 -0700 Subject: [PATCH 10/14] renamed test cases' --- ...esource_group_export_skip_all_params.yaml} | 42 +++++++++---------- ...oup_export_skip_resource_name_params.yaml} | 42 +++++++++---------- .../resource/tests/latest/test_resource.py | 4 +- 3 files changed, 44 insertions(+), 44 deletions(-) rename src/azure-cli/azure/cli/command_modules/resource/tests/latest/recordings/{test_resource_group_export_skip_all_parameterization.yaml => test_resource_group_export_skip_all_params.yaml} (91%) rename src/azure-cli/azure/cli/command_modules/resource/tests/latest/recordings/{test_resource_group_export_skip_resource_name_parameterization.yaml => test_resource_group_export_skip_resource_name_params.yaml} (91%) diff --git a/src/azure-cli/azure/cli/command_modules/resource/tests/latest/recordings/test_resource_group_export_skip_all_parameterization.yaml b/src/azure-cli/azure/cli/command_modules/resource/tests/latest/recordings/test_resource_group_export_skip_all_params.yaml similarity index 91% rename from src/azure-cli/azure/cli/command_modules/resource/tests/latest/recordings/test_resource_group_export_skip_all_parameterization.yaml rename to src/azure-cli/azure/cli/command_modules/resource/tests/latest/recordings/test_resource_group_export_skip_all_params.yaml index bb1bc59967d..e9ea5528971 100644 --- a/src/azure-cli/azure/cli/command_modules/resource/tests/latest/recordings/test_resource_group_export_skip_all_parameterization.yaml +++ b/src/azure-cli/azure/cli/command_modules/resource/tests/latest/recordings/test_resource_group_export_skip_all_params.yaml @@ -21,7 +21,7 @@ interactions: uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_rg_scenario000001?api-version=2019-07-01 response: body: - string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_rg_scenario000001","name":"cli_test_rg_scenario000001","type":"Microsoft.Resources/resourceGroups","location":"westus","tags":{"product":"azurecli","cause":"automation","date":"2020-05-22T15:40:15Z","StorageType":"testStrogae"},"properties":{"provisioningState":"Succeeded"}}' + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_rg_scenario000001","name":"cli_test_rg_scenario000001","type":"Microsoft.Resources/resourceGroups","location":"westus","tags":{"product":"azurecli","cause":"automation","date":"2020-05-22T18:17:08Z","StorageType":"testStrogae"},"properties":{"provisioningState":"Succeeded"}}' headers: cache-control: - no-cache @@ -30,7 +30,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Fri, 22 May 2020 15:40:18 GMT + - Fri, 22 May 2020 18:17:12 GMT expires: - '-1' pragma: @@ -72,11 +72,11 @@ interactions: response: body: string: "{\r\n \"name\": \"vnet1\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_rg_scenario000001/providers/Microsoft.Network/virtualNetworks/vnet1\",\r\n - \ \"etag\": \"W/\\\"4ab3a7c9-361e-421f-97b2-2eb40ac32d71\\\"\",\r\n \"type\": + \ \"etag\": \"W/\\\"3f095d9a-b7cf-486d-b644-7099c50dcc97\\\"\",\r\n \"type\": \"Microsoft.Network/virtualNetworks\",\r\n \"location\": \"westus\",\r\n \ \"tags\": {\r\n \"costCenter\": \"Contoso/IT/PROD/123456\"\r\n },\r\n \ \"properties\": {\r\n \"provisioningState\": \"Updating\",\r\n \"resourceGuid\": - \"d9fde871-853e-4cc0-9219-044af361fc9d\",\r\n \"addressSpace\": {\r\n \"addressPrefixes\": + \"0d5b7728-2038-42d5-b9dd-c21e75ce962c\",\r\n \"addressSpace\": {\r\n \"addressPrefixes\": [\r\n \"10.0.0.0/16\"\r\n ]\r\n },\r\n \"dhcpOptions\": {\r\n \"dnsServers\": []\r\n },\r\n \"subnets\": [],\r\n \"virtualNetworkPeerings\": [],\r\n \"enableDdosProtection\": false,\r\n \"enableVmProtection\": @@ -85,7 +85,7 @@ interactions: azure-asyncnotification: - Enabled azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/westus/operations/1f5c211c-2a8a-411c-b9c6-90a63c440741?api-version=2020-03-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/westus/operations/14df1e47-c541-4d5e-af7d-2f785e0e6c8d?api-version=2020-03-01 cache-control: - no-cache content-length: @@ -93,7 +93,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Fri, 22 May 2020 15:40:18 GMT + - Fri, 22 May 2020 18:17:13 GMT expires: - '-1' pragma: @@ -106,7 +106,7 @@ interactions: x-content-type-options: - nosniff x-ms-arm-service-request-id: - - 645b9fc2-998d-47eb-95e2-d7d397cb0620 + - 04d1546b-34c7-4ce8-80a7-c24e72f0cb2d x-ms-ratelimit-remaining-subscription-writes: - '1199' status: @@ -129,7 +129,7 @@ interactions: - python/3.7.7 (Windows-10-10.0.18362-SP0) msrest/0.6.9 msrest_azure/0.6.3 azure-mgmt-network/10.1.0 Azure-SDK-For-Python AZURECLI/2.5.1 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/westus/operations/1f5c211c-2a8a-411c-b9c6-90a63c440741?api-version=2020-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/westus/operations/14df1e47-c541-4d5e-af7d-2f785e0e6c8d?api-version=2020-03-01 response: body: string: "{\r\n \"status\": \"Succeeded\"\r\n}" @@ -141,7 +141,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Fri, 22 May 2020 15:40:22 GMT + - Fri, 22 May 2020 18:17:16 GMT expires: - '-1' pragma: @@ -158,7 +158,7 @@ interactions: x-content-type-options: - nosniff x-ms-arm-service-request-id: - - 790c0381-a351-4dd5-b70c-2b9f170191e4 + - aeb586d8-c43b-47f6-ab07-b47b279ff40c status: code: 200 message: OK @@ -183,11 +183,11 @@ interactions: response: body: string: "{\r\n \"name\": \"vnet1\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_rg_scenario000001/providers/Microsoft.Network/virtualNetworks/vnet1\",\r\n - \ \"etag\": \"W/\\\"5a361e39-3d8f-4978-be33-221f3422b44e\\\"\",\r\n \"type\": + \ \"etag\": \"W/\\\"b91ba743-3872-4739-978b-7fc25edcc7ad\\\"\",\r\n \"type\": \"Microsoft.Network/virtualNetworks\",\r\n \"location\": \"westus\",\r\n \ \"tags\": {\r\n \"costCenter\": \"Contoso/IT/PROD/123456\"\r\n },\r\n \ \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n \"resourceGuid\": - \"d9fde871-853e-4cc0-9219-044af361fc9d\",\r\n \"addressSpace\": {\r\n \"addressPrefixes\": + \"0d5b7728-2038-42d5-b9dd-c21e75ce962c\",\r\n \"addressSpace\": {\r\n \"addressPrefixes\": [\r\n \"10.0.0.0/16\"\r\n ]\r\n },\r\n \"dhcpOptions\": {\r\n \"dnsServers\": []\r\n },\r\n \"subnets\": [],\r\n \"virtualNetworkPeerings\": [],\r\n \"enableDdosProtection\": false,\r\n \"enableVmProtection\": @@ -200,9 +200,9 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Fri, 22 May 2020 15:40:22 GMT + - Fri, 22 May 2020 18:17:17 GMT etag: - - W/"5a361e39-3d8f-4978-be33-221f3422b44e" + - W/"b91ba743-3872-4739-978b-7fc25edcc7ad" expires: - '-1' pragma: @@ -219,7 +219,7 @@ interactions: x-content-type-options: - nosniff x-ms-arm-service-request-id: - - 45319a93-343e-49ca-9009-45106027acdd + - 19d437a8-19cd-45af-b63e-acf3cdd07908 status: code: 200 message: OK @@ -246,11 +246,11 @@ interactions: response: body: string: "{\r\n \"name\": \"vnet1\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_rg_scenario000001/providers/Microsoft.Network/virtualNetworks/vnet1\",\r\n - \ \"etag\": \"W/\\\"5a361e39-3d8f-4978-be33-221f3422b44e\\\"\",\r\n \"type\": + \ \"etag\": \"W/\\\"b91ba743-3872-4739-978b-7fc25edcc7ad\\\"\",\r\n \"type\": \"Microsoft.Network/virtualNetworks\",\r\n \"location\": \"westus\",\r\n \ \"tags\": {\r\n \"costCenter\": \"Contoso/IT/PROD/123456\"\r\n },\r\n \ \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n \"resourceGuid\": - \"d9fde871-853e-4cc0-9219-044af361fc9d\",\r\n \"addressSpace\": {\r\n \"addressPrefixes\": + \"0d5b7728-2038-42d5-b9dd-c21e75ce962c\",\r\n \"addressSpace\": {\r\n \"addressPrefixes\": [\r\n \"10.0.0.0/16\"\r\n ]\r\n },\r\n \"dhcpOptions\": {\r\n \"dnsServers\": []\r\n },\r\n \"subnets\": [],\r\n \"virtualNetworkPeerings\": [],\r\n \"enableDdosProtection\": false,\r\n \"enableVmProtection\": @@ -263,9 +263,9 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Fri, 22 May 2020 15:40:22 GMT + - Fri, 22 May 2020 18:17:17 GMT etag: - - W/"5a361e39-3d8f-4978-be33-221f3422b44e" + - W/"b91ba743-3872-4739-978b-7fc25edcc7ad" expires: - '-1' pragma: @@ -282,7 +282,7 @@ interactions: x-content-type-options: - nosniff x-ms-arm-service-request-id: - - 1e50c6d0-dc23-437e-bba2-a0c6ae8aeae7 + - 656853f2-0df3-4712-aedc-375b95f51af8 status: code: 200 message: OK @@ -322,7 +322,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Fri, 22 May 2020 15:40:36 GMT + - Fri, 22 May 2020 18:17:18 GMT expires: - '-1' pragma: diff --git a/src/azure-cli/azure/cli/command_modules/resource/tests/latest/recordings/test_resource_group_export_skip_resource_name_parameterization.yaml b/src/azure-cli/azure/cli/command_modules/resource/tests/latest/recordings/test_resource_group_export_skip_resource_name_params.yaml similarity index 91% rename from src/azure-cli/azure/cli/command_modules/resource/tests/latest/recordings/test_resource_group_export_skip_resource_name_parameterization.yaml rename to src/azure-cli/azure/cli/command_modules/resource/tests/latest/recordings/test_resource_group_export_skip_resource_name_params.yaml index 45f13dd1334..ad3cad5c6f3 100644 --- a/src/azure-cli/azure/cli/command_modules/resource/tests/latest/recordings/test_resource_group_export_skip_resource_name_parameterization.yaml +++ b/src/azure-cli/azure/cli/command_modules/resource/tests/latest/recordings/test_resource_group_export_skip_resource_name_params.yaml @@ -21,7 +21,7 @@ interactions: uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_rg_scenario000001?api-version=2019-07-01 response: body: - string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_rg_scenario000001","name":"cli_test_rg_scenario000001","type":"Microsoft.Resources/resourceGroups","location":"westus","tags":{"product":"azurecli","cause":"automation","date":"2020-05-22T15:40:38Z","StorageType":"testStrogae"},"properties":{"provisioningState":"Succeeded"}}' + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_rg_scenario000001","name":"cli_test_rg_scenario000001","type":"Microsoft.Resources/resourceGroups","location":"westus","tags":{"product":"azurecli","cause":"automation","date":"2020-05-22T18:17:20Z","StorageType":"testStrogae"},"properties":{"provisioningState":"Succeeded"}}' headers: cache-control: - no-cache @@ -30,7 +30,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Fri, 22 May 2020 15:40:41 GMT + - Fri, 22 May 2020 18:17:21 GMT expires: - '-1' pragma: @@ -72,11 +72,11 @@ interactions: response: body: string: "{\r\n \"name\": \"vnet1\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_rg_scenario000001/providers/Microsoft.Network/virtualNetworks/vnet1\",\r\n - \ \"etag\": \"W/\\\"348b1572-2645-4e10-9b96-4d2e74f402a6\\\"\",\r\n \"type\": + \ \"etag\": \"W/\\\"502789d8-3423-4424-95dc-b97440909032\\\"\",\r\n \"type\": \"Microsoft.Network/virtualNetworks\",\r\n \"location\": \"westus\",\r\n \ \"tags\": {\r\n \"costCenter\": \"Contoso/IT/PROD/123456\"\r\n },\r\n \ \"properties\": {\r\n \"provisioningState\": \"Updating\",\r\n \"resourceGuid\": - \"ead32d82-629a-495d-83ad-4db46be44cd1\",\r\n \"addressSpace\": {\r\n \"addressPrefixes\": + \"408830c3-6129-45f7-9e2a-850ba97ead27\",\r\n \"addressSpace\": {\r\n \"addressPrefixes\": [\r\n \"10.0.0.0/16\"\r\n ]\r\n },\r\n \"dhcpOptions\": {\r\n \"dnsServers\": []\r\n },\r\n \"subnets\": [],\r\n \"virtualNetworkPeerings\": [],\r\n \"enableDdosProtection\": false,\r\n \"enableVmProtection\": @@ -85,7 +85,7 @@ interactions: azure-asyncnotification: - Enabled azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/westus/operations/e843e374-9b9c-434c-a8f1-3c9a4e036dba?api-version=2020-03-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/westus/operations/b9fe708e-fb2a-4ec7-80d7-5678a7e3f662?api-version=2020-03-01 cache-control: - no-cache content-length: @@ -93,7 +93,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Fri, 22 May 2020 15:40:44 GMT + - Fri, 22 May 2020 18:17:22 GMT expires: - '-1' pragma: @@ -106,7 +106,7 @@ interactions: x-content-type-options: - nosniff x-ms-arm-service-request-id: - - 6b8c93bc-c946-4ceb-9524-ca64d9825515 + - 9725365a-a99d-4ebe-94b2-b7bf3899ba43 x-ms-ratelimit-remaining-subscription-writes: - '1199' status: @@ -129,7 +129,7 @@ interactions: - python/3.7.7 (Windows-10-10.0.18362-SP0) msrest/0.6.9 msrest_azure/0.6.3 azure-mgmt-network/10.1.0 Azure-SDK-For-Python AZURECLI/2.5.1 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/westus/operations/e843e374-9b9c-434c-a8f1-3c9a4e036dba?api-version=2020-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/westus/operations/b9fe708e-fb2a-4ec7-80d7-5678a7e3f662?api-version=2020-03-01 response: body: string: "{\r\n \"status\": \"Succeeded\"\r\n}" @@ -141,7 +141,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Fri, 22 May 2020 15:40:47 GMT + - Fri, 22 May 2020 18:17:25 GMT expires: - '-1' pragma: @@ -158,7 +158,7 @@ interactions: x-content-type-options: - nosniff x-ms-arm-service-request-id: - - 91ec07b9-c5cd-4eeb-8dbf-a7c26af5b16c + - f596e99e-ed89-454e-9ed8-6bd33c6ebe50 status: code: 200 message: OK @@ -183,11 +183,11 @@ interactions: response: body: string: "{\r\n \"name\": \"vnet1\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_rg_scenario000001/providers/Microsoft.Network/virtualNetworks/vnet1\",\r\n - \ \"etag\": \"W/\\\"dbee63ca-7935-4e21-b760-5c296c1e8849\\\"\",\r\n \"type\": + \ \"etag\": \"W/\\\"7a4005ac-c22b-4101-bf9d-0560683ea6d4\\\"\",\r\n \"type\": \"Microsoft.Network/virtualNetworks\",\r\n \"location\": \"westus\",\r\n \ \"tags\": {\r\n \"costCenter\": \"Contoso/IT/PROD/123456\"\r\n },\r\n \ \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n \"resourceGuid\": - \"ead32d82-629a-495d-83ad-4db46be44cd1\",\r\n \"addressSpace\": {\r\n \"addressPrefixes\": + \"408830c3-6129-45f7-9e2a-850ba97ead27\",\r\n \"addressSpace\": {\r\n \"addressPrefixes\": [\r\n \"10.0.0.0/16\"\r\n ]\r\n },\r\n \"dhcpOptions\": {\r\n \"dnsServers\": []\r\n },\r\n \"subnets\": [],\r\n \"virtualNetworkPeerings\": [],\r\n \"enableDdosProtection\": false,\r\n \"enableVmProtection\": @@ -200,9 +200,9 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Fri, 22 May 2020 15:40:47 GMT + - Fri, 22 May 2020 18:17:26 GMT etag: - - W/"dbee63ca-7935-4e21-b760-5c296c1e8849" + - W/"7a4005ac-c22b-4101-bf9d-0560683ea6d4" expires: - '-1' pragma: @@ -219,7 +219,7 @@ interactions: x-content-type-options: - nosniff x-ms-arm-service-request-id: - - 2a070ed9-bb4a-4cd7-88c4-a55bbf2035f7 + - bde6f765-dc7d-4e4c-9aa6-4168f9667d33 status: code: 200 message: OK @@ -246,11 +246,11 @@ interactions: response: body: string: "{\r\n \"name\": \"vnet1\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_rg_scenario000001/providers/Microsoft.Network/virtualNetworks/vnet1\",\r\n - \ \"etag\": \"W/\\\"dbee63ca-7935-4e21-b760-5c296c1e8849\\\"\",\r\n \"type\": + \ \"etag\": \"W/\\\"7a4005ac-c22b-4101-bf9d-0560683ea6d4\\\"\",\r\n \"type\": \"Microsoft.Network/virtualNetworks\",\r\n \"location\": \"westus\",\r\n \ \"tags\": {\r\n \"costCenter\": \"Contoso/IT/PROD/123456\"\r\n },\r\n \ \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n \"resourceGuid\": - \"ead32d82-629a-495d-83ad-4db46be44cd1\",\r\n \"addressSpace\": {\r\n \"addressPrefixes\": + \"408830c3-6129-45f7-9e2a-850ba97ead27\",\r\n \"addressSpace\": {\r\n \"addressPrefixes\": [\r\n \"10.0.0.0/16\"\r\n ]\r\n },\r\n \"dhcpOptions\": {\r\n \"dnsServers\": []\r\n },\r\n \"subnets\": [],\r\n \"virtualNetworkPeerings\": [],\r\n \"enableDdosProtection\": false,\r\n \"enableVmProtection\": @@ -263,9 +263,9 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Fri, 22 May 2020 15:40:47 GMT + - Fri, 22 May 2020 18:17:26 GMT etag: - - W/"dbee63ca-7935-4e21-b760-5c296c1e8849" + - W/"7a4005ac-c22b-4101-bf9d-0560683ea6d4" expires: - '-1' pragma: @@ -282,7 +282,7 @@ interactions: x-content-type-options: - nosniff x-ms-arm-service-request-id: - - 9e1a8a88-92e1-40b3-9954-1c32a00065aa + - 0651653a-b767-4ce1-9121-dd8307263360 status: code: 200 message: OK @@ -322,7 +322,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Fri, 22 May 2020 15:40:48 GMT + - Fri, 22 May 2020 18:17:27 GMT expires: - '-1' pragma: 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 15aaa66589d..4b72020179d 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 @@ -56,7 +56,7 @@ def test_resource_group(self, resource_group): self.assertEqual('"1.0.0.0"\n', result.output) @ResourceGroupPreparer(name_prefix='cli_test_rg_scenario') - def test_resource_group_export_skip_all_parameterization(self, resource_group): + def test_resource_group_export_skip_all_params(self, resource_group): self.kwargs.update({ 'vnet': 'vnet1' @@ -69,7 +69,7 @@ def test_resource_group_export_skip_all_parameterization(self, resource_group): self.assertEqual('{}\n', result.output) @ResourceGroupPreparer(name_prefix='cli_test_rg_scenario') - def test_resource_group_export_skip_resource_name_parameterization(self, resource_group): + def test_resource_group_export_skip_resource_name_params(self, resource_group): self.kwargs.update({ 'vnet': 'vnet1' From 90cc75f53842acbd8a16154425f12a30456b874e Mon Sep 17 00:00:00 2001 From: Jorge Cotillo Date: Mon, 25 May 2020 23:55:18 -0700 Subject: [PATCH 11/14] fixed api version --- .../test_resource_group_export_skip_all_params.yaml | 12 ++++++------ ...ource_group_export_skip_resource_name_params.yaml | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/azure-cli/azure/cli/command_modules/resource/tests/latest/recordings/test_resource_group_export_skip_all_params.yaml b/src/azure-cli/azure/cli/command_modules/resource/tests/latest/recordings/test_resource_group_export_skip_all_params.yaml index e9ea5528971..da0d1319341 100644 --- a/src/azure-cli/azure/cli/command_modules/resource/tests/latest/recordings/test_resource_group_export_skip_all_params.yaml +++ b/src/azure-cli/azure/cli/command_modules/resource/tests/latest/recordings/test_resource_group_export_skip_all_params.yaml @@ -68,7 +68,7 @@ interactions: accept-language: - en-US method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_rg_scenario000001/providers/Microsoft.Network/virtualNetworks/vnet1?api-version=2020-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_rg_scenario000001/providers/Microsoft.Network/virtualNetworks/vnet1?api-version=2020-04-01 response: body: string: "{\r\n \"name\": \"vnet1\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_rg_scenario000001/providers/Microsoft.Network/virtualNetworks/vnet1\",\r\n @@ -85,7 +85,7 @@ interactions: azure-asyncnotification: - Enabled azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/westus/operations/14df1e47-c541-4d5e-af7d-2f785e0e6c8d?api-version=2020-03-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/westus/operations/14df1e47-c541-4d5e-af7d-2f785e0e6c8d?api-version=2020-04-01 cache-control: - no-cache content-length: @@ -129,7 +129,7 @@ interactions: - python/3.7.7 (Windows-10-10.0.18362-SP0) msrest/0.6.9 msrest_azure/0.6.3 azure-mgmt-network/10.1.0 Azure-SDK-For-Python AZURECLI/2.5.1 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/westus/operations/14df1e47-c541-4d5e-af7d-2f785e0e6c8d?api-version=2020-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/westus/operations/14df1e47-c541-4d5e-af7d-2f785e0e6c8d?api-version=2020-04-01 response: body: string: "{\r\n \"status\": \"Succeeded\"\r\n}" @@ -179,7 +179,7 @@ interactions: - python/3.7.7 (Windows-10-10.0.18362-SP0) msrest/0.6.9 msrest_azure/0.6.3 azure-mgmt-network/10.1.0 Azure-SDK-For-Python AZURECLI/2.5.1 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_rg_scenario000001/providers/Microsoft.Network/virtualNetworks/vnet1?api-version=2020-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_rg_scenario000001/providers/Microsoft.Network/virtualNetworks/vnet1?api-version=2020-04-01 response: body: string: "{\r\n \"name\": \"vnet1\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_rg_scenario000001/providers/Microsoft.Network/virtualNetworks/vnet1\",\r\n @@ -242,7 +242,7 @@ interactions: accept-language: - en-US method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_rg_scenario000001/providers/Microsoft.Network/virtualNetworks/vnet1?api-version=2020-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_rg_scenario000001/providers/Microsoft.Network/virtualNetworks/vnet1?api-version=2020-04-01 response: body: string: "{\r\n \"name\": \"vnet1\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_rg_scenario000001/providers/Microsoft.Network/virtualNetworks/vnet1\",\r\n @@ -313,7 +313,7 @@ interactions: uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_rg_scenario000001/exportTemplate?api-version=2019-07-01 response: body: - string: '{"template":{"$schema":"https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#","contentVersion":"1.0.0.0","parameters":{},"variables":{},"resources":[{"type":"Microsoft.Network/virtualNetworks","apiVersion":"2020-03-01","name":"vnet1","location":"westus","tags":{"costCenter":"Contoso/IT/PROD/123456"},"properties":{"addressSpace":{"addressPrefixes":["10.0.0.0/16"]},"dhcpOptions":{"dnsServers":[]},"subnets":[],"virtualNetworkPeerings":[],"enableDdosProtection":false,"enableVmProtection":false}}]}}' + string: '{"template":{"$schema":"https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#","contentVersion":"1.0.0.0","parameters":{},"variables":{},"resources":[{"type":"Microsoft.Network/virtualNetworks","apiVersion":"2020-04-01","name":"vnet1","location":"westus","tags":{"costCenter":"Contoso/IT/PROD/123456"},"properties":{"addressSpace":{"addressPrefixes":["10.0.0.0/16"]},"dhcpOptions":{"dnsServers":[]},"subnets":[],"virtualNetworkPeerings":[],"enableDdosProtection":false,"enableVmProtection":false}}]}}' headers: cache-control: - no-cache diff --git a/src/azure-cli/azure/cli/command_modules/resource/tests/latest/recordings/test_resource_group_export_skip_resource_name_params.yaml b/src/azure-cli/azure/cli/command_modules/resource/tests/latest/recordings/test_resource_group_export_skip_resource_name_params.yaml index ad3cad5c6f3..a2cce9ad533 100644 --- a/src/azure-cli/azure/cli/command_modules/resource/tests/latest/recordings/test_resource_group_export_skip_resource_name_params.yaml +++ b/src/azure-cli/azure/cli/command_modules/resource/tests/latest/recordings/test_resource_group_export_skip_resource_name_params.yaml @@ -68,7 +68,7 @@ interactions: accept-language: - en-US method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_rg_scenario000001/providers/Microsoft.Network/virtualNetworks/vnet1?api-version=2020-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_rg_scenario000001/providers/Microsoft.Network/virtualNetworks/vnet1?api-version=2020-04-01 response: body: string: "{\r\n \"name\": \"vnet1\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_rg_scenario000001/providers/Microsoft.Network/virtualNetworks/vnet1\",\r\n @@ -85,7 +85,7 @@ interactions: azure-asyncnotification: - Enabled azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/westus/operations/b9fe708e-fb2a-4ec7-80d7-5678a7e3f662?api-version=2020-03-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/westus/operations/b9fe708e-fb2a-4ec7-80d7-5678a7e3f662?api-version=2020-04-01 cache-control: - no-cache content-length: @@ -129,7 +129,7 @@ interactions: - python/3.7.7 (Windows-10-10.0.18362-SP0) msrest/0.6.9 msrest_azure/0.6.3 azure-mgmt-network/10.1.0 Azure-SDK-For-Python AZURECLI/2.5.1 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/westus/operations/b9fe708e-fb2a-4ec7-80d7-5678a7e3f662?api-version=2020-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/westus/operations/b9fe708e-fb2a-4ec7-80d7-5678a7e3f662?api-version=2020-04-01 response: body: string: "{\r\n \"status\": \"Succeeded\"\r\n}" @@ -179,7 +179,7 @@ interactions: - python/3.7.7 (Windows-10-10.0.18362-SP0) msrest/0.6.9 msrest_azure/0.6.3 azure-mgmt-network/10.1.0 Azure-SDK-For-Python AZURECLI/2.5.1 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_rg_scenario000001/providers/Microsoft.Network/virtualNetworks/vnet1?api-version=2020-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_rg_scenario000001/providers/Microsoft.Network/virtualNetworks/vnet1?api-version=2020-04-01 response: body: string: "{\r\n \"name\": \"vnet1\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_rg_scenario000001/providers/Microsoft.Network/virtualNetworks/vnet1\",\r\n @@ -242,7 +242,7 @@ interactions: accept-language: - en-US method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_rg_scenario000001/providers/Microsoft.Network/virtualNetworks/vnet1?api-version=2020-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_rg_scenario000001/providers/Microsoft.Network/virtualNetworks/vnet1?api-version=2020-04-01 response: body: string: "{\r\n \"name\": \"vnet1\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_rg_scenario000001/providers/Microsoft.Network/virtualNetworks/vnet1\",\r\n @@ -313,7 +313,7 @@ interactions: uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_rg_scenario000001/exportTemplate?api-version=2019-07-01 response: body: - string: '{"template":{"$schema":"https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#","contentVersion":"1.0.0.0","parameters":{},"variables":{},"resources":[{"type":"Microsoft.Network/virtualNetworks","apiVersion":"2020-03-01","name":"vnet1","location":"westus","tags":{"costCenter":"Contoso/IT/PROD/123456"},"properties":{"addressSpace":{"addressPrefixes":["10.0.0.0/16"]},"dhcpOptions":{"dnsServers":[]},"subnets":[],"virtualNetworkPeerings":[],"enableDdosProtection":false,"enableVmProtection":false}}]}}' + string: '{"template":{"$schema":"https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#","contentVersion":"1.0.0.0","parameters":{},"variables":{},"resources":[{"type":"Microsoft.Network/virtualNetworks","apiVersion":"2020-04-01","name":"vnet1","location":"westus","tags":{"costCenter":"Contoso/IT/PROD/123456"},"properties":{"addressSpace":{"addressPrefixes":["10.0.0.0/16"]},"dhcpOptions":{"dnsServers":[]},"subnets":[],"virtualNetworkPeerings":[],"enableDdosProtection":false,"enableVmProtection":false}}]}}' headers: cache-control: - no-cache From ad96692ce54f77791c1afc61cd3b00c8aaa782aa Mon Sep 17 00:00:00 2001 From: Jorge Cotillo Date: Thu, 28 May 2020 14:50:14 -0700 Subject: [PATCH 12/14] updated based on feedback --- src/azure-cli/azure/cli/command_modules/resource/_params.py | 3 +++ src/azure-cli/azure/cli/command_modules/resource/custom.py | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/azure-cli/azure/cli/command_modules/resource/_params.py b/src/azure-cli/azure/cli/command_modules/resource/_params.py index 0dbc20492d7..ab44b34422f 100644 --- a/src/azure-cli/azure/cli/command_modules/resource/_params.py +++ b/src/azure-cli/azure/cli/command_modules/resource/_params.py @@ -365,6 +365,9 @@ def load_arguments(self, _): with self.argument_context('group export') as c: c.argument('include_comments', action='store_true') c.argument('include_parameter_default_value', action='store_true') + c.argument('skip_resource_name_params', action='store_true') + c.argument('skip_all_params', action='store_true') + c.argument('resource_ids', nargs='+', options_list='--resource-ids') with self.argument_context('group create') as c: c.argument('rg_name', options_list=['--name', '--resource-group', '-n', '-g'], 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 8aad7c51cee..f94fc4c984b 100644 --- a/src/azure-cli/azure/cli/command_modules/resource/custom.py +++ b/src/azure-cli/azure/cli/command_modules/resource/custom.py @@ -1035,7 +1035,7 @@ def export_group_as_template( cmd, resource_group_name, include_comments=False, include_parameter_default_value=False, resource_ids=None, skip_resource_name_params=False, skip_all_params=False): """Captures a resource group as a template. :param str resource_group_name: the name of the resource group. - :param str resource_ids: a string containing space-separated resource ids to filter the export by. To export all resources, do not specify this argument or supply "*". + :param str resource_ids: space-separated resource ids to filter the export by. To export all resources, do not specify this argument or supply "*". :param bool include_comments: export template with comments. :param bool include_parameter_default_value: export template parameter with default value. :param bool skip_resource_name_params: export template and skip resource name parameterization. @@ -1057,7 +1057,7 @@ def export_group_as_template( if resource_ids is None or resource_ids == "*": resources = ["*"] else: - for i in resource_ids.split(): + for i in resource_ids: if is_valid_resource_id(i): resources.append(i) else: From 497020fed28dd5cbfe4bc4efb876453a8a3cf3a3 Mon Sep 17 00:00:00 2001 From: Jorge Cotillo Date: Thu, 28 May 2020 17:48:43 -0700 Subject: [PATCH 13/14] removed str reference from param --- src/azure-cli/azure/cli/command_modules/resource/custom.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 f94fc4c984b..d7ccd4cbfe1 100644 --- a/src/azure-cli/azure/cli/command_modules/resource/custom.py +++ b/src/azure-cli/azure/cli/command_modules/resource/custom.py @@ -1035,7 +1035,7 @@ def export_group_as_template( cmd, resource_group_name, include_comments=False, include_parameter_default_value=False, resource_ids=None, skip_resource_name_params=False, skip_all_params=False): """Captures a resource group as a template. :param str resource_group_name: the name of the resource group. - :param str resource_ids: space-separated resource ids to filter the export by. To export all resources, do not specify this argument or supply "*". + :param resource_ids: space-separated resource ids to filter the export by. To export all resources, do not specify this argument or supply "*". :param bool include_comments: export template with comments. :param bool include_parameter_default_value: export template parameter with default value. :param bool skip_resource_name_params: export template and skip resource name parameterization. From 2f8a565a6cdc8e1b545720267f568b11dc6aae4c Mon Sep 17 00:00:00 2001 From: Jorge Cotillo Date: Mon, 8 Jun 2020 15:09:55 -0700 Subject: [PATCH 14/14] check index zero array --- src/azure-cli/azure/cli/command_modules/resource/custom.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 d7ccd4cbfe1..6ea87ed7735 100644 --- a/src/azure-cli/azure/cli/command_modules/resource/custom.py +++ b/src/azure-cli/azure/cli/command_modules/resource/custom.py @@ -1054,7 +1054,7 @@ def export_group_as_template( export_options.append('SkipAllParameterization') resources = [] - if resource_ids is None or resource_ids == "*": + if resource_ids is None or resource_ids[0] == "*": resources = ["*"] else: for i in resource_ids: