diff --git a/src/image-copy/azext_imagecopy/create_target.py b/src/image-copy/azext_imagecopy/create_target.py index d5ec78513c2..4d9cf6d465e 100644 --- a/src/image-copy/azext_imagecopy/create_target.py +++ b/src/image-copy/azext_imagecopy/create_target.py @@ -9,6 +9,9 @@ from knack.util import CLIError from knack.log import get_logger +from msrestazure.tools import resource_id +from azure.cli.core.commands.client_factory import get_subscription_id + from azext_imagecopy.cli_utils import run_cli_command, prepare_cli_command logger = get_logger(__name__) @@ -18,7 +21,7 @@ # pylint: disable=too-many-statements # pylint: disable=too-many-locals -def create_target_image(location, transient_resource_group_name, source_type, source_object_name, +def create_target_image(cmd, location, transient_resource_group_name, source_type, source_object_name, source_os_disk_snapshot_name, source_os_disk_snapshot_url, source_os_type, target_resource_group_name, azure_pool_frequency, tags, target_name, target_subscription, export_as_snapshot, timeout): @@ -113,11 +116,21 @@ def create_target_image(location, transient_resource_group_name, source_type, so else: snapshot_resource_group_name = transient_resource_group_name + storage_account_name = target_blob_path.split('.')[0].split('/')[-1] + if target_subscription: + subscription_id = target_subscription + else: + subscription_id = get_subscription_id(cmd.cli_ctx) + source_storage_account_id = resource_id( + subscription=subscription_id, resource_group=transient_resource_group_name, + namespace='Microsoft.Storage', type='storageAccounts', name=storage_account_name) + cli_cmd = prepare_cli_command(['snapshot', 'create', '--resource-group', snapshot_resource_group_name, '--name', target_snapshot_name, '--location', location, - '--source', target_blob_path], + '--source', target_blob_path, + '--source-storage-account-id', source_storage_account_id], subscription=target_subscription) json_output = run_cli_command(cli_cmd, return_as_json=True) diff --git a/src/image-copy/azext_imagecopy/custom.py b/src/image-copy/azext_imagecopy/custom.py index 60129939f51..6cb1556e9f3 100644 --- a/src/image-copy/azext_imagecopy/custom.py +++ b/src/image-copy/azext_imagecopy/custom.py @@ -17,7 +17,7 @@ # pylint: disable=too-many-statements # pylint: disable=too-many-locals # pylint: disable=too-many-branches -def imagecopy(source_resource_group_name, source_object_name, target_location, +def imagecopy(cmd, source_resource_group_name, source_object_name, target_location, target_resource_group_name, temporary_resource_group_name='image-copy-rg', source_type='image', cleanup='false', parallel_degree=-1, tags=None, target_name=None, target_subscription=None, export_as_snapshot='false', timeout=3600): @@ -130,7 +130,7 @@ def imagecopy(source_resource_group_name, source_object_name, target_location, logger.debug("Starting sync process for all locations") for location in target_location: location = location.strip() - create_target_image(location, transient_resource_group_name, source_type, + create_target_image(cmd, location, transient_resource_group_name, source_type, source_object_name, source_os_disk_snapshot_name, source_os_disk_snapshot_url, source_os_type, target_resource_group_name, azure_pool_frequency, tags, target_name, target_subscription, export_as_snapshot, timeout) diff --git a/src/image-copy/azext_imagecopy/tests/latest/recordings/test_image_copy.yaml b/src/image-copy/azext_imagecopy/tests/latest/recordings/test_image_copy.yaml new file mode 100644 index 00000000000..8e7f843efc0 --- /dev/null +++ b/src/image-copy/azext_imagecopy/tests/latest/recordings/test_image_copy.yaml @@ -0,0 +1,1677 @@ +interactions: +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - vm create + Connection: + - keep-alive + ParameterSetName: + - -g -n --image --admin-username --generate-ssh-key + User-Agent: + - python/3.7.4 (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_test_image_copy_000001?api-version=2019-07-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_image_copy_000001","name":"cli_test_image_copy_000001","type":"Microsoft.Resources/resourceGroups","location":"westus","tags":{"product":"azurecli","cause":"automation","date":"2020-01-07T09:01:03Z"},"properties":{"provisioningState":"Succeeded"}}' + headers: + cache-control: + - no-cache + content-length: + - '428' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 07 Jan 2020 09:01:08 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: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - python-requests/2.22.0 + method: GET + uri: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/master/arm-compute/quickstart-templates/aliases.json + response: + body: + string: "{\n \"$schema\": \"http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json\",\n + \ \"contentVersion\": \"1.0.0.0\",\n \"parameters\": {},\n \"variables\": + {},\n \"resources\": [],\n \"outputs\": {\n \"aliases\": {\n \"type\": + \"object\",\n \"value\": {\n \"Linux\": {\n \"CentOS\": + {\n \"publisher\": \"OpenLogic\",\n \"offer\": \"CentOS\",\n + \ \"sku\": \"7.5\",\n \"version\": \"latest\"\n },\n + \ \"CoreOS\": {\n \"publisher\": \"CoreOS\",\n \"offer\": + \"CoreOS\",\n \"sku\": \"Stable\",\n \"version\": \"latest\"\n + \ },\n \"Debian\": {\n \"publisher\": \"Debian\",\n + \ \"offer\": \"debian-10\",\n \"sku\": \"10\",\n \"version\": + \"latest\"\n },\n \"openSUSE-Leap\": {\n \"publisher\": + \"SUSE\",\n \"offer\": \"openSUSE-Leap\",\n \"sku\": + \"42.3\",\n \"version\": \"latest\"\n },\n \"RHEL\": + {\n \"publisher\": \"RedHat\",\n \"offer\": \"RHEL\",\n + \ \"sku\": \"7-LVM\",\n \"version\": \"latest\"\n },\n + \ \"SLES\": {\n \"publisher\": \"SUSE\",\n \"offer\": + \"SLES\",\n \"sku\": \"15\",\n \"version\": \"latest\"\n + \ },\n \"UbuntuLTS\": {\n \"publisher\": \"Canonical\",\n + \ \"offer\": \"UbuntuServer\",\n \"sku\": \"18.04-LTS\",\n + \ \"version\": \"latest\"\n }\n },\n \"Windows\": + {\n \"Win2019Datacenter\": {\n \"publisher\": \"MicrosoftWindowsServer\",\n + \ \"offer\": \"WindowsServer\",\n \"sku\": \"2019-Datacenter\",\n + \ \"version\": \"latest\"\n },\n \"Win2016Datacenter\": + {\n \"publisher\": \"MicrosoftWindowsServer\",\n \"offer\": + \"WindowsServer\",\n \"sku\": \"2016-Datacenter\",\n \"version\": + \"latest\"\n },\n \"Win2012R2Datacenter\": {\n \"publisher\": + \"MicrosoftWindowsServer\",\n \"offer\": \"WindowsServer\",\n \"sku\": + \"2012-R2-Datacenter\",\n \"version\": \"latest\"\n },\n + \ \"Win2012Datacenter\": {\n \"publisher\": \"MicrosoftWindowsServer\",\n + \ \"offer\": \"WindowsServer\",\n \"sku\": \"2012-Datacenter\",\n + \ \"version\": \"latest\"\n },\n \"Win2008R2SP1\": + {\n \"publisher\": \"MicrosoftWindowsServer\",\n \"offer\": + \"WindowsServer\",\n \"sku\": \"2008-R2-SP1\",\n \"version\": + \"latest\"\n }\n }\n }\n }\n }\n}\n" + headers: + accept-ranges: + - bytes + access-control-allow-origin: + - '*' + cache-control: + - max-age=300 + connection: + - keep-alive + content-length: + - '2501' + content-security-policy: + - default-src 'none'; style-src 'unsafe-inline'; sandbox + content-type: + - text/plain; charset=utf-8 + date: + - Tue, 07 Jan 2020 09:01:09 GMT + etag: + - W/"540044b4084c3c314537f1baa1770f248628b2bc9ba0328f1004c33862e049da" + expires: + - Tue, 07 Jan 2020 09:06:09 GMT + source-age: + - '0' + strict-transport-security: + - max-age=31536000 + vary: + - Authorization,Accept-Encoding, Accept-Encoding + via: + - 1.1 varnish + x-cache: + - MISS + x-cache-hits: + - '0' + x-content-type-options: + - nosniff + x-fastly-request-id: + - 72a193fdb3acd818800b30717753d29aadb8db72 + x-frame-options: + - deny + x-geo-block-list: + - '' + x-github-request-id: + - 3EF6:72A5:B765DB:C55B2C:5E1448D3 + x-served-by: + - cache-sin18047-SIN + x-timer: + - S1578387669.928432,VS0,VE228 + x-xss-protection: + - 1; mode=block + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - vm create + Connection: + - keep-alive + ParameterSetName: + - -g -n --image --admin-username --generate-ssh-key + User-Agent: + - python/3.7.4 (Windows-10-10.0.18362-SP0) msrest/0.6.10 msrest_azure/0.6.2 + azure-mgmt-network/7.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_test_image_copy_000001/providers/Microsoft.Network/virtualNetworks?api-version=2018-01-01 + response: + body: + string: '{"value":[]}' + headers: + cache-control: + - no-cache + content-length: + - '12' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 07 Jan 2020 09:01:08 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: 'b''{"properties": {"template": {"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", "parameters": {}, "variables": {}, "resources": + [{"name": "vm1VNET", "type": "Microsoft.Network/virtualNetworks", "location": + "westus", "apiVersion": "2015-06-15", "dependsOn": [], "tags": {}, "properties": + {"addressSpace": {"addressPrefixes": ["10.0.0.0/16"]}, "subnets": [{"name": + "vm1Subnet", "properties": {"addressPrefix": "10.0.0.0/24"}}]}}, {"type": "Microsoft.Network/networkSecurityGroups", + "name": "vm1NSG", "apiVersion": "2015-06-15", "location": "westus", "tags": + {}, "dependsOn": [], "properties": {"securityRules": [{"name": "default-allow-ssh", + "properties": {"protocol": "Tcp", "sourcePortRange": "*", "destinationPortRange": + "22", "sourceAddressPrefix": "*", "destinationAddressPrefix": "*", "access": + "Allow", "priority": 1000, "direction": "Inbound"}}]}}, {"apiVersion": "2018-01-01", + "type": "Microsoft.Network/publicIPAddresses", "name": "vm1PublicIP", "location": + "westus", "tags": {}, "dependsOn": [], "properties": {"publicIPAllocationMethod": + null}}, {"apiVersion": "2015-06-15", "type": "Microsoft.Network/networkInterfaces", + "name": "vm1VMNic", "location": "westus", "tags": {}, "dependsOn": ["Microsoft.Network/virtualNetworks/vm1VNET", + "Microsoft.Network/networkSecurityGroups/vm1NSG", "Microsoft.Network/publicIpAddresses/vm1PublicIP"], + "properties": {"ipConfigurations": [{"name": "ipconfigvm1", "properties": {"privateIPAllocationMethod": + "Dynamic", "subnet": {"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_image_copy_000001/providers/Microsoft.Network/virtualNetworks/vm1VNET/subnets/vm1Subnet"}, + "publicIPAddress": {"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_image_copy_000001/providers/Microsoft.Network/publicIPAddresses/vm1PublicIP"}}}], + "networkSecurityGroup": {"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_image_copy_000001/providers/Microsoft.Network/networkSecurityGroups/vm1NSG"}}}, + {"apiVersion": "2019-07-01", "type": "Microsoft.Compute/virtualMachines", "name": + "vm1", "location": "westus", "tags": {}, "dependsOn": ["Microsoft.Network/networkInterfaces/vm1VMNic"], + "properties": {"hardwareProfile": {"vmSize": "Standard_DS1_v2"}, "networkProfile": + {"networkInterfaces": [{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_image_copy_000001/providers/Microsoft.Network/networkInterfaces/vm1VMNic"}]}, + "storageProfile": {"osDisk": {"createOption": "fromImage", "name": null, "caching": + "ReadWrite", "managedDisk": {"storageAccountType": null}}, "imageReference": + {"publisher": "Canonical", "offer": "UbuntuServer", "sku": "18.04-LTS", "version": + "latest"}}, "osProfile": {"computerName": "vm1", "adminUsername": "clitest1", + "linuxConfiguration": {"disablePasswordAuthentication": true, "ssh": {"publicKeys": + [{"keyData": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDmzXeK++L20uMK/Ug5wpjnWWyMlHoecEOxyHueHc1gPDj8qgLChiHt1OWJ1sDjiqBJ+hEEwZLjN8lCmUvWzzrl20d7M/BVp1ejulE/zr999kWuY3m5+FpAkbbxeO9LWoafwOir9dPzIOjDGdPWKbgHr3SerOHAuvVdXJDhWHtW5lB/MEnrxi48Pz/8k1lD1YccUAI6zDgKVJPBEk9fWMW8H0hKYsRXmlxdtg2npBQK7kbmcB2NJPEhTVgxVPqSaBVAt2lOCC/QQvAXcoD0lJGujp1IVYqSUarS5RnrYEDZ9Q6EKduWrP0GFkFkF8YzpFe+BRFaV8bLJrvZN43vgzRj + fey@DESKTOP-ARGPJS4\\n", "path": "/home/clitest1/.ssh/authorized_keys"}]}}}}}], + "outputs": {}}, "parameters": {}, "mode": "Incremental"}}''' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - vm create + Connection: + - keep-alive + Content-Length: + - '3679' + Content-Type: + - application/json; charset=utf-8 + ParameterSetName: + - -g -n --image --admin-username --generate-ssh-key + User-Agent: + - python/3.7.4 (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_test_image_copy_000001/providers/Microsoft.Resources/deployments/mock-deployment?api-version=2019-07-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_image_copy_000001/providers/Microsoft.Resources/deployments/vm_deploy_JirIz0blZxIbMdVcswm3tCakmxZLgwDb","name":"vm_deploy_JirIz0blZxIbMdVcswm3tCakmxZLgwDb","type":"Microsoft.Resources/deployments","properties":{"templateHash":"10508138101164521096","parameters":{},"mode":"Incremental","provisioningState":"Accepted","timestamp":"2020-01-07T09:01:14.5149517Z","duration":"PT3.4026431S","correlationId":"b47cc505-0ade-4b9f-8dd3-44f337c08e8b","providers":[{"namespace":"Microsoft.Network","resourceTypes":[{"resourceType":"virtualNetworks","locations":["westus"]},{"resourceType":"networkSecurityGroups","locations":["westus"]},{"resourceType":"publicIPAddresses","locations":["westus"]},{"resourceType":"networkInterfaces","locations":["westus"]}]},{"namespace":"Microsoft.Compute","resourceTypes":[{"resourceType":"virtualMachines","locations":["westus"]}]}],"dependencies":[{"dependsOn":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_image_copy_000001/providers/Microsoft.Network/virtualNetworks/vm1VNET","resourceType":"Microsoft.Network/virtualNetworks","resourceName":"vm1VNET"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_image_copy_000001/providers/Microsoft.Network/networkSecurityGroups/vm1NSG","resourceType":"Microsoft.Network/networkSecurityGroups","resourceName":"vm1NSG"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_image_copy_000001/providers/Microsoft.Network/publicIPAddresses/vm1PublicIP","resourceType":"Microsoft.Network/publicIPAddresses","resourceName":"vm1PublicIP"}],"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_image_copy_000001/providers/Microsoft.Network/networkInterfaces/vm1VMNic","resourceType":"Microsoft.Network/networkInterfaces","resourceName":"vm1VMNic"},{"dependsOn":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_image_copy_000001/providers/Microsoft.Network/networkInterfaces/vm1VMNic","resourceType":"Microsoft.Network/networkInterfaces","resourceName":"vm1VMNic"}],"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_image_copy_000001/providers/Microsoft.Compute/virtualMachines/vm1","resourceType":"Microsoft.Compute/virtualMachines","resourceName":"vm1"}]}}' + headers: + azure-asyncoperation: + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_image_copy_000001/providers/Microsoft.Resources/deployments/vm_deploy_JirIz0blZxIbMdVcswm3tCakmxZLgwDb/operationStatuses/08586232192143653346?api-version=2019-07-01 + cache-control: + - no-cache + content-length: + - '2743' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 07 Jan 2020 09:01:15 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1198' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - vm create + Connection: + - keep-alive + ParameterSetName: + - -g -n --image --admin-username --generate-ssh-key + User-Agent: + - python/3.7.4 (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 + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_image_copy_000001/providers/Microsoft.Resources/deployments/mock-deployment/operationStatuses/08586232192143653346?api-version=2019-07-01 + response: + body: + string: '{"status":"Running"}' + headers: + cache-control: + - no-cache + content-length: + - '20' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 07 Jan 2020 09:01:45 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: + - vm create + Connection: + - keep-alive + ParameterSetName: + - -g -n --image --admin-username --generate-ssh-key + User-Agent: + - python/3.7.4 (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 + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_image_copy_000001/providers/Microsoft.Resources/deployments/mock-deployment/operationStatuses/08586232192143653346?api-version=2019-07-01 + response: + body: + string: '{"status":"Running"}' + headers: + cache-control: + - no-cache + content-length: + - '20' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 07 Jan 2020 09:02:16 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: + - vm create + Connection: + - keep-alive + ParameterSetName: + - -g -n --image --admin-username --generate-ssh-key + User-Agent: + - python/3.7.4 (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 + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_image_copy_000001/providers/Microsoft.Resources/deployments/mock-deployment/operationStatuses/08586232192143653346?api-version=2019-07-01 + response: + body: + string: '{"status":"Running"}' + headers: + cache-control: + - no-cache + content-length: + - '20' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 07 Jan 2020 09:02: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: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - vm create + Connection: + - keep-alive + ParameterSetName: + - -g -n --image --admin-username --generate-ssh-key + User-Agent: + - python/3.7.4 (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 + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_image_copy_000001/providers/Microsoft.Resources/deployments/mock-deployment/operationStatuses/08586232192143653346?api-version=2019-07-01 + response: + body: + string: '{"status":"Running"}' + headers: + cache-control: + - no-cache + content-length: + - '20' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 07 Jan 2020 09:03:17 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: + - vm create + Connection: + - keep-alive + ParameterSetName: + - -g -n --image --admin-username --generate-ssh-key + User-Agent: + - python/3.7.4 (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 + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_image_copy_000001/providers/Microsoft.Resources/deployments/mock-deployment/operationStatuses/08586232192143653346?api-version=2019-07-01 + response: + body: + string: '{"status":"Running"}' + headers: + cache-control: + - no-cache + content-length: + - '20' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 07 Jan 2020 09:03: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: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - vm create + Connection: + - keep-alive + ParameterSetName: + - -g -n --image --admin-username --generate-ssh-key + User-Agent: + - python/3.7.4 (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 + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_image_copy_000001/providers/Microsoft.Resources/deployments/mock-deployment/operationStatuses/08586232192143653346?api-version=2019-07-01 + response: + body: + string: '{"status":"Running"}' + headers: + cache-control: + - no-cache + content-length: + - '20' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 07 Jan 2020 09:04:18 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: + - vm create + Connection: + - keep-alive + ParameterSetName: + - -g -n --image --admin-username --generate-ssh-key + User-Agent: + - python/3.7.4 (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 + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_image_copy_000001/providers/Microsoft.Resources/deployments/mock-deployment/operationStatuses/08586232192143653346?api-version=2019-07-01 + response: + body: + string: '{"status":"Succeeded"}' + headers: + cache-control: + - no-cache + content-length: + - '22' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 07 Jan 2020 09:04:48 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: + - vm create + Connection: + - keep-alive + ParameterSetName: + - -g -n --image --admin-username --generate-ssh-key + User-Agent: + - python/3.7.4 (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 + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_image_copy_000001/providers/Microsoft.Resources/deployments/mock-deployment?api-version=2019-07-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_image_copy_000001/providers/Microsoft.Resources/deployments/vm_deploy_JirIz0blZxIbMdVcswm3tCakmxZLgwDb","name":"vm_deploy_JirIz0blZxIbMdVcswm3tCakmxZLgwDb","type":"Microsoft.Resources/deployments","properties":{"templateHash":"10508138101164521096","parameters":{},"mode":"Incremental","provisioningState":"Succeeded","timestamp":"2020-01-07T09:04:40.7954958Z","duration":"PT3M29.6831872S","correlationId":"b47cc505-0ade-4b9f-8dd3-44f337c08e8b","providers":[{"namespace":"Microsoft.Network","resourceTypes":[{"resourceType":"virtualNetworks","locations":["westus"]},{"resourceType":"networkSecurityGroups","locations":["westus"]},{"resourceType":"publicIPAddresses","locations":["westus"]},{"resourceType":"networkInterfaces","locations":["westus"]}]},{"namespace":"Microsoft.Compute","resourceTypes":[{"resourceType":"virtualMachines","locations":["westus"]}]}],"dependencies":[{"dependsOn":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_image_copy_000001/providers/Microsoft.Network/virtualNetworks/vm1VNET","resourceType":"Microsoft.Network/virtualNetworks","resourceName":"vm1VNET"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_image_copy_000001/providers/Microsoft.Network/networkSecurityGroups/vm1NSG","resourceType":"Microsoft.Network/networkSecurityGroups","resourceName":"vm1NSG"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_image_copy_000001/providers/Microsoft.Network/publicIPAddresses/vm1PublicIP","resourceType":"Microsoft.Network/publicIPAddresses","resourceName":"vm1PublicIP"}],"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_image_copy_000001/providers/Microsoft.Network/networkInterfaces/vm1VMNic","resourceType":"Microsoft.Network/networkInterfaces","resourceName":"vm1VMNic"},{"dependsOn":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_image_copy_000001/providers/Microsoft.Network/networkInterfaces/vm1VMNic","resourceType":"Microsoft.Network/networkInterfaces","resourceName":"vm1VMNic"}],"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_image_copy_000001/providers/Microsoft.Compute/virtualMachines/vm1","resourceType":"Microsoft.Compute/virtualMachines","resourceName":"vm1"}],"outputs":{},"outputResources":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_image_copy_000001/providers/Microsoft.Compute/virtualMachines/vm1"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_image_copy_000001/providers/Microsoft.Network/networkInterfaces/vm1VMNic"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_image_copy_000001/providers/Microsoft.Network/networkSecurityGroups/vm1NSG"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_image_copy_000001/providers/Microsoft.Network/publicIPAddresses/vm1PublicIP"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_image_copy_000001/providers/Microsoft.Network/virtualNetworks/vm1VNET"}]}}' + headers: + cache-control: + - no-cache + content-length: + - '3810' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 07 Jan 2020 09:04:48 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: + - vm create + Connection: + - keep-alive + ParameterSetName: + - -g -n --image --admin-username --generate-ssh-key + User-Agent: + - python/3.7.4 (Windows-10-10.0.18362-SP0) msrest/0.6.10 msrest_azure/0.6.2 + azure-mgmt-compute/10.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_test_image_copy_000001/providers/Microsoft.Compute/virtualMachines/vm1?$expand=instanceView&api-version=2019-07-01 + response: + body: + string: "{\r\n \"name\": \"vm1\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_image_copy_000001/providers/Microsoft.Compute/virtualMachines/vm1\",\r\n + \ \"type\": \"Microsoft.Compute/virtualMachines\",\r\n \"location\": \"westus\",\r\n + \ \"tags\": {},\r\n \"properties\": {\r\n \"vmId\": \"f4129676-4e89-4610-a8e5-0ce3cf324330\",\r\n + \ \"hardwareProfile\": {\r\n \"vmSize\": \"Standard_DS1_v2\"\r\n },\r\n + \ \"storageProfile\": {\r\n \"imageReference\": {\r\n \"publisher\": + \"Canonical\",\r\n \"offer\": \"UbuntuServer\",\r\n \"sku\": + \"18.04-LTS\",\r\n \"version\": \"latest\",\r\n \"exactVersion\": + \"18.04.201912180\"\r\n },\r\n \"osDisk\": {\r\n \"osType\": + \"Linux\",\r\n \"name\": \"vm1_disk1_4353dcf233c64173a96f8cb4781e2310\",\r\n + \ \"createOption\": \"FromImage\",\r\n \"caching\": \"ReadWrite\",\r\n + \ \"managedDisk\": {\r\n \"storageAccountType\": \"Premium_LRS\",\r\n + \ \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_image_copy_000001/providers/Microsoft.Compute/disks/vm1_disk1_4353dcf233c64173a96f8cb4781e2310\"\r\n + \ },\r\n \"diskSizeGB\": 30\r\n },\r\n \"dataDisks\": + []\r\n },\r\n \"osProfile\": {\r\n \"computerName\": \"vm1\",\r\n + \ \"adminUsername\": \"clitest1\",\r\n \"linuxConfiguration\": {\r\n + \ \"disablePasswordAuthentication\": true,\r\n \"ssh\": {\r\n + \ \"publicKeys\": [\r\n {\r\n \"path\": \"/home/clitest1/.ssh/authorized_keys\",\r\n + \ \"keyData\": \"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDmzXeK++L20uMK/Ug5wpjnWWyMlHoecEOxyHueHc1gPDj8qgLChiHt1OWJ1sDjiqBJ+hEEwZLjN8lCmUvWzzrl20d7M/BVp1ejulE/zr999kWuY3m5+FpAkbbxeO9LWoafwOir9dPzIOjDGdPWKbgHr3SerOHAuvVdXJDhWHtW5lB/MEnrxi48Pz/8k1lD1YccUAI6zDgKVJPBEk9fWMW8H0hKYsRXmlxdtg2npBQK7kbmcB2NJPEhTVgxVPqSaBVAt2lOCC/QQvAXcoD0lJGujp1IVYqSUarS5RnrYEDZ9Q6EKduWrP0GFkFkF8YzpFe+BRFaV8bLJrvZN43vgzRj + fey@DESKTOP-ARGPJS4\\n\"\r\n }\r\n ]\r\n },\r\n + \ \"provisionVMAgent\": true\r\n },\r\n \"secrets\": [],\r\n + \ \"allowExtensionOperations\": true,\r\n \"requireGuestProvisionSignal\": + true\r\n },\r\n \"networkProfile\": {\"networkInterfaces\":[{\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_image_copy_000001/providers/Microsoft.Network/networkInterfaces/vm1VMNic\"}]},\r\n + \ \"provisioningState\": \"Succeeded\",\r\n \"instanceView\": {\r\n \"vmAgent\": + {\r\n \"vmAgentVersion\": \"Unknown\",\r\n \"statuses\": [\r\n + \ {\r\n \"code\": \"ProvisioningState/Unavailable\",\r\n + \ \"level\": \"Warning\",\r\n \"displayStatus\": \"Not + Ready\",\r\n \"message\": \"VM status blob is found but not yet + populated.\",\r\n \"time\": \"2020-01-07T09:04:50+00:00\"\r\n }\r\n + \ ]\r\n },\r\n \"disks\": [\r\n {\r\n \"name\": + \"vm1_disk1_4353dcf233c64173a96f8cb4781e2310\",\r\n \"statuses\": + [\r\n {\r\n \"code\": \"ProvisioningState/succeeded\",\r\n + \ \"level\": \"Info\",\r\n \"displayStatus\": \"Provisioning + succeeded\",\r\n \"time\": \"2020-01-07T09:04:25.374803+00:00\"\r\n + \ }\r\n ]\r\n }\r\n ],\r\n \"hyperVGeneration\": + \"V1\",\r\n \"statuses\": [\r\n {\r\n \"code\": \"ProvisioningState/succeeded\",\r\n + \ \"level\": \"Info\",\r\n \"displayStatus\": \"Provisioning + succeeded\",\r\n \"time\": \"2020-01-07T09:04:36.406061+00:00\"\r\n + \ },\r\n {\r\n \"code\": \"PowerState/running\",\r\n + \ \"level\": \"Info\",\r\n \"displayStatus\": \"VM running\"\r\n + \ }\r\n ]\r\n }\r\n }\r\n}" + headers: + cache-control: + - no-cache + content-length: + - '3675' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 07 Jan 2020 09:04:50 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-ratelimit-remaining-resource: + - Microsoft.Compute/LowCostGet3Min;3992,Microsoft.Compute/LowCostGet30Min;31939 + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - vm create + Connection: + - keep-alive + ParameterSetName: + - -g -n --image --admin-username --generate-ssh-key + User-Agent: + - python/3.7.4 (Windows-10-10.0.18362-SP0) msrest/0.6.10 msrest_azure/0.6.2 + azure-mgmt-network/7.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_test_image_copy_000001/providers/Microsoft.Network/networkInterfaces/vm1VMNic?api-version=2018-01-01 + response: + body: + string: "{\r\n \"name\": \"vm1VMNic\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_image_copy_000001/providers/Microsoft.Network/networkInterfaces/vm1VMNic\",\r\n + \ \"etag\": \"W/\\\"02eccb57-c720-4c36-b781-3ed4400c3615\\\"\",\r\n \"location\": + \"westus\",\r\n \"tags\": {},\r\n \"properties\": {\r\n \"provisioningState\": + \"Succeeded\",\r\n \"resourceGuid\": \"e5d3778d-501a-47e4-9735-e81c6a3ac2e5\",\r\n + \ \"ipConfigurations\": [\r\n {\r\n \"name\": \"ipconfigvm1\",\r\n + \ \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_image_copy_000001/providers/Microsoft.Network/networkInterfaces/vm1VMNic/ipConfigurations/ipconfigvm1\",\r\n + \ \"etag\": \"W/\\\"02eccb57-c720-4c36-b781-3ed4400c3615\\\"\",\r\n + \ \"type\": \"Microsoft.Network/networkInterfaces/ipConfigurations\",\r\n + \ \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n + \ \"privateIPAddress\": \"10.0.0.4\",\r\n \"privateIPAllocationMethod\": + \"Dynamic\",\r\n \"publicIPAddress\": {\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_image_copy_000001/providers/Microsoft.Network/publicIPAddresses/vm1PublicIP\"\r\n + \ },\r\n \"subnet\": {\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_image_copy_000001/providers/Microsoft.Network/virtualNetworks/vm1VNET/subnets/vm1Subnet\"\r\n + \ },\r\n \"primary\": true,\r\n \"privateIPAddressVersion\": + \"IPv4\"\r\n }\r\n }\r\n ],\r\n \"dnsSettings\": {\r\n \"dnsServers\": + [],\r\n \"appliedDnsServers\": [],\r\n \"internalDomainNameSuffix\": + \"ghpkgr3paguuvh5tl1h2tn1otf.dx.internal.cloudapp.net\"\r\n },\r\n \"macAddress\": + \"00-0D-3A-37-1A-01\",\r\n \"enableAcceleratedNetworking\": false,\r\n + \ \"enableIPForwarding\": false,\r\n \"networkSecurityGroup\": {\r\n + \ \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_image_copy_000001/providers/Microsoft.Network/networkSecurityGroups/vm1NSG\"\r\n + \ },\r\n \"primary\": true,\r\n \"virtualMachine\": {\r\n \"id\": + \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_image_copy_000001/providers/Microsoft.Compute/virtualMachines/vm1\"\r\n + \ }\r\n },\r\n \"type\": \"Microsoft.Network/networkInterfaces\"\r\n}" + headers: + cache-control: + - no-cache + content-length: + - '2568' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 07 Jan 2020 09:04:50 GMT + etag: + - W/"02eccb57-c720-4c36-b781-3ed4400c3615" + 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: + - 701a8848-77dd-4b21-99c4-eb89404db332 + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - vm create + Connection: + - keep-alive + ParameterSetName: + - -g -n --image --admin-username --generate-ssh-key + User-Agent: + - python/3.7.4 (Windows-10-10.0.18362-SP0) msrest/0.6.10 msrest_azure/0.6.2 + azure-mgmt-network/7.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_test_image_copy_000001/providers/Microsoft.Network/publicIPAddresses/vm1PublicIP?api-version=2018-01-01 + response: + body: + string: "{\r\n \"name\": \"vm1PublicIP\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_image_copy_000001/providers/Microsoft.Network/publicIPAddresses/vm1PublicIP\",\r\n + \ \"etag\": \"W/\\\"bcb090b1-3571-4489-be2c-c3005d591423\\\"\",\r\n \"location\": + \"westus\",\r\n \"tags\": {},\r\n \"properties\": {\r\n \"provisioningState\": + \"Succeeded\",\r\n \"resourceGuid\": \"764d4f0c-c2c6-4407-bef8-cc47961da6be\",\r\n + \ \"ipAddress\": \"40.83.255.144\",\r\n \"publicIPAddressVersion\": \"IPv4\",\r\n + \ \"publicIPAllocationMethod\": \"Dynamic\",\r\n \"idleTimeoutInMinutes\": + 4,\r\n \"ipTags\": [],\r\n \"ipConfiguration\": {\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_image_copy_000001/providers/Microsoft.Network/networkInterfaces/vm1VMNic/ipConfigurations/ipconfigvm1\"\r\n + \ }\r\n },\r\n \"type\": \"Microsoft.Network/publicIPAddresses\",\r\n + \ \"sku\": {\r\n \"name\": \"Basic\"\r\n }\r\n}" + headers: + cache-control: + - no-cache + content-length: + - '997' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 07 Jan 2020 09:04:50 GMT + etag: + - W/"bcb090b1-3571-4489-be2c-c3005d591423" + 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: + - f0c98e37-e2c1-4a13-81a9-86031e15aaf5 + status: + code: 200 + message: OK +- request: + body: '{"commandId": "RunShellScript", "script": ["echo ''sudo waagent -deprovision+user + --force'' | at -M now + 1 minutes"], "parameters": []}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - vm run-command invoke + Connection: + - keep-alive + Content-Length: + - '134' + Content-Type: + - application/json; charset=utf-8 + ParameterSetName: + - -g -n --command-id --scripts + User-Agent: + - python/3.7.4 (Windows-10-10.0.18362-SP0) msrest/0.6.10 msrest_azure/0.6.2 + azure-mgmt-compute/10.0.0 Azure-SDK-For-Python AZURECLI/2.0.79 + accept-language: + - en-US + method: POST + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_image_copy_000001/providers/Microsoft.Compute/virtualMachines/vm1/runCommand?api-version=2019-07-01 + response: + body: + string: '' + headers: + azure-asyncoperation: + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/westus/operations/df1a0791-d532-449e-9918-1831b8fbf0bb?api-version=2019-07-01 + cache-control: + - no-cache + content-length: + - '0' + date: + - Tue, 07 Jan 2020 09:04:52 GMT + expires: + - '-1' + location: + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/westus/operations/df1a0791-d532-449e-9918-1831b8fbf0bb?monitor=true&api-version=2019-07-01 + 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-ratelimit-remaining-resource: + - Microsoft.Compute/UpdateVM3Min;239,Microsoft.Compute/UpdateVM30Min;1197 + x-ms-ratelimit-remaining-subscription-writes: + - '1196' + status: + code: 202 + message: Accepted +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - vm run-command invoke + Connection: + - keep-alive + ParameterSetName: + - -g -n --command-id --scripts + User-Agent: + - python/3.7.4 (Windows-10-10.0.18362-SP0) msrest/0.6.10 msrest_azure/0.6.2 + azure-mgmt-compute/10.0.0 Azure-SDK-For-Python AZURECLI/2.0.79 + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/westus/operations/df1a0791-d532-449e-9918-1831b8fbf0bb?api-version=2019-07-01 + response: + body: + string: "{\r\n \"startTime\": \"2020-01-07T09:04:52.8123551+00:00\",\r\n \"endTime\": + \"2020-01-07T09:05:08.7029695+00:00\",\r\n \"status\": \"Succeeded\",\r\n + \ \"properties\": {\r\n \"output\": {\"value\":[{\"code\":\"ProvisioningState/succeeded\",\"level\":\"Info\",\"displayStatus\":\"Provisioning + succeeded\",\"message\":\"Enable succeeded: \\n[stdout]\\n\\n[stderr]\\nwarning: + commands will be executed using /bin/sh\\njob 1 at Tue Jan 7 09:06:00 2020\\n\"}]}\r\n + \ },\r\n \"name\": \"df1a0791-d532-449e-9918-1831b8fbf0bb\"\r\n}" + headers: + cache-control: + - no-cache + content-length: + - '471' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 07 Jan 2020 09:05:23 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-ratelimit-remaining-resource: + - Microsoft.Compute/GetOperation3Min;14996,Microsoft.Compute/GetOperation30Min;29976 + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - vm run-command invoke + Connection: + - keep-alive + ParameterSetName: + - -g -n --command-id --scripts + User-Agent: + - python/3.7.4 (Windows-10-10.0.18362-SP0) msrest/0.6.10 msrest_azure/0.6.2 + azure-mgmt-compute/10.0.0 Azure-SDK-For-Python AZURECLI/2.0.79 + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/westus/operations/df1a0791-d532-449e-9918-1831b8fbf0bb?monitor=true&api-version=2019-07-01 + response: + body: + string: '{"value":[{"code":"ProvisioningState/succeeded","level":"Info","displayStatus":"Provisioning + succeeded","message":"Enable succeeded: \n[stdout]\n\n[stderr]\nwarning: commands + will be executed using /bin/sh\njob 1 at Tue Jan 7 09:06:00 2020\n"}]}' + headers: + cache-control: + - no-cache + content-length: + - '246' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 07 Jan 2020 09:05:23 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-ratelimit-remaining-resource: + - Microsoft.Compute/GetOperation3Min;14995,Microsoft.Compute/GetOperation30Min;29975 + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - vm deallocate + Connection: + - keep-alive + Content-Length: + - '0' + ParameterSetName: + - -g -n + User-Agent: + - python/3.7.4 (Windows-10-10.0.18362-SP0) msrest/0.6.10 msrest_azure/0.6.2 + azure-mgmt-compute/10.0.0 Azure-SDK-For-Python AZURECLI/2.0.79 + accept-language: + - en-US + method: POST + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_image_copy_000001/providers/Microsoft.Compute/virtualMachines/vm1/deallocate?api-version=2019-07-01 + response: + body: + string: '' + headers: + azure-asyncoperation: + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/westus/operations/8fd4b891-8c89-46e4-8124-4fb0612be3f8?api-version=2019-07-01 + cache-control: + - no-cache + content-length: + - '0' + date: + - Tue, 07 Jan 2020 09:06:34 GMT + expires: + - '-1' + location: + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/westus/operations/8fd4b891-8c89-46e4-8124-4fb0612be3f8?monitor=true&api-version=2019-07-01 + 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-ratelimit-remaining-resource: + - Microsoft.Compute/DeleteVM3Min;239,Microsoft.Compute/DeleteVM30Min;1196 + x-ms-ratelimit-remaining-subscription-writes: + - '1191' + status: + code: 202 + message: Accepted +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - vm deallocate + Connection: + - keep-alive + ParameterSetName: + - -g -n + User-Agent: + - python/3.7.4 (Windows-10-10.0.18362-SP0) msrest/0.6.10 msrest_azure/0.6.2 + azure-mgmt-compute/10.0.0 Azure-SDK-For-Python AZURECLI/2.0.79 + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/westus/operations/8fd4b891-8c89-46e4-8124-4fb0612be3f8?api-version=2019-07-01 + response: + body: + string: "{\r\n \"startTime\": \"2020-01-07T09:06:34.8436005+00:00\",\r\n \"status\": + \"InProgress\",\r\n \"name\": \"8fd4b891-8c89-46e4-8124-4fb0612be3f8\"\r\n}" + headers: + cache-control: + - no-cache + content-length: + - '134' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 07 Jan 2020 09:06:45 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-ratelimit-remaining-resource: + - Microsoft.Compute/GetOperation3Min;14994,Microsoft.Compute/GetOperation30Min;29974 + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - vm deallocate + Connection: + - keep-alive + ParameterSetName: + - -g -n + User-Agent: + - python/3.7.4 (Windows-10-10.0.18362-SP0) msrest/0.6.10 msrest_azure/0.6.2 + azure-mgmt-compute/10.0.0 Azure-SDK-For-Python AZURECLI/2.0.79 + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/westus/operations/8fd4b891-8c89-46e4-8124-4fb0612be3f8?api-version=2019-07-01 + response: + body: + string: "{\r\n \"startTime\": \"2020-01-07T09:06:34.8436005+00:00\",\r\n \"status\": + \"InProgress\",\r\n \"name\": \"8fd4b891-8c89-46e4-8124-4fb0612be3f8\"\r\n}" + headers: + cache-control: + - no-cache + content-length: + - '134' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 07 Jan 2020 09:07:21 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-ratelimit-remaining-resource: + - Microsoft.Compute/GetOperation3Min;14990,Microsoft.Compute/GetOperation30Min;29970 + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - vm deallocate + Connection: + - keep-alive + ParameterSetName: + - -g -n + User-Agent: + - python/3.7.4 (Windows-10-10.0.18362-SP0) msrest/0.6.10 msrest_azure/0.6.2 + azure-mgmt-compute/10.0.0 Azure-SDK-For-Python AZURECLI/2.0.79 + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/westus/operations/8fd4b891-8c89-46e4-8124-4fb0612be3f8?api-version=2019-07-01 + response: + body: + string: "{\r\n \"startTime\": \"2020-01-07T09:06:34.8436005+00:00\",\r\n \"endTime\": + \"2020-01-07T09:07:25.6404857+00:00\",\r\n \"status\": \"Succeeded\",\r\n + \ \"name\": \"8fd4b891-8c89-46e4-8124-4fb0612be3f8\"\r\n}" + headers: + cache-control: + - no-cache + content-length: + - '184' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 07 Jan 2020 09:07: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-ratelimit-remaining-resource: + - Microsoft.Compute/GetOperation3Min;14990,Microsoft.Compute/GetOperation30Min;29968 + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - vm generalize + Connection: + - keep-alive + Content-Length: + - '0' + ParameterSetName: + - -g -n + User-Agent: + - python/3.7.4 (Windows-10-10.0.18362-SP0) msrest/0.6.10 msrest_azure/0.6.2 + azure-mgmt-compute/10.0.0 Azure-SDK-For-Python AZURECLI/2.0.79 + accept-language: + - en-US + method: POST + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_image_copy_000001/providers/Microsoft.Compute/virtualMachines/vm1/generalize?api-version=2019-07-01 + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Tue, 07 Jan 2020 09:07:54 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-ratelimit-remaining-resource: + - Microsoft.Compute/UpdateVM3Min;239,Microsoft.Compute/UpdateVM30Min;1196 + x-ms-ratelimit-remaining-subscription-writes: + - '1195' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - image create + Connection: + - keep-alive + ParameterSetName: + - -g -n --source + User-Agent: + - python/3.7.4 (Windows-10-10.0.18362-SP0) msrest/0.6.10 msrest_azure/0.6.2 + azure-mgmt-compute/10.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_test_image_copy_000001/providers/Microsoft.Compute/virtualMachines/vm1?api-version=2019-07-01 + response: + body: + string: "{\r\n \"name\": \"vm1\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_image_copy_000001/providers/Microsoft.Compute/virtualMachines/vm1\",\r\n + \ \"type\": \"Microsoft.Compute/virtualMachines\",\r\n \"location\": \"westus\",\r\n + \ \"tags\": {},\r\n \"properties\": {\r\n \"vmId\": \"f4129676-4e89-4610-a8e5-0ce3cf324330\",\r\n + \ \"hardwareProfile\": {\r\n \"vmSize\": \"Standard_DS1_v2\"\r\n },\r\n + \ \"storageProfile\": {\r\n \"imageReference\": {\r\n \"publisher\": + \"Canonical\",\r\n \"offer\": \"UbuntuServer\",\r\n \"sku\": + \"18.04-LTS\",\r\n \"version\": \"latest\",\r\n \"exactVersion\": + \"18.04.201912180\"\r\n },\r\n \"osDisk\": {\r\n \"osType\": + \"Linux\",\r\n \"name\": \"vm1_disk1_4353dcf233c64173a96f8cb4781e2310\",\r\n + \ \"createOption\": \"FromImage\",\r\n \"caching\": \"ReadWrite\",\r\n + \ \"managedDisk\": {\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_image_copy_000001/providers/Microsoft.Compute/disks/vm1_disk1_4353dcf233c64173a96f8cb4781e2310\"\r\n + \ }\r\n },\r\n \"dataDisks\": []\r\n },\r\n \"osProfile\": + {\r\n \"computerName\": \"vm1\",\r\n \"adminUsername\": \"clitest1\",\r\n + \ \"linuxConfiguration\": {\r\n \"disablePasswordAuthentication\": + true,\r\n \"ssh\": {\r\n \"publicKeys\": [\r\n {\r\n + \ \"path\": \"/home/clitest1/.ssh/authorized_keys\",\r\n \"keyData\": + \"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDmzXeK++L20uMK/Ug5wpjnWWyMlHoecEOxyHueHc1gPDj8qgLChiHt1OWJ1sDjiqBJ+hEEwZLjN8lCmUvWzzrl20d7M/BVp1ejulE/zr999kWuY3m5+FpAkbbxeO9LWoafwOir9dPzIOjDGdPWKbgHr3SerOHAuvVdXJDhWHtW5lB/MEnrxi48Pz/8k1lD1YccUAI6zDgKVJPBEk9fWMW8H0hKYsRXmlxdtg2npBQK7kbmcB2NJPEhTVgxVPqSaBVAt2lOCC/QQvAXcoD0lJGujp1IVYqSUarS5RnrYEDZ9Q6EKduWrP0GFkFkF8YzpFe+BRFaV8bLJrvZN43vgzRj + fey@DESKTOP-ARGPJS4\\n\"\r\n }\r\n ]\r\n },\r\n + \ \"provisionVMAgent\": true\r\n },\r\n \"secrets\": [],\r\n + \ \"allowExtensionOperations\": true,\r\n \"requireGuestProvisionSignal\": + true\r\n },\r\n \"networkProfile\": {\"networkInterfaces\":[{\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_image_copy_000001/providers/Microsoft.Network/networkInterfaces/vm1VMNic\"}]},\r\n + \ \"provisioningState\": \"Succeeded\"\r\n }\r\n}" + headers: + cache-control: + - no-cache + content-length: + - '2399' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 07 Jan 2020 09:07:54 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-ratelimit-remaining-resource: + - Microsoft.Compute/LowCostGet3Min;3994,Microsoft.Compute/LowCostGet30Min;31952 + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - image create + Connection: + - keep-alive + ParameterSetName: + - -g -n --source + User-Agent: + - python/3.7.4 (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_test_image_copy_000001?api-version=2019-07-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_image_copy_000001","name":"cli_test_image_copy_000001","type":"Microsoft.Resources/resourceGroups","location":"westus","tags":{"product":"azurecli","cause":"automation","date":"2020-01-07T09:01:03Z"},"properties":{"provisioningState":"Succeeded"}}' + headers: + cache-control: + - no-cache + content-length: + - '428' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 07 Jan 2020 09:07:55 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: 'b''{"location": "westus", "tags": {}, "properties": {"sourceVirtualMachine": + {"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_image_copy_000001/providers/Microsoft.Compute/virtualMachines/vm1"}, + "hyperVGeneration": "V1"}}''' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - image create + Connection: + - keep-alive + Content-Length: + - '302' + Content-Type: + - application/json; charset=utf-8 + ParameterSetName: + - -g -n --source + User-Agent: + - python/3.7.4 (Windows-10-10.0.18362-SP0) msrest/0.6.10 msrest_azure/0.6.2 + azure-mgmt-compute/10.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_test_image_copy_000001/providers/Microsoft.Compute/images/image1?api-version=2019-07-01 + response: + body: + string: "{\r\n \"name\": \"image1\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_image_copy_000001/providers/Microsoft.Compute/images/image1\",\r\n + \ \"type\": \"Microsoft.Compute/images\",\r\n \"location\": \"westus\",\r\n + \ \"tags\": {},\r\n \"properties\": {\r\n \"sourceVirtualMachine\": {\r\n + \ \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_image_copy_000001/providers/Microsoft.Compute/virtualMachines/vm1\"\r\n + \ },\r\n \"storageProfile\": {\r\n \"osDisk\": {\r\n \"osType\": + \"Linux\",\r\n \"osState\": \"Generalized\",\r\n \"managedDisk\": + {\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_image_copy_000001/providers/Microsoft.Compute/disks/vm1_disk1_4353dcf233c64173a96f8cb4781e2310\"\r\n + \ },\r\n \"caching\": \"ReadWrite\",\r\n \"storageAccountType\": + \"Premium_LRS\"\r\n },\r\n \"dataDisks\": []\r\n },\r\n \"provisioningState\": + \"Creating\",\r\n \"hyperVGeneration\": \"V1\"\r\n }\r\n}" + headers: + azure-asyncnotification: + - Enabled + azure-asyncoperation: + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/westus/operations/3e189a12-e24d-4db1-8422-f8c3d28aa212?api-version=2019-07-01 + cache-control: + - no-cache + content-length: + - '1141' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 07 Jan 2020 09:08:01 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-ratelimit-remaining-resource: + - Microsoft.Compute/CreateImages3Min;39,Microsoft.Compute/CreateImages30Min;198 + x-ms-ratelimit-remaining-subscription-writes: + - '1197' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - image create + Connection: + - keep-alive + ParameterSetName: + - -g -n --source + User-Agent: + - python/3.7.4 (Windows-10-10.0.18362-SP0) msrest/0.6.10 msrest_azure/0.6.2 + azure-mgmt-compute/10.0.0 Azure-SDK-For-Python AZURECLI/2.0.79 + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/westus/operations/3e189a12-e24d-4db1-8422-f8c3d28aa212?api-version=2019-07-01 + response: + body: + string: "{\r\n \"startTime\": \"2020-01-07T09:08:00.4530083+00:00\",\r\n \"endTime\": + \"2020-01-07T09:08:05.5623772+00:00\",\r\n \"status\": \"Succeeded\",\r\n + \ \"name\": \"3e189a12-e24d-4db1-8422-f8c3d28aa212\"\r\n}" + headers: + cache-control: + - no-cache + content-length: + - '184' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 07 Jan 2020 09:08:32 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-ratelimit-remaining-resource: + - Microsoft.Compute/GetOperation3Min;14991,Microsoft.Compute/GetOperation30Min;29966 + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - image create + Connection: + - keep-alive + ParameterSetName: + - -g -n --source + User-Agent: + - python/3.7.4 (Windows-10-10.0.18362-SP0) msrest/0.6.10 msrest_azure/0.6.2 + azure-mgmt-compute/10.0.0 Azure-SDK-For-Python AZURECLI/2.0.79 + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_image_copy_000001/providers/Microsoft.Compute/images/image1?api-version=2019-07-01 + response: + body: + string: "{\r\n \"name\": \"image1\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_image_copy_000001/providers/Microsoft.Compute/images/image1\",\r\n + \ \"type\": \"Microsoft.Compute/images\",\r\n \"location\": \"westus\",\r\n + \ \"tags\": {},\r\n \"properties\": {\r\n \"sourceVirtualMachine\": {\r\n + \ \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_image_copy_000001/providers/Microsoft.Compute/virtualMachines/vm1\"\r\n + \ },\r\n \"storageProfile\": {\r\n \"osDisk\": {\r\n \"osType\": + \"Linux\",\r\n \"osState\": \"Generalized\",\r\n \"diskSizeGB\": + 30,\r\n \"managedDisk\": {\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_image_copy_000001/providers/Microsoft.Compute/disks/vm1_disk1_4353dcf233c64173a96f8cb4781e2310\"\r\n + \ },\r\n \"caching\": \"ReadWrite\",\r\n \"storageAccountType\": + \"Premium_LRS\"\r\n },\r\n \"dataDisks\": []\r\n },\r\n \"provisioningState\": + \"Succeeded\",\r\n \"hyperVGeneration\": \"V1\"\r\n }\r\n}" + headers: + cache-control: + - no-cache + content-length: + - '1169' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 07 Jan 2020 09:08:32 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-ratelimit-remaining-resource: + - Microsoft.Compute/GetImages3Min;354,Microsoft.Compute/GetImages30Min;1785 + status: + code: 200 + message: OK +- request: + body: '{"location": "eastus"}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - group create + Connection: + - keep-alive + Content-Length: + - '22' + Content-Type: + - application/json; charset=utf-8 + ParameterSetName: + - -g -l + User-Agent: + - python/3.7.4 (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_test_image_copy_000002?api-version=2019-07-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_image_copy_000002","name":"cli_test_image_copy_000002","type":"Microsoft.Resources/resourceGroups","location":"eastus","properties":{"provisioningState":"Succeeded"}}' + headers: + cache-control: + - no-cache + content-length: + - '257' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 07 Jan 2020 09:08:37 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1197' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - image show + Connection: + - keep-alive + ParameterSetName: + - -g -n + User-Agent: + - python/3.7.4 (Windows-10-10.0.18362-SP0) msrest/0.6.10 msrest_azure/0.6.2 + azure-mgmt-compute/10.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_test_image_copy_000002/providers/Microsoft.Compute/images/image1?api-version=2019-07-01 + response: + body: + string: "{\r\n \"name\": \"image1\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_image_copy_000002/providers/Microsoft.Compute/images/image1\",\r\n + \ \"type\": \"Microsoft.Compute/images\",\r\n \"location\": \"eastus\",\r\n + \ \"tags\": {\r\n \"created_by\": \"image-copy-extension\"\r\n },\r\n + \ \"properties\": {\r\n \"storageProfile\": {\r\n \"osDisk\": {\r\n + \ \"osType\": \"Linux\",\r\n \"osState\": \"Generalized\",\r\n + \ \"diskSizeGB\": 30,\r\n \"snapshot\": {\r\n \"id\": + \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/image-copy-rg/providers/Microsoft.Compute/snapshots/image1_os_disk_snapshot-eastus\"\r\n + \ },\r\n \"caching\": \"None\",\r\n \"storageAccountType\": + \"Standard_LRS\"\r\n },\r\n \"dataDisks\": []\r\n },\r\n \"provisioningState\": + \"Succeeded\",\r\n \"hyperVGeneration\": \"V1\"\r\n }\r\n}" + headers: + cache-control: + - no-cache + content-length: + - '848' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 07 Jan 2020 09:16:54 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-ratelimit-remaining-resource: + - Microsoft.Compute/GetImages3Min;357,Microsoft.Compute/GetImages30Min;1793 + status: + code: 200 + message: OK +version: 1 diff --git a/src/image-copy/azext_imagecopy/tests/latest/test_image_copy_commands.py b/src/image-copy/azext_imagecopy/tests/latest/test_image_copy_commands.py new file mode 100644 index 00000000000..162d0dee069 --- /dev/null +++ b/src/image-copy/azext_imagecopy/tests/latest/test_image_copy_commands.py @@ -0,0 +1,31 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + +import time +from azure.cli.testsdk import ScenarioTest, ResourceGroupPreparer, live_only + + +class ImageCopyTests(ScenarioTest): + + @live_only() + @ResourceGroupPreparer(name_prefix='cli_test_image_copy_', location='westus') + def test_image_copy(self, resource_group): + self.kwargs.update({ + 'vm': 'vm1', + 'image': 'image1', + 'rg2': self.create_random_name(prefix='cli_test_image_copy_', length=30) + }) + + self.cmd('vm create -g {rg} -n {vm} --image ubuntults --admin-username clitest1 --generate-ssh-key') + self.cmd('vm run-command invoke -g {rg} -n {vm} --command-id RunShellScript --scripts ' + '"echo \'sudo waagent -deprovision+user --force\' | at -M now + 1 minutes"') + time.sleep(70) + self.cmd('vm deallocate -g {rg} -n {vm}') + self.cmd('vm generalize -g {rg} -n {vm}') + self.cmd('image create -g {rg} -n {image} --source {vm}') + self.cmd('group create -g {rg2} -l eastus') + self.cmd('image copy --source-object-name {image} --source-resource-group {rg} ' + '--target-location eastus --target-resource-group {rg2} --target-name {image}') + self.cmd('image show -g {rg2} -n {image}', checks=[self.check('name', '{image}')])