diff --git a/src/azure-cli/HISTORY.rst b/src/azure-cli/HISTORY.rst index 76fe5b030ee..d57d357ed6e 100644 --- a/src/azure-cli/HISTORY.rst +++ b/src/azure-cli/HISTORY.rst @@ -26,6 +26,7 @@ Release History * Fix issue #11658: `az group export` command does not support `--query` and `--output` parameters * Fix issue #10279: The exit code of `az group deployment validate` is 0 when the verification fails * Fix issue #9916: Improve the error message of the conflict between tag and other filter conditions for `az resource list` command +* Add new parameter `--managed-by` to support adding managedBy information for command `az group create` **Azure Red Hat OpenShift** diff --git a/src/azure-cli/azure/cli/command_modules/resource/__init__.py b/src/azure-cli/azure/cli/command_modules/resource/__init__.py index 59f85fab501..57050047d40 100644 --- a/src/azure-cli/azure/cli/command_modules/resource/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/resource/__init__.py @@ -13,8 +13,10 @@ class ResourceCommandsLoader(AzCommandsLoader): def __init__(self, cli_ctx=None): from azure.cli.core.commands import CliCommandType from azure.cli.core import ModExtensionSuppress + from azure.cli.core.profiles import ResourceType resource_custom = CliCommandType(operations_tmpl='azure.cli.command_modules.resource.custom#{}') super(ResourceCommandsLoader, self).__init__(cli_ctx=cli_ctx, + resource_type=ResourceType.MGMT_RESOURCE_RESOURCES, custom_command_type=resource_custom, suppress_extension=ModExtensionSuppress( __name__, 'managementgroups', '0.1.0', 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 f63a54a2a53..92095d9784d 100644 --- a/src/azure-cli/azure/cli/command_modules/resource/_params.py +++ b/src/azure-cli/azure/cli/command_modules/resource/_params.py @@ -221,6 +221,7 @@ def load_arguments(self, _): with self.argument_context('group create') as c: c.argument('rg_name', options_list=['--name', '--resource-group', '-n', '-g'], help='name of the new resource group', completer=None) + c.argument('managed_by', min_api='2016-09-01', help='The ID of the resource that manages this resource group.') with self.argument_context('tag') as c: c.argument('tag_name', options_list=['--name', '-n']) 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 351efc0e14e..ad9d4b058ad 100644 --- a/src/azure-cli/azure/cli/command_modules/resource/custom.py +++ b/src/azure-cli/azure/cli/command_modules/resource/custom.py @@ -727,7 +727,7 @@ def list_resource_groups(cmd, tag=None): # pylint: disable=no-self-use return list(groups) -def create_resource_group(cmd, rg_name, location, tags=None): +def create_resource_group(cmd, rg_name, location, tags=None, managed_by=None): """ Create a new resource group. :param str resource_group_name:the desired resource group name :param str location:the resource group location @@ -740,6 +740,10 @@ def create_resource_group(cmd, rg_name, location, tags=None): location=location, tags=tags ) + + if cmd.supported_api_version(min_api='2016-09-01'): + parameters.managed_by = managed_by + return rcf.resource_groups.create_or_update(rg_name, parameters) diff --git a/src/azure-cli/azure/cli/command_modules/resource/tests/latest/recordings/test_resource_group.yaml b/src/azure-cli/azure/cli/command_modules/resource/tests/latest/recordings/test_resource_group.yaml index aae0196cb43..c97c5ca4f34 100644 --- a/src/azure-cli/azure/cli/command_modules/resource/tests/latest/recordings/test_resource_group.yaml +++ b/src/azure-cli/azure/cli/command_modules/resource/tests/latest/recordings/test_resource_group.yaml @@ -30,11 +30,11 @@ interactions: content-length: - '0' date: - - Fri, 17 Jan 2020 05:42:20 GMT + - Mon, 20 Jan 2020 09:33:32 GMT expires: - '-1' location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1DTEk6NUZURVNUOjVGUkc6NUZTQ0VOQVJJT0pKRk5KNkZFM0dRU1RFVkNOSkgzVHw1RkU4RkQ1NDBBRDZEM0Q4LVdFU1RVUyIsImpvYkxvY2F0aW9uIjoid2VzdHVzIn0?api-version=2019-07-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1DTEk6NUZURVNUOjVGUkc6NUZTQ0VOQVJJT0tKRzJUUVBaUTY2M0NGSENVWlhTVHw3QkM5OTFERDdBRkVDODVDLVdFU1RVUyIsImpvYkxvY2F0aW9uIjoid2VzdHVzIn0?api-version=2019-07-01 pragma: - no-cache strict-transport-security: @@ -63,7 +63,7 @@ interactions: - python/3.8.0 (Windows-10-10.0.18362-SP0) msrest/0.6.10 msrest_azure/0.6.2 azure-mgmt-resource/6.0.0 Azure-SDK-For-Python AZURECLI/2.0.80 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1DTEk6NUZURVNUOjVGUkc6NUZTQ0VOQVJJT0pKRk5KNkZFM0dRU1RFVkNOSkgzVHw1RkU4RkQ1NDBBRDZEM0Q4LVdFU1RVUyIsImpvYkxvY2F0aW9uIjoid2VzdHVzIn0?api-version=2019-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1DTEk6NUZURVNUOjVGUkc6NUZTQ0VOQVJJT0tKRzJUUVBaUTY2M0NGSENVWlhTVHw3QkM5OTFERDdBRkVDODVDLVdFU1RVUyIsImpvYkxvY2F0aW9uIjoid2VzdHVzIn0?api-version=2019-07-01 response: body: string: '' @@ -73,11 +73,11 @@ interactions: content-length: - '0' date: - - Fri, 17 Jan 2020 05:42:36 GMT + - Mon, 20 Jan 2020 09:33:49 GMT expires: - '-1' location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1DTEk6NUZURVNUOjVGUkc6NUZTQ0VOQVJJT0pKRk5KNkZFM0dRU1RFVkNOSkgzVHw1RkU4RkQ1NDBBRDZEM0Q4LVdFU1RVUyIsImpvYkxvY2F0aW9uIjoid2VzdHVzIn0?api-version=2019-07-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1DTEk6NUZURVNUOjVGUkc6NUZTQ0VOQVJJT0tKRzJUUVBaUTY2M0NGSENVWlhTVHw3QkM5OTFERDdBRkVDODVDLVdFU1RVUyIsImpvYkxvY2F0aW9uIjoid2VzdHVzIn0?api-version=2019-07-01 pragma: - no-cache strict-transport-security: @@ -104,7 +104,7 @@ interactions: - python/3.8.0 (Windows-10-10.0.18362-SP0) msrest/0.6.10 msrest_azure/0.6.2 azure-mgmt-resource/6.0.0 Azure-SDK-For-Python AZURECLI/2.0.80 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1DTEk6NUZURVNUOjVGUkc6NUZTQ0VOQVJJT0pKRk5KNkZFM0dRU1RFVkNOSkgzVHw1RkU4RkQ1NDBBRDZEM0Q4LVdFU1RVUyIsImpvYkxvY2F0aW9uIjoid2VzdHVzIn0?api-version=2019-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1DTEk6NUZURVNUOjVGUkc6NUZTQ0VOQVJJT0tKRzJUUVBaUTY2M0NGSENVWlhTVHw3QkM5OTFERDdBRkVDODVDLVdFU1RVUyIsImpvYkxvY2F0aW9uIjoid2VzdHVzIn0?api-version=2019-07-01 response: body: string: '' @@ -114,11 +114,11 @@ interactions: content-length: - '0' date: - - Fri, 17 Jan 2020 05:42:51 GMT + - Mon, 20 Jan 2020 09:34:04 GMT expires: - '-1' location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1DTEk6NUZURVNUOjVGUkc6NUZTQ0VOQVJJT0pKRk5KNkZFM0dRU1RFVkNOSkgzVHw1RkU4RkQ1NDBBRDZEM0Q4LVdFU1RVUyIsImpvYkxvY2F0aW9uIjoid2VzdHVzIn0?api-version=2019-07-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1DTEk6NUZURVNUOjVGUkc6NUZTQ0VOQVJJT0tKRzJUUVBaUTY2M0NGSENVWlhTVHw3QkM5OTFERDdBRkVDODVDLVdFU1RVUyIsImpvYkxvY2F0aW9uIjoid2VzdHVzIn0?api-version=2019-07-01 pragma: - no-cache strict-transport-security: @@ -145,7 +145,7 @@ interactions: - python/3.8.0 (Windows-10-10.0.18362-SP0) msrest/0.6.10 msrest_azure/0.6.2 azure-mgmt-resource/6.0.0 Azure-SDK-For-Python AZURECLI/2.0.80 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1DTEk6NUZURVNUOjVGUkc6NUZTQ0VOQVJJT0pKRk5KNkZFM0dRU1RFVkNOSkgzVHw1RkU4RkQ1NDBBRDZEM0Q4LVdFU1RVUyIsImpvYkxvY2F0aW9uIjoid2VzdHVzIn0?api-version=2019-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1DTEk6NUZURVNUOjVGUkc6NUZTQ0VOQVJJT0tKRzJUUVBaUTY2M0NGSENVWlhTVHw3QkM5OTFERDdBRkVDODVDLVdFU1RVUyIsImpvYkxvY2F0aW9uIjoid2VzdHVzIn0?api-version=2019-07-01 response: body: string: '' @@ -155,11 +155,11 @@ interactions: content-length: - '0' date: - - Fri, 17 Jan 2020 05:43:06 GMT + - Mon, 20 Jan 2020 09:34:19 GMT expires: - '-1' location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1DTEk6NUZURVNUOjVGUkc6NUZTQ0VOQVJJT0pKRk5KNkZFM0dRU1RFVkNOSkgzVHw1RkU4RkQ1NDBBRDZEM0Q4LVdFU1RVUyIsImpvYkxvY2F0aW9uIjoid2VzdHVzIn0?api-version=2019-07-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1DTEk6NUZURVNUOjVGUkc6NUZTQ0VOQVJJT0tKRzJUUVBaUTY2M0NGSENVWlhTVHw3QkM5OTFERDdBRkVDODVDLVdFU1RVUyIsImpvYkxvY2F0aW9uIjoid2VzdHVzIn0?api-version=2019-07-01 pragma: - no-cache strict-transport-security: @@ -186,7 +186,7 @@ interactions: - python/3.8.0 (Windows-10-10.0.18362-SP0) msrest/0.6.10 msrest_azure/0.6.2 azure-mgmt-resource/6.0.0 Azure-SDK-For-Python AZURECLI/2.0.80 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1DTEk6NUZURVNUOjVGUkc6NUZTQ0VOQVJJT0pKRk5KNkZFM0dRU1RFVkNOSkgzVHw1RkU4RkQ1NDBBRDZEM0Q4LVdFU1RVUyIsImpvYkxvY2F0aW9uIjoid2VzdHVzIn0?api-version=2019-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1DTEk6NUZURVNUOjVGUkc6NUZTQ0VOQVJJT0tKRzJUUVBaUTY2M0NGSENVWlhTVHw3QkM5OTFERDdBRkVDODVDLVdFU1RVUyIsImpvYkxvY2F0aW9uIjoid2VzdHVzIn0?api-version=2019-07-01 response: body: string: '' @@ -196,48 +196,7 @@ interactions: content-length: - '0' date: - - Fri, 17 Jan 2020 05:43:22 GMT - expires: - - '-1' - location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1DTEk6NUZURVNUOjVGUkc6NUZTQ0VOQVJJT0pKRk5KNkZFM0dRU1RFVkNOSkgzVHw1RkU4RkQ1NDBBRDZEM0Q4LVdFU1RVUyIsImpvYkxvY2F0aW9uIjoid2VzdHVzIn0?api-version=2019-07-01 - pragma: - - no-cache - strict-transport-security: - - max-age=31536000; includeSubDomains - x-content-type-options: - - nosniff - status: - code: 202 - message: Accepted -- request: - body: null - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - CommandName: - - group delete - Connection: - - keep-alive - ParameterSetName: - - -n --yes - User-Agent: - - python/3.8.0 (Windows-10-10.0.18362-SP0) msrest/0.6.10 msrest_azure/0.6.2 - azure-mgmt-resource/6.0.0 Azure-SDK-For-Python AZURECLI/2.0.80 - method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1DTEk6NUZURVNUOjVGUkc6NUZTQ0VOQVJJT0pKRk5KNkZFM0dRU1RFVkNOSkgzVHw1RkU4RkQ1NDBBRDZEM0Q4LVdFU1RVUyIsImpvYkxvY2F0aW9uIjoid2VzdHVzIn0?api-version=2019-07-01 - response: - body: - string: '' - headers: - cache-control: - - no-cache - content-length: - - '0' - date: - - Fri, 17 Jan 2020 05:43:38 GMT + - Mon, 20 Jan 2020 09:34:35 GMT expires: - '-1' pragma: @@ -280,7 +239,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Fri, 17 Jan 2020 05:43:38 GMT + - Mon, 20 Jan 2020 09:34:36 GMT expires: - '-1' pragma: @@ -295,7 +254,8 @@ interactions: code: 404 message: Not Found - request: - body: '{"location": "westus", "tags": {"a": "b", "c": ""}}' + body: '{"location": "westus", "managedBy": "test_admin", "tags": {"a": "b", "c": + ""}}' headers: Accept: - application/json @@ -306,11 +266,11 @@ interactions: Connection: - keep-alive Content-Length: - - '51' + - '78' Content-Type: - application/json; charset=utf-8 ParameterSetName: - - -n -l --tag + - -n -l --tag --managed-by User-Agent: - python/3.8.0 (Windows-10-10.0.18362-SP0) msrest/0.6.10 msrest_azure/0.6.2 azure-mgmt-resource/6.0.0 Azure-SDK-For-Python AZURECLI/2.0.80 @@ -320,16 +280,16 @@ 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":{"a":"b","c":""},"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","managedBy":"test_admin","tags":{"a":"b","c":""},"properties":{"provisioningState":"Succeeded"}}' headers: cache-control: - no-cache content-length: - - '371' + - '396' content-type: - application/json; charset=utf-8 date: - - Fri, 17 Jan 2020 05:43:44 GMT + - Mon, 20 Jan 2020 09:34:43 GMT expires: - '-1' pragma: @@ -339,7 +299,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-writes: - - '1198' + - '1199' status: code: 201 message: Created @@ -372,7 +332,7 @@ interactions: content-length: - '0' date: - - Fri, 17 Jan 2020 05:43:45 GMT + - Mon, 20 Jan 2020 09:34:43 GMT expires: - '-1' pragma: @@ -406,16 +366,16 @@ 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":{"a":"b","c":""},"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","managedBy":"test_admin","tags":{"a":"b","c":""},"properties":{"provisioningState":"Succeeded"}}' headers: cache-control: - no-cache content-length: - - '371' + - '396' content-type: - application/json; charset=utf-8 date: - - Fri, 17 Jan 2020 05:43:45 GMT + - Mon, 20 Jan 2020 09:34:44 GMT expires: - '-1' pragma: @@ -451,16 +411,16 @@ interactions: uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups?$filter=tagname%20eq%20%27a%27%20and%20tagvalue%20eq%20%27b%27&api-version=2019-07-01 response: body: - string: '{"value":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_rg_scenario000001","name":"cli_test_rg_scenario000001","type":"Microsoft.Resources/resourceGroups","location":"westus","tags":{"a":"b","c":""},"properties":{"provisioningState":"Succeeded"}}]}' + string: '{"value":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_rg_scenario000001","name":"cli_test_rg_scenario000001","type":"Microsoft.Resources/resourceGroups","location":"westus","managedBy":"test_admin","tags":{"a":"b","c":""},"properties":{"provisioningState":"Succeeded"}}]}' headers: cache-control: - no-cache content-length: - - '383' + - '408' content-type: - application/json; charset=utf-8 date: - - Fri, 17 Jan 2020 05:43:46 GMT + - Mon, 20 Jan 2020 09:34:44 GMT expires: - '-1' pragma: @@ -496,16 +456,16 @@ 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":{"a":"b","c":""},"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","managedBy":"test_admin","tags":{"a":"b","c":""},"properties":{"provisioningState":"Succeeded"}}' headers: cache-control: - no-cache content-length: - - '371' + - '396' content-type: - application/json; charset=utf-8 date: - - Fri, 17 Jan 2020 05:43:46 GMT + - Mon, 20 Jan 2020 09:34:45 GMT expires: - '-1' pragma: @@ -520,7 +480,8 @@ interactions: code: 200 message: OK - request: - body: '{"properties": {}, "location": "westus", "tags": {}}' + body: '{"properties": {}, "location": "westus", "managedBy": "test_admin", "tags": + {}}' headers: Accept: - application/json @@ -531,7 +492,7 @@ interactions: Connection: - keep-alive Content-Length: - - '52' + - '79' Content-Type: - application/json; charset=utf-8 ParameterSetName: @@ -545,16 +506,16 @@ 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":{},"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","managedBy":"test_admin","tags":{},"properties":{"provisioningState":"Succeeded"}}' headers: cache-control: - no-cache content-length: - - '357' + - '382' content-type: - application/json; charset=utf-8 date: - - Fri, 17 Jan 2020 05:43:52 GMT + - Mon, 20 Jan 2020 09:34:51 GMT expires: - '-1' pragma: @@ -594,16 +555,16 @@ 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":{},"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","managedBy":"test_admin","tags":{},"properties":{"provisioningState":"Succeeded"}}' headers: cache-control: - no-cache content-length: - - '357' + - '382' content-type: - application/json; charset=utf-8 date: - - Fri, 17 Jan 2020 05:43:52 GMT + - Mon, 20 Jan 2020 09:34:51 GMT expires: - '-1' pragma: @@ -618,7 +579,8 @@ interactions: code: 200 message: OK - request: - body: '{"properties": {}, "location": "westus", "tags": {"a": "{''k'': ''v''}"}}' + body: '{"properties": {}, "location": "westus", "managedBy": "test_admin", "tags": + {"a": "{''k'': ''v''}"}}' headers: Accept: - application/json @@ -629,7 +591,7 @@ interactions: Connection: - keep-alive Content-Length: - - '69' + - '96' Content-Type: - application/json; charset=utf-8 ParameterSetName: @@ -643,17 +605,17 @@ 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":{"a":"{''k'': + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_rg_scenario000001","name":"cli_test_rg_scenario000001","type":"Microsoft.Resources/resourceGroups","location":"westus","managedBy":"test_admin","tags":{"a":"{''k'': ''v''}"},"properties":{"provisioningState":"Succeeded"}}' headers: cache-control: - no-cache content-length: - - '373' + - '398' content-type: - application/json; charset=utf-8 date: - - Fri, 17 Jan 2020 05:43:58 GMT + - Mon, 20 Jan 2020 09:34:58 GMT expires: - '-1' pragma: @@ -667,7 +629,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-writes: - - '1198' + - '1199' status: code: 200 message: OK @@ -693,17 +655,17 @@ 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":{"a":"{''k'': + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_rg_scenario000001","name":"cli_test_rg_scenario000001","type":"Microsoft.Resources/resourceGroups","location":"westus","managedBy":"test_admin","tags":{"a":"{''k'': ''v''}"},"properties":{"provisioningState":"Succeeded"}}' headers: cache-control: - no-cache content-length: - - '373' + - '398' content-type: - application/json; charset=utf-8 date: - - Fri, 17 Jan 2020 05:43:58 GMT + - Mon, 20 Jan 2020 09:34:59 GMT expires: - '-1' pragma: @@ -718,8 +680,8 @@ interactions: code: 200 message: OK - request: - body: '{"properties": {}, "location": "westus", "tags": {"a": "{''k'': ''v''}", - "b": "{\"k\":\"v\"}"}}' + body: '{"properties": {}, "location": "westus", "managedBy": "test_admin", "tags": + {"a": "{''k'': ''v''}", "b": "{\"k\":\"v\"}"}}' headers: Accept: - application/json @@ -730,7 +692,7 @@ interactions: Connection: - keep-alive Content-Length: - - '91' + - '118' Content-Type: - application/json; charset=utf-8 ParameterSetName: @@ -744,17 +706,17 @@ 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":{"a":"{''k'': + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_rg_scenario000001","name":"cli_test_rg_scenario000001","type":"Microsoft.Resources/resourceGroups","location":"westus","managedBy":"test_admin","tags":{"a":"{''k'': ''v''}","b":"{\"k\":\"v\"}"},"properties":{"provisioningState":"Succeeded"}}' headers: cache-control: - no-cache content-length: - - '393' + - '418' content-type: - application/json; charset=utf-8 date: - - Fri, 17 Jan 2020 05:44:04 GMT + - Mon, 20 Jan 2020 09:35:05 GMT expires: - '-1' pragma: @@ -768,7 +730,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-writes: - - '1198' + - '1199' status: code: 200 message: OK @@ -807,7 +769,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Fri, 17 Jan 2020 05:44:05 GMT + - Mon, 20 Jan 2020 09:35:06 GMT expires: - '-1' pragma: diff --git a/src/azure-cli/azure/cli/command_modules/resource/tests/latest/recordings/test_resource_group_no_wait.yaml b/src/azure-cli/azure/cli/command_modules/resource/tests/latest/recordings/test_resource_group_no_wait.yaml index ea20e3f0cc9..32160fa7d4e 100644 --- a/src/azure-cli/azure/cli/command_modules/resource/tests/latest/recordings/test_resource_group_no_wait.yaml +++ b/src/azure-cli/azure/cli/command_modules/resource/tests/latest/recordings/test_resource_group_no_wait.yaml @@ -15,8 +15,8 @@ interactions: ParameterSetName: - -n --no-wait --yes User-Agent: - - python/3.7.4 (Windows-10-10.0.18362-SP0) msrest/0.6.10 msrest_azure/0.6.2 - azure-mgmt-resource/4.0.0 Azure-SDK-For-Python AZURECLI/2.0.75 + - python/3.8.0 (Windows-10-10.0.18362-SP0) msrest/0.6.10 msrest_azure/0.6.2 + azure-mgmt-resource/6.0.0 Azure-SDK-For-Python AZURECLI/2.0.79 accept-language: - en-US method: DELETE @@ -30,11 +30,11 @@ interactions: content-length: - '0' date: - - Mon, 21 Oct 2019 05:11:56 GMT + - Wed, 08 Jan 2020 02:37:51 GMT expires: - '-1' location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1DTEk6NUZSRzo1Rk5PV0FJVDo1RlRFU1Q1UlRDS1hMRFNZVVNIQ0hCUDZMTExDSnw1NkE3Qzk0NkM4QzFGRkFGLVdFU1RVUyIsImpvYkxvY2F0aW9uIjoid2VzdHVzIn0?api-version=2019-07-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1DTEk6NUZSRzo1Rk5PV0FJVDo1RlRFU1RLT1pNRE81REdVNVhXM1hFMlhES0hZQXxENEFGOTlENTNERjhDNjAyLVdFU1RVUyIsImpvYkxvY2F0aW9uIjoid2VzdHVzIn0?api-version=2019-07-01 pragma: - no-cache strict-transport-security: @@ -42,7 +42,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-deletes: - - '14999' + - '14998' status: code: 202 message: Accepted @@ -60,15 +60,15 @@ interactions: ParameterSetName: - --deleted -n User-Agent: - - python/3.7.4 (Windows-10-10.0.18362-SP0) msrest/0.6.10 msrest_azure/0.6.2 - azure-mgmt-resource/4.0.0 Azure-SDK-For-Python AZURECLI/2.0.75 + - python/3.8.0 (Windows-10-10.0.18362-SP0) msrest/0.6.10 msrest_azure/0.6.2 + azure-mgmt-resource/6.0.0 Azure-SDK-For-Python AZURECLI/2.0.79 accept-language: - en-US method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_rg_nowait_test000001?api-version=2019-07-01 response: body: - string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_rg_nowait_test000001","name":"cli_rg_nowait_test000001","type":"Microsoft.Resources/resourceGroups","location":"westus","tags":{"product":"azurecli","cause":"automation","date":"2019-10-21T05:11:40Z"},"properties":{"provisioningState":"Deleting"}}' + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_rg_nowait_test000001","name":"cli_rg_nowait_test000001","type":"Microsoft.Resources/resourceGroups","location":"westus","tags":{"product":"azurecli","cause":"automation","date":"2020-01-08T02:37:41Z"},"properties":{"provisioningState":"Deleting"}}' headers: cache-control: - no-cache @@ -77,7 +77,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Mon, 21 Oct 2019 05:11:56 GMT + - Wed, 08 Jan 2020 02:37:52 GMT expires: - '-1' pragma: @@ -105,15 +105,15 @@ interactions: ParameterSetName: - --deleted -n User-Agent: - - python/3.7.4 (Windows-10-10.0.18362-SP0) msrest/0.6.10 msrest_azure/0.6.2 - azure-mgmt-resource/4.0.0 Azure-SDK-For-Python AZURECLI/2.0.75 + - python/3.8.0 (Windows-10-10.0.18362-SP0) msrest/0.6.10 msrest_azure/0.6.2 + azure-mgmt-resource/6.0.0 Azure-SDK-For-Python AZURECLI/2.0.79 accept-language: - en-US method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_rg_nowait_test000001?api-version=2019-07-01 response: body: - string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_rg_nowait_test000001","name":"cli_rg_nowait_test000001","type":"Microsoft.Resources/resourceGroups","location":"westus","tags":{"product":"azurecli","cause":"automation","date":"2019-10-21T05:11:40Z"},"properties":{"provisioningState":"Deleting"}}' + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_rg_nowait_test000001","name":"cli_rg_nowait_test000001","type":"Microsoft.Resources/resourceGroups","location":"westus","tags":{"product":"azurecli","cause":"automation","date":"2020-01-08T02:37:41Z"},"properties":{"provisioningState":"Deleting"}}' headers: cache-control: - no-cache @@ -122,7 +122,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Mon, 21 Oct 2019 05:12:26 GMT + - Wed, 08 Jan 2020 02:38:22 GMT expires: - '-1' pragma: @@ -150,53 +150,8 @@ interactions: ParameterSetName: - --deleted -n User-Agent: - - python/3.7.4 (Windows-10-10.0.18362-SP0) msrest/0.6.10 msrest_azure/0.6.2 - azure-mgmt-resource/4.0.0 Azure-SDK-For-Python AZURECLI/2.0.75 - accept-language: - - en-US - method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_rg_nowait_test000001?api-version=2019-07-01 - response: - body: - string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_rg_nowait_test000001","name":"cli_rg_nowait_test000001","type":"Microsoft.Resources/resourceGroups","location":"westus","tags":{"product":"azurecli","cause":"automation","date":"2019-10-21T05:11:40Z"},"properties":{"provisioningState":"Deleting"}}' - headers: - cache-control: - - no-cache - content-length: - - '427' - content-type: - - application/json; charset=utf-8 - date: - - Mon, 21 Oct 2019 05:12: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: null - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - CommandName: - - group wait - Connection: - - keep-alive - ParameterSetName: - - --deleted -n - User-Agent: - - python/3.7.4 (Windows-10-10.0.18362-SP0) msrest/0.6.10 msrest_azure/0.6.2 - azure-mgmt-resource/4.0.0 Azure-SDK-For-Python AZURECLI/2.0.75 + - python/3.8.0 (Windows-10-10.0.18362-SP0) msrest/0.6.10 msrest_azure/0.6.2 + azure-mgmt-resource/6.0.0 Azure-SDK-For-Python AZURECLI/2.0.79 accept-language: - en-US method: GET @@ -213,7 +168,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Mon, 21 Oct 2019 05:13:27 GMT + - Wed, 08 Jan 2020 02:38:52 GMT expires: - '-1' pragma: @@ -241,8 +196,8 @@ interactions: ParameterSetName: - -n User-Agent: - - python/3.7.4 (Windows-10-10.0.18362-SP0) msrest/0.6.10 msrest_azure/0.6.2 - azure-mgmt-resource/4.0.0 Azure-SDK-For-Python AZURECLI/2.0.75 + - python/3.8.0 (Windows-10-10.0.18362-SP0) msrest/0.6.10 msrest_azure/0.6.2 + azure-mgmt-resource/6.0.0 Azure-SDK-For-Python AZURECLI/2.0.79 accept-language: - en-US method: HEAD @@ -258,7 +213,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Mon, 21 Oct 2019 05:13:27 GMT + - Wed, 08 Jan 2020 02:38:53 GMT expires: - '-1' pragma: @@ -273,7 +228,7 @@ interactions: code: 404 message: Not Found - request: - body: '{"location": "westus"}' + body: '{"location": "westus", "managedBy": "test_admin"}' headers: Accept: - application/json @@ -284,30 +239,30 @@ interactions: Connection: - keep-alive Content-Length: - - '22' + - '49' Content-Type: - application/json; charset=utf-8 ParameterSetName: - - -n -l + - -n -l --managed-by User-Agent: - - python/3.7.4 (Windows-10-10.0.18362-SP0) msrest/0.6.10 msrest_azure/0.6.2 - azure-mgmt-resource/4.0.0 Azure-SDK-For-Python AZURECLI/2.0.75 + - python/3.8.0 (Windows-10-10.0.18362-SP0) msrest/0.6.10 msrest_azure/0.6.2 + azure-mgmt-resource/6.0.0 Azure-SDK-For-Python AZURECLI/2.0.79 accept-language: - en-US method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_rg_nowait_test000001?api-version=2019-07-01 response: body: - string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_rg_nowait_test000001","name":"cli_rg_nowait_test000001","type":"Microsoft.Resources/resourceGroups","location":"westus","properties":{"provisioningState":"Succeeded"}}' + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_rg_nowait_test000001","name":"cli_rg_nowait_test000001","type":"Microsoft.Resources/resourceGroups","location":"westus","managedBy":"test_admin","properties":{"provisioningState":"Succeeded"}}' headers: cache-control: - no-cache content-length: - - '347' + - '372' content-type: - application/json; charset=utf-8 date: - - Mon, 21 Oct 2019 05:13:30 GMT + - Wed, 08 Jan 2020 02:38:59 GMT expires: - '-1' pragma: @@ -317,7 +272,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-writes: - - '1191' + - '1198' status: code: 201 message: Created @@ -335,8 +290,8 @@ interactions: ParameterSetName: - -n User-Agent: - - python/3.7.4 (Windows-10-10.0.18362-SP0) msrest/0.6.10 msrest_azure/0.6.2 - azure-mgmt-resource/4.0.0 Azure-SDK-For-Python AZURECLI/2.0.75 + - python/3.8.0 (Windows-10-10.0.18362-SP0) msrest/0.6.10 msrest_azure/0.6.2 + azure-mgmt-resource/6.0.0 Azure-SDK-For-Python AZURECLI/2.0.79 accept-language: - en-US method: HEAD @@ -350,7 +305,7 @@ interactions: content-length: - '0' date: - - Mon, 21 Oct 2019 05:13:30 GMT + - Wed, 08 Jan 2020 02:39:00 GMT expires: - '-1' pragma: @@ -376,24 +331,24 @@ interactions: ParameterSetName: - --exists -n User-Agent: - - python/3.7.4 (Windows-10-10.0.18362-SP0) msrest/0.6.10 msrest_azure/0.6.2 - azure-mgmt-resource/4.0.0 Azure-SDK-For-Python AZURECLI/2.0.75 + - python/3.8.0 (Windows-10-10.0.18362-SP0) msrest/0.6.10 msrest_azure/0.6.2 + azure-mgmt-resource/6.0.0 Azure-SDK-For-Python AZURECLI/2.0.79 accept-language: - en-US method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_rg_nowait_test000001?api-version=2019-07-01 response: body: - string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_rg_nowait_test000001","name":"cli_rg_nowait_test000001","type":"Microsoft.Resources/resourceGroups","location":"westus","properties":{"provisioningState":"Succeeded"}}' + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_rg_nowait_test000001","name":"cli_rg_nowait_test000001","type":"Microsoft.Resources/resourceGroups","location":"westus","managedBy":"test_admin","properties":{"provisioningState":"Succeeded"}}' headers: cache-control: - no-cache content-length: - - '347' + - '372' content-type: - application/json; charset=utf-8 date: - - Mon, 21 Oct 2019 05:13:31 GMT + - Wed, 08 Jan 2020 02:39:00 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 564ddd68446..8c09a81dd0a 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 @@ -26,9 +26,10 @@ def test_resource_group(self, resource_group): self.cmd('group exists -n {rg}', checks=self.check('@', False)) - self.cmd('group create -n {rg} -l westus --tag a=b c', checks=[ + self.cmd('group create -n {rg} -l westus --tag a=b c --managed-by test_admin', checks=[ self.check('name', '{rg}'), - self.check('tags', {'a': 'b', 'c': ''}) + self.check('tags', {'a': 'b', 'c': ''}), + self.check('managedBy', 'test_admin') ]) self.cmd('group exists -n {rg}', checks=self.check('@', True)) @@ -65,8 +66,10 @@ def test_resource_group_no_wait(self, resource_group): checks=self.is_empty()) self.cmd('group exists -n {rg}', checks=self.check('@', False)) - self.cmd('group create -n {rg} -l westus', - checks=self.check('name', '{rg}')) + self.cmd('group create -n {rg} -l westus --managed-by test_admin', checks=[ + self.check('name', '{rg}'), + self.check('managedBy', 'test_admin') + ]) self.cmd('group exists -n {rg}', checks=self.check('@', True)) self.cmd('group wait --exists -n {rg}',