azure-cli-extensions icon indicating copy to clipboard operation
azure-cli-extensions copied to clipboard

`az image copy - The command failed with an unexpected error

Open gidipas opened this issue 2 years ago • 12 comments

This is autogenerated. Please review and update as needed.

Describe the bug

Command Name az image copy Extension Name: image-copy-extension. Version: 0.2.9.

Errors:

The command failed with an unexpected error. Here is the traceback:
Command '['/usr/bin/../../opt/az/bin/python3', '-m', 'azure.cli', 'snapshot', 'create', '--name', 'CC-basegen2v2_os_disk_snapshot', '--location', 'westus2', '--resource-group', 'Intel_EDA', '--source', '/subscriptions/1d81cec7-7ded-4731-884e-90c5aa59c622/resourceGroups/Intel_EDA/providers/Microsoft.Compute/disks/azint-baseimggen2v1_OsDisk_1_7756cecd82874923bccb0760f3d0d02d', '--hyper-v-generation', 'V2', '--output', 'json', '--tags', 'created_by=image-copy-extension']' returned non-zero exit status 3.
Traceback (most recent call last):
  File "/opt/az/lib/python3.8/site-packages/knack/cli.py", line 231, in invoke
    cmd_result = self.invocation.execute(args)
  File "/opt/az/lib/python3.8/site-packages/azure/cli/core/commands/__init__.py", line 658, in execute
    raise ex
  File "/opt/az/lib/python3.8/site-packages/azure/cli/core/commands/__init__.py", line 721, in _run_jobs_serially
    results.append(self._run_job(expanded_arg, cmd_copy))
  File "/opt/az/lib/python3.8/site-packages/azure/cli/core/commands/__init__.py", line 692, in _run_job
    result = cmd_copy(params)
  File "/opt/az/lib/python3.8/site-packages/azure/cli/core/commands/__init__.py", line 328, in __call__
    return self.handler(*args, **kwargs)
  File "/opt/az/lib/python3.8/site-packages/azure/cli/core/commands/command_operation.py", line 121, in handler
    return op(**command_args)
  File "/home/giancarlo/.azure/cliextensions/image-copy-extension/azext_imagecopy/custom.py", line 108, in imagecopy
    run_cli_command(cli_cmd)
  File "/home/giancarlo/.azure/cliextensions/image-copy-extension/azext_imagecopy/cli_utils.py", line 45, in run_cli_command
    raise ex
  File "/home/giancarlo/.azure/cliextensions/image-copy-extension/azext_imagecopy/cli_utils.py", line 21, in run_cli_command
    cmd_output = check_output(cmd, stderr=STDOUT, universal_newlines=True)
  File "/opt/az/lib/python3.8/subprocess.py", line 415, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "/opt/az/lib/python3.8/subprocess.py", line 516, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['/usr/bin/../../opt/az/bin/python3', '-m', 'azure.cli', 'snapshot', 'create', '--name', 'CC-basegen2v2_os_disk_snapshot', '--location', 'westus2', '--resource-group', 'Intel_EDA', '--source', '/subscriptions/1d81cec7-7ded-4731-884e-90c5aa59c622/resourceGroups/Intel_EDA/providers/Microsoft.Compute/disks/azint-baseimggen2v1_OsDisk_1_7756cecd82874923bccb0760f3d0d02d', '--hyper-v-generation', 'V2', '--output', 'json', '--tags', 'created_by=image-copy-extension']' returned non-zero exit status 3.

To Reproduce:

Steps to reproduce the behavior. Note that argument values have been redacted, as they may contain sensitive information.

  • Put any pre-requisite steps here...
  • az image copy --source-resource-group {} --source-object-name {} --target-location {} --target-name {} --target-resource-group {} --cleanup

Expected Behavior

Environment Summary

Linux-5.4.0-1072-azure-x86_64-with-glibc2.28 (Cloud Shell), Common Base Linux Delridge (quinault)
Python 3.8.12
Installer: DEB

azure-cli 2.34.1

Extensions:
image-copy-extension 0.2.9
ai-examples 0.2.5
ssh 1.0.0

Dependencies:
msal 1.16.0
azure-mgmt-resource 20.0.0

Additional Context

gidipas avatar Mar 16 '22 21:03 gidipas

compute

yonzhan avatar Mar 16 '22 22:03 yonzhan

@gidipas Could you please send me the debug log by email, my email address is [email protected], thanks~

zhoxing-ms avatar Mar 17 '22 03:03 zhoxing-ms

@Xing @.***> where do I get that ?

From: Xing Zhou @.> Sent: Wednesday, March 16, 2022 11:34 PM To: Azure/azure-cli-extensions @.> Cc: Giancarlo DiPasquale @.>; Mention @.> Subject: Re: [Azure/azure-cli-extensions] `az image copy - The command failed with an unexpected error (Issue #4542)

@gidipashttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fgidipas&data=04%7C01%7CG.DiPasquale%40microsoft.com%7C69872a7e8f9b4a2567c908da07c7062c%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637830848630139623%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=pwBavdDJpEUHvw6eKcqpTWL%2BGbFHQQSbKa92ieW5IVs%3D&reserved=0 Could you please send me the debug log by email, my email address is @.@.>, thanks~

Reply to this email directly, view it on GitHubhttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FAzure%2Fazure-cli-extensions%2Fissues%2F4542%23issuecomment-1070228328&data=04%7C01%7CG.DiPasquale%40microsoft.com%7C69872a7e8f9b4a2567c908da07c7062c%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637830848630139623%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=YfBgurumupaW%2FZZ%2BlUpyOfOdxLHGQXutKyO5pd8qUvE%3D&reserved=0, or unsubscribehttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAMETYI2HPCPTXBASEWEAJK3VAKR3ZANCNFSM5Q5DK3CQ&data=04%7C01%7CG.DiPasquale%40microsoft.com%7C69872a7e8f9b4a2567c908da07c7062c%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637830848630139623%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=oiui7sjgJXyifQ65mYLy4e1XC9dhj461CBFtCc%2FmSjk%3D&reserved=0. Triage notifications on the go with GitHub Mobile for iOShttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fapps.apple.com%2Fapp%2Fapple-store%2Fid1477376905%3Fct%3Dnotification-email%26mt%3D8%26pt%3D524675&data=04%7C01%7CG.DiPasquale%40microsoft.com%7C69872a7e8f9b4a2567c908da07c7062c%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637830848630189628%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=onjo6dW%2F9zcayLPwvzm%2BgTroRH0NpnHaMh8CRyqyhn4%3D&reserved=0 or Androidhttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fplay.google.com%2Fstore%2Fapps%2Fdetails%3Fid%3Dcom.github.android%26referrer%3Dutm_campaign%253Dnotification-email%2526utm_medium%253Demail%2526utm_source%253Dgithub&data=04%7C01%7CG.DiPasquale%40microsoft.com%7C69872a7e8f9b4a2567c908da07c7062c%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637830848630189628%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=qfEt%2FE4UONIVfOBT%2Fbt7JXVVoNbrvaIDTgO9%2FsJltCg%3D&reserved=0. You are receiving this because you were mentioned.Message ID: @.@.>>

gidipas avatar Mar 17 '22 05:03 gidipas

Hi @Giancarlo @.***>,

Please add the “—debug” parameter to the original command and execute it again, and then send the printed information to me

Thanks, Xing


From: Giancarlo DiPasquale @.> Sent: Thursday, March 17, 2022 1:53:07 PM To: Azure/azure-cli-extensions @.>; Azure/azure-cli-extensions @.>; Xing Zhou @.> Cc: Mention @.***> Subject: RE: [Azure/azure-cli-extensions] `az image copy - The command failed with an unexpected error (Issue #4542)

@Xing @.***> where do I get that ?

From: Xing Zhou @.> Sent: Wednesday, March 16, 2022 11:34 PM To: Azure/azure-cli-extensions @.> Cc: Giancarlo DiPasquale @.>; Mention @.> Subject: Re: [Azure/azure-cli-extensions] `az image copy - The command failed with an unexpected error (Issue #4542)

@gidipashttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fgidipas&data=04%7C01%7CZhou.Xing%40microsoft.com%7Cb75e2d4cd0f74be6d23b08da07da6954%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637830931922325972%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=oI%2BWv40jGvAKKCqXngVbAoLOBiNYSoq1nW8acJEGIx8%3D&reserved=0 Could you please send me the debug log by email, my email address is @.@.>, thanks~

— Reply to this email directly, view it on GitHubhttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FAzure%2Fazure-cli-extensions%2Fissues%2F4542%23issuecomment-1070228328&data=04%7C01%7CZhou.Xing%40microsoft.com%7Cb75e2d4cd0f74be6d23b08da07da6954%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637830931922325972%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=xQaNtp4MBllg%2BlahQr0SU35ZRSdVsfSIVM9%2BmKjReZI%3D&reserved=0, or unsubscribehttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAMETYI2HPCPTXBASEWEAJK3VAKR3ZANCNFSM5Q5DK3CQ&data=04%7C01%7CZhou.Xing%40microsoft.com%7Cb75e2d4cd0f74be6d23b08da07da6954%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637830931922325972%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=lImOdquhzVyJMYDYaV8g%2BRGHwi9p6J5qfSjrMdrmGu8%3D&reserved=0. Triage notifications on the go with GitHub Mobile for iOShttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fapps.apple.com%2Fapp%2Fapple-store%2Fid1477376905%3Fct%3Dnotification-email%26mt%3D8%26pt%3D524675&data=04%7C01%7CZhou.Xing%40microsoft.com%7Cb75e2d4cd0f74be6d23b08da07da6954%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637830931922325972%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=EotbberSAgtVOfDM%2Fv%2Boi%2ForNupzgNZTXmHzFJRDSls%3D&reserved=0 or Androidhttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fplay.google.com%2Fstore%2Fapps%2Fdetails%3Fid%3Dcom.github.android%26referrer%3Dutm_campaign%253Dnotification-email%2526utm_medium%253Demail%2526utm_source%253Dgithub&data=04%7C01%7CZhou.Xing%40microsoft.com%7Cb75e2d4cd0f74be6d23b08da07da6954%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637830931922325972%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=QKwk9LsS3E1IUFE62K4pl58a9QMzWRIZzdHxyTORHyA%3D&reserved=0. You are receiving this because you were mentioned.Message ID: @.@.>>

gidipas avatar Mar 17 '22 06:03 gidipas

@.***:~$ az image copy --source-resource-group Intel_EDA --source-object-name CC-basegen2v2 --target-location westus3 --target-name CC-basegen2v2-west3 --target-resource-group "Intel_EDA_West3" --cleanup --debug cli.knack.cli: Command arguments: ['image', 'copy', '--source-resource-group', 'Intel_EDA', '--source-object-name', 'CC-basegen2v2', '--target-location', 'westus3', '--target-name', 'CC-basegen2v2-west3', '--target-resource-group', 'Intel_EDA_West3', '--cleanup', '--debug'] cli.knack.cli: init debug log: Enable color in terminal. cli.knack.cli: Event: Cli.PreExecute [] cli.knack.cli: Event: CommandParser.OnGlobalArgumentsCreate [<function CLILogging.on_global_arguments at 0x7f89e8adb1f0>, <function OutputProducer.on_global_arguments at 0x7f89e8a130d0>, <function CLIQuery.on_global_arguments at 0x7f89e89a55e0>] cli.knack.cli: Event: CommandInvoker.OnPreCommandTableCreate [] cli.azure.cli.core: Modules found from index for 'image': ['azure.cli.command_modules.vm', 'azext_imagecopy'] cli.azure.cli.core: Loading command modules: cli.azure.cli.core: Name Load Time Groups Commands cli.azure.cli.core: vm 0.208 54 278 cli.azure.cli.core: Total (1) 0.208 54 278 cli.azure.cli.core: These extensions are not installed and will be skipped: ['azext_next'] cli.azure.cli.core: Loading extensions: cli.azure.cli.core: Name Load Time Groups Commands Directory cli.azure.cli.core: image-copy-extension 0.052 1 1 /home/giancarlo/.azure/cliextensions/image-copy-extension cli.azure.cli.core: ai-examples 0.078 1 1 /opt/az/lib/python3.8/site-packages/azure-cli-extensions/ai-examples cli.azure.cli.core: Total (2) 0.130 2 2 cli.azure.cli.core: Loaded 55 groups, 280 commands. cli.azure.cli.core: Found a match in the command table. cli.azure.cli.core: Raw command : image copy cli.azure.cli.core: Command table: image copy cli.knack.cli: Event: CommandInvoker.OnPreCommandTableTruncate [<function AzCliLogging.init_command_file_logging at 0x7f89e817f550>] cli.azure.cli.core.azlogging: metadata file logging enabled - writing logs to '/home/giancarlo/.azure/commands/2022-03-17.06-13-54.image_copy.183.log'. az_command_data_logger: command args: image copy --source-resource-group {} --source-object-name {} --target-location {} --target-name {} --target-resource-group {} --cleanup --debug cli.knack.cli: Event: CommandInvoker.OnPreArgumentLoad [<function register_global_subscription_argument..add_subscription_parameter at 0x7f89e8104940>] cli.knack.cli: Event: CommandInvoker.OnPostArgumentLoad [] cli.knack.cli: Event: CommandInvoker.OnPostCommandTableCreate [<function register_ids_argument..add_ids_arguments at 0x7f89e8046ca0>, <function register_cache_arguments..add_cache_arguments at 0x7f89e8046dc0>] cli.knack.cli: Event: CommandInvoker.OnCommandTableLoaded [] cli.knack.cli: Event: CommandInvoker.OnPreParseArgs [] cli.knack.cli: Event: CommandInvoker.OnPostParseArgs [<function OutputProducer.handle_output_argument at 0x7f89e8a13160>, <function CLIQuery.handle_query_parameter at 0x7f89e89a5670>, <function register_ids_argument..parse_ids_arguments at 0x7f89e8046d30>] az_command_data_logger: extension name: image-copy-extension az_command_data_logger: extension version: 0.2.9 cli.azext_imagecopy.cli_utils: command: ['/usr/bin/../../opt/az/bin/python3', '-m', 'azure.cli', 'group', 'exists', '-n', 'image-copy-rg', '--output', 'tsv'] ended with output: false

cli.azext_imagecopy.custom: Getting OS disk ID of the source VM/image cli.azext_imagecopy.cli_utils: command: ['/usr/bin/../../opt/az/bin/python3', '-m', 'azure.cli', 'image', 'show', '--name', 'CC-basegen2v2', '--resource-group', 'Intel_EDA', '--output', 'json'] ended with output: { "extendedLocation": null, "hyperVGeneration": "V2", "id": "/subscriptions/1d81cec7-7ded-4731-884e-90c5aa59c622/resourceGroups/Intel_EDA/providers/Microsoft.Compute/images/CC-basegen2v2", "location": "westus2", "name": "CC-basegen2v2", "provisioningState": "Succeeded", "resourceGroup": "Intel_EDA", "sourceVirtualMachine": { "id": "/subscriptions/1d81cec7-7ded-4731-884e-90c5aa59c622/resourceGroups/Intel_EDA/providers/Microsoft.Compute/virtualMachines/azint-baseimggen2v1", "resourceGroup": "Intel_EDA" }, "storageProfile": { "dataDisks": [], "osDisk": { "blobUri": null, "caching": "ReadWrite", "diskEncryptionSet": { "id": "/subscriptions/1d81cec7-7ded-4731-884e-90c5aa59c622/resourceGroups/INTEL_EDA/providers/Microsoft.Compute/diskEncryptionSets/POCIntelD2E", "resourceGroup": "INTEL_EDA" }, "diskSizeGb": 30, "managedDisk": { "id": "/subscriptions/1d81cec7-7ded-4731-884e-90c5aa59c622/resourceGroups/Intel_EDA/providers/Microsoft.Compute/disks/azint-baseimggen2v1_OsDisk_1_7756cecd82874923bccb0760f3d0d02d", "resourceGroup": "Intel_EDA" }, "osState": "Generalized", "osType": "Linux", "snapshot": null, "storageAccountType": "Premium_LRS" }, "zoneResilient": null }, "tags": {}, "type": "Microsoft.Compute/images" }

cli.azext_imagecopy.cli_utils: json output starts at position: 0 cli.azext_imagecopy.custom: found DISK: /subscriptions/1d81cec7-7ded-4731-884e-90c5aa59c622/resourceGroups/Intel_EDA/providers/Microsoft.Compute/disks/azint-baseimggen2v1_OsDisk_1_7756cecd82874923bccb0760f3d0d02d cli.azext_imagecopy.custom: source_os_disk_type: DISK. source_os_disk_id: /subscriptions/1d81cec7-7ded-4731-884e-90c5aa59c622/resourceGroups/Intel_EDA/providers/Microsoft.Compute/disks/azint-baseimggen2v1_OsDisk_1_7756cecd82874923bccb0760f3d0d02d. source_os_type: Linux cli.azext_imagecopy.custom: Creating source snapshot cli.azext_imagecopy.cli_utils: command failed: ['/usr/bin/../../opt/az/bin/python3', '-m', 'azure.cli', 'snapshot', 'create', '--name', 'CC-basegen2v2_os_disk_snapshot', '--location', 'westus2', '--resource-group', 'Intel_EDA', '--source', '/subscriptions/1d81cec7-7ded-4731-884e-90c5aa59c622/resourceGroups/Intel_EDA/providers/Microsoft.Compute/disks/azint-baseimggen2v1_OsDisk_1_7756cecd82874923bccb0760f3d0d02d', '--hyper-v-generation', 'V2', '--output', 'json', '--tags', 'created_by=image-copy-extension'] cli.azext_imagecopy.cli_utils: output: ERROR: (NotFound) Resource azint-baseimggen2v1_OsDisk_1_7756cecd82874923bccb0760f3d0d02d is not found. Code: NotFound Message: Resource azint-baseimggen2v1_OsDisk_1_7756cecd82874923bccb0760f3d0d02d is not found.

cli.azure.cli.core.util: azure.cli.core.util.handle_exception is called with an exception: cli.azure.cli.core.util: Traceback (most recent call last): File "/opt/az/lib/python3.8/site-packages/knack/cli.py", line 231, in invoke cmd_result = self.invocation.execute(args) File "/opt/az/lib/python3.8/site-packages/azure/cli/core/commands/init.py", line 658, in execute raise ex File "/opt/az/lib/python3.8/site-packages/azure/cli/core/commands/init.py", line 721, in _run_jobs_serially results.append(self._run_job(expanded_arg, cmd_copy)) File "/opt/az/lib/python3.8/site-packages/azure/cli/core/commands/init.py", line 692, in _run_job result = cmd_copy(params) File "/opt/az/lib/python3.8/site-packages/azure/cli/core/commands/init.py", line 328, in call return self.handler(*args, **kwargs) File "/opt/az/lib/python3.8/site-packages/azure/cli/core/commands/command_operation.py", line 121, in handler return op(**command_args) File "/home/giancarlo/.azure/cliextensions/image-copy-extension/azext_imagecopy/custom.py", line 108, in imagecopy run_cli_command(cli_cmd) File "/home/giancarlo/.azure/cliextensions/image-copy-extension/azext_imagecopy/cli_utils.py", line 45, in run_cli_command raise ex File "/home/giancarlo/.azure/cliextensions/image-copy-extension/azext_imagecopy/cli_utils.py", line 21, in run_cli_command cmd_output = check_output(cmd, stderr=STDOUT, universal_newlines=True) File "/opt/az/lib/python3.8/subprocess.py", line 415, in check_output return run(*popenargs, stdout=PIPE, timeout=timeout, check=True, File "/opt/az/lib/python3.8/subprocess.py", line 516, in run raise CalledProcessError(retcode, process.args, subprocess.CalledProcessError: Command '['/usr/bin/../../opt/az/bin/python3', '-m', 'azure.cli', 'snapshot', 'create', '--name', 'CC-basegen2v2_os_disk_snapshot', '--location', 'westus2', '--resource-group', 'Intel_EDA', '--source', '/subscriptions/1d81cec7-7ded-4731-884e-90c5aa59c622/resourceGroups/Intel_EDA/providers/Microsoft.Compute/disks/azint-baseimggen2v1_OsDisk_1_7756cecd82874923bccb0760f3d0d02d', '--hyper-v-generation', 'V2', '--output', 'json', '--tags', 'created_by=image-copy-extension']' returned non-zero exit status 3.

cli.azure.cli.core.azclierror: The command failed with an unexpected error. Here is the traceback: az_command_data_logger: The command failed with an unexpected error. Here is the traceback: cli.azure.cli.core.azclierror: Command '['/usr/bin/../../opt/az/bin/python3', '-m', 'azure.cli', 'snapshot', 'create', '--name', 'CC-basegen2v2_os_disk_snapshot', '--location', 'westus2', '--resource-group', 'Intel_EDA', '--source', '/subscriptions/1d81cec7-7ded-4731-884e-90c5aa59c622/resourceGroups/Intel_EDA/providers/Microsoft.Compute/disks/azint-baseimggen2v1_OsDisk_1_7756cecd82874923bccb0760f3d0d02d', '--hyper-v-generation', 'V2', '--output', 'json', '--tags', 'created_by=image-copy-extension']' returned non-zero exit status 3. Traceback (most recent call last): File "/opt/az/lib/python3.8/site-packages/knack/cli.py", line 231, in invoke cmd_result = self.invocation.execute(args) File "/opt/az/lib/python3.8/site-packages/azure/cli/core/commands/init.py", line 658, in execute raise ex File "/opt/az/lib/python3.8/site-packages/azure/cli/core/commands/init.py", line 721, in _run_jobs_serially results.append(self._run_job(expanded_arg, cmd_copy)) File "/opt/az/lib/python3.8/site-packages/azure/cli/core/commands/init.py", line 692, in _run_job result = cmd_copy(params) File "/opt/az/lib/python3.8/site-packages/azure/cli/core/commands/init.py", line 328, in call return self.handler(*args, **kwargs) File "/opt/az/lib/python3.8/site-packages/azure/cli/core/commands/command_operation.py", line 121, in handler return op(**command_args) File "/home/giancarlo/.azure/cliextensions/image-copy-extension/azext_imagecopy/custom.py", line 108, in imagecopy run_cli_command(cli_cmd) File "/home/giancarlo/.azure/cliextensions/image-copy-extension/azext_imagecopy/cli_utils.py", line 45, in run_cli_command raise ex File "/home/giancarlo/.azure/cliextensions/image-copy-extension/azext_imagecopy/cli_utils.py", line 21, in run_cli_command cmd_output = check_output(cmd, stderr=STDOUT, universal_newlines=True) File "/opt/az/lib/python3.8/subprocess.py", line 415, in check_output return run(*popenargs, stdout=PIPE, timeout=timeout, check=True, File "/opt/az/lib/python3.8/subprocess.py", line 516, in run raise CalledProcessError(retcode, process.args, subprocess.CalledProcessError: Command '['/usr/bin/../../opt/az/bin/python3', '-m', 'azure.cli', 'snapshot', 'create', '--name', 'CC-basegen2v2_os_disk_snapshot', '--location', 'westus2', '--resource-group', 'Intel_EDA', '--source', '/subscriptions/1d81cec7-7ded-4731-884e-90c5aa59c622/resourceGroups/Intel_EDA/providers/Microsoft.Compute/disks/azint-baseimggen2v1_OsDisk_1_7756cecd82874923bccb0760f3d0d02d', '--hyper-v-generation', 'V2', '--output', 'json', '--tags', 'created_by=image-copy-extension']' returned non-zero exit status 3. az_command_data_logger: Command '['/usr/bin/../../opt/az/bin/python3', '-m', 'azure.cli', 'snapshot', 'create', '--name', 'CC-basegen2v2_os_disk_snapshot', '--location', 'westus2', '--resource-group', 'Intel_EDA', '--source', '/subscriptions/1d81cec7-7ded-4731-884e-90c5aa59c622/resourceGroups/Intel_EDA/providers/Microsoft.Compute/disks/azint-baseimggen2v1_OsDisk_1_7756cecd82874923bccb0760f3d0d02d', '--hyper-v-generation', 'V2', '--output', 'json', '--tags', 'created_by=image-copy-extension']' returned non-zero exit status 3. Traceback (most recent call last): File "/opt/az/lib/python3.8/site-packages/knack/cli.py", line 231, in invoke cmd_result = self.invocation.execute(args) File "/opt/az/lib/python3.8/site-packages/azure/cli/core/commands/init.py", line 658, in execute raise ex File "/opt/az/lib/python3.8/site-packages/azure/cli/core/commands/init.py", line 721, in _run_jobs_serially results.append(self._run_job(expanded_arg, cmd_copy)) File "/opt/az/lib/python3.8/site-packages/azure/cli/core/commands/init.py", line 692, in _run_job result = cmd_copy(params) File "/opt/az/lib/python3.8/site-packages/azure/cli/core/commands/init.py", line 328, in call return self.handler(*args, **kwargs) File "/opt/az/lib/python3.8/site-packages/azure/cli/core/commands/command_operation.py", line 121, in handler return op(command_args) File "/home/giancarlo/.azure/cliextensions/image-copy-extension/azext_imagecopy/custom.py", line 108, in imagecopy run_cli_command(cli_cmd) File "/home/giancarlo/.azure/cliextensions/image-copy-extension/azext_imagecopy/cli_utils.py", line 45, in run_cli_command raise ex File "/home/giancarlo/.azure/cliextensions/image-copy-extension/azext_imagecopy/cli_utils.py", line 21, in run_cli_command cmd_output = check_output(cmd, stderr=STDOUT, universal_newlines=True) File "/opt/az/lib/python3.8/subprocess.py", line 415, in check_output return run(popenargs, stdout=PIPE, timeout=timeout, check=True, File "/opt/az/lib/python3.8/subprocess.py", line 516, in run raise CalledProcessError(retcode, process.args, subprocess.CalledProcessError: Command '['/usr/bin/../../opt/az/bin/python3', '-m', 'azure.cli', 'snapshot', 'create', '--name', 'CC-basegen2v2_os_disk_snapshot', '--location', 'westus2', '--resource-group', 'Intel_EDA', '--source', '/subscriptions/1d81cec7-7ded-4731-884e-90c5aa59c622/resourceGroups/Intel_EDA/providers/Microsoft.Compute/disks/azint-baseimggen2v1_OsDisk_1_7756cecd82874923bccb0760f3d0d02d', '--hyper-v-generation', 'V2', '--output', 'json', '--tags', 'created_by=image-copy-extension']' returned non-zero exit status 3. To open an issue, please run: 'az feedback' cli.knack.cli: Event: Cli.PostExecute [<function AzCliLogging.deinit_cmd_metadata_logging at 0x7f89e817f790>] az_command_data_logger: exit code: 1 cli.main: Command ran in 7.014 seconds (init: 0.099, invoke: 6.915) telemetry.save: Save telemetry record of length 7115 in cache telemetry.check: Negative: The /home/giancarlo/.azure/telemetry.txt was modified at 2022-03-17 06:11:24.842526, which in less than 600.000000 s @.:~$

From: Xing Zhou @.> Sent: Thursday, March 17, 2022 2:10 AM To: Giancarlo DiPasquale @.>; Azure/azure-cli-extensions @.>; Azure/azure-cli-extensions @.> Cc: Mention @.>; Yong Zhang @.> Subject: RE: [Azure/azure-cli-extensions] `az image copy - The command failed with an unexpected error (Issue #4542)

Hi @Giancarlo @.***>,

Please add the "-debug" parameter to the original command and execute it again, and then send the printed information to me

Thanks, Xing


From: Giancarlo DiPasquale @.@.>> Sent: Thursday, March 17, 2022 1:53:07 PM To: Azure/azure-cli-extensions @.@.>>; Azure/azure-cli-extensions @.@.>>; Xing Zhou @.@.>> Cc: Mention @.@.>> Subject: RE: [Azure/azure-cli-extensions] `az image copy - The command failed with an unexpected error (Issue #4542)

@Xing @.***> where do I get that ?

From: Xing Zhou @.@.>> Sent: Wednesday, March 16, 2022 11:34 PM To: Azure/azure-cli-extensions @.@.>> Cc: Giancarlo DiPasquale @.@.>>; Mention @.@.>> Subject: Re: [Azure/azure-cli-extensions] `az image copy - The command failed with an unexpected error (Issue #4542)

@gidipashttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fgidipas&data=04%7C01%7CG.DiPasquale%40microsoft.com%7C0de4a4dd2f25409329f808da07dcbadc%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637830941887898115%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=JGVy%2FjoICP%2F2FFZ7ivDAt7VyR6QMnF%2FGcUSwmkRGWk4%3D&reserved=0 Could you please send me the debug log by email, my email address is @.@.>, thanks~

Reply to this email directly, view it on GitHubhttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FAzure%2Fazure-cli-extensions%2Fissues%2F4542%23issuecomment-1070228328&data=04%7C01%7CG.DiPasquale%40microsoft.com%7C0de4a4dd2f25409329f808da07dcbadc%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637830941887898115%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=%2FAdgpvwtV8t74xNhEW1IAdHZj66pAzfrGo%2BkwX5aauw%3D&reserved=0, or unsubscribehttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAMETYI2HPCPTXBASEWEAJK3VAKR3ZANCNFSM5Q5DK3CQ&data=04%7C01%7CG.DiPasquale%40microsoft.com%7C0de4a4dd2f25409329f808da07dcbadc%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637830941887898115%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=%2BEFiumvdeC40hmmGgMpwUfZbE4ayib3iCXRhQm2I7MI%3D&reserved=0. Triage notifications on the go with GitHub Mobile for iOShttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fapps.apple.com%2Fapp%2Fapple-store%2Fid1477376905%3Fct%3Dnotification-email%26mt%3D8%26pt%3D524675&data=04%7C01%7CG.DiPasquale%40microsoft.com%7C0de4a4dd2f25409329f808da07dcbadc%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637830941887898115%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=WrXbGDPSRPqFcy2Ld1flrnmC3MnuEha5HXsyE0rOHPI%3D&reserved=0 or Androidhttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fplay.google.com%2Fstore%2Fapps%2Fdetails%3Fid%3Dcom.github.android%26referrer%3Dutm_campaign%253Dnotification-email%2526utm_medium%253Demail%2526utm_source%253Dgithub&data=04%7C01%7CG.DiPasquale%40microsoft.com%7C0de4a4dd2f25409329f808da07dcbadc%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637830941887947721%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=g7F%2FWe6V1%2FTyEE5XdDAy0XI3%2FnwsGQv%2B1gdmf5o0qmM%3D&reserved=0. You are receiving this because you were mentioned.Message ID: @.@.>>

gidipas avatar Mar 17 '22 06:03 gidipas

cli.azext_imagecopy.custom: Creating source snapshot cli.azext_imagecopy.cli_utils: command failed: ['/usr/bin/../../opt/az/bin/python3', '-m', 'azure.cli', 'snapshot', 'create', '--name', 'CC-basegen2v2_os_disk_snapshot', '--location', 'westus2', '--resource-group', 'Intel_EDA', '--source', '/subscriptions/1d81cec7-7ded-4731-884e-90c5aa59c622/resourceGroups/Intel_EDA/providers/Microsoft.Compute/disks/azint-baseimggen2v1_OsDisk_1_7756cecd82874923bccb0760f3d0d02d', '--hyper-v-generation', 'V2', '--output', 'json', '--tags', 'created_by=image-copy-extension'] cli.azext_imagecopy.cli_utils: output: ERROR: (NotFound) Resource azint-baseimggen2v1_OsDisk_1_7756cecd82874923bccb0760f3d0d02d is not found. Code: NotFound Message: Resource azint-baseimggen2v1_OsDisk_1_7756cecd82874923bccb0760f3d0d02d is not found.

@gidipas This problem is caused by the source disk /subscriptions/1d81cec7-7ded-4731-884e-90c5aa59c622/resourceGroups/Intel_EDA/providers/Microsoft.Compute/disks/azint-baseimggen2v1_OsDisk_1_7756cecd82874923bccb0760f3d0d02d not being found when creating a source snapshot

zhoxing-ms avatar Mar 17 '22 06:03 zhoxing-ms

The image creation process deletes the vm and os drive. Does this mean we can’t use az image copy to copy an image from one region to another without that os drive?

Get Outlook for iOShttps://aka.ms/o0ukef


From: Xing Zhou @.> Sent: Thursday, March 17, 2022 7:45:34 AM To: Azure/azure-cli-extensions @.> Cc: Giancarlo DiPasquale @.>; Mention @.> Subject: Re: [Azure/azure-cli-extensions] `az image copy - The command failed with an unexpected error (Issue #4542)

cli.azext_imagecopy.custom: Creating source snapshot cli.azext_imagecopy.cli_utils: command failed: ['/usr/bin/../../opt/az/bin/python3', '-m', 'azure.cli', 'snapshot', 'create', '--name', 'CC-basegen2v2_os_disk_snapshot', '--location', 'westus2', '--resource-group', 'Intel_EDA', '--source', '/subscriptions/1d81cec7-7ded-4731-884e-90c5aa59c622/resourceGroups/Intel_EDA/providers/Microsoft.Compute/disks/azint-baseimggen2v1_OsDisk_1_7756cecd82874923bccb0760f3d0d02d', '--hyper-v-generation', 'V2', '--output', 'json', '--tags', 'created_by=image-copy-extension'] cli.azext_imagecopy.cli_utils: output: ERROR: (NotFound) Resource azint-baseimggen2v1_OsDisk_1_7756cecd82874923bccb0760f3d0d02d is not found. Code: NotFound Message: Resource azint-baseimggen2v1_OsDisk_1_7756cecd82874923bccb0760f3d0d02d is not found.

This problem is caused by the source disk /subscriptions/1d81cec7-7ded-4731-884e-90c5aa59c622/resourceGroups/Intel_EDA/providers/Microsoft.Compute/disks/azint-baseimggen2v1_OsDisk_1_7756cecd82874923bccb0760f3d0d02d not being found when creating a source snapshot

— Reply to this email directly, view it on GitHubhttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FAzure%2Fazure-cli-extensions%2Fissues%2F4542%23issuecomment-1070378157&data=04%7C01%7CG.DiPasquale%40microsoft.com%7C09bed48b100744a6ba8908da07e1bd2f%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637830963377067563%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=yYzg0Xehoq8Ctwv%2B8Jxv96ryZse0Jdcf0FPVjO2JgBg%3D&reserved=0, or unsubscribehttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAMETYI3JFJRCDXYWKDM7LO3VALII5ANCNFSM5Q5DK3CQ&data=04%7C01%7CG.DiPasquale%40microsoft.com%7C09bed48b100744a6ba8908da07e1bd2f%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637830963377067563%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=CBGv8Qi%2BWaAcnzt3mMxOT%2FLdoQsBDl%2BMva9%2FEkTYaCc%3D&reserved=0. Triage notifications on the go with GitHub Mobile for iOShttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fapps.apple.com%2Fapp%2Fapple-store%2Fid1477376905%3Fct%3Dnotification-email%26mt%3D8%26pt%3D524675&data=04%7C01%7CG.DiPasquale%40microsoft.com%7C09bed48b100744a6ba8908da07e1bd2f%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637830963377067563%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=Iu56V0xEDEeuiUtHFyq1YdukQJVGWS7XJjjP7weFIoA%3D&reserved=0 or Androidhttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fplay.google.com%2Fstore%2Fapps%2Fdetails%3Fid%3Dcom.github.android%26referrer%3Dutm_campaign%253Dnotification-email%2526utm_medium%253Demail%2526utm_source%253Dgithub&data=04%7C01%7CG.DiPasquale%40microsoft.com%7C09bed48b100744a6ba8908da07e1bd2f%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637830963377067563%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=bHWmyicIofDRctLDPxzpHnUKnj7VXpvXn2QoChzBVq8%3D&reserved=0. You are receiving this because you were mentioned.Message ID: @.***>

gidipas avatar Mar 17 '22 07:03 gidipas

The image creation process deletes the vm and os drive.

There is no such logic in az image copy. May I ask what do you mean by The image creation process deletes the vm and os drive. ?

zhoxing-ms avatar Mar 17 '22 08:03 zhoxing-ms

Image capture from the portal has an option to delete the VM upon creation. I believe the customer im working with did that and may not have the OS drive any longer. az image copy will not work if that OS drive no longer exists?

From: Xing Zhou @.> Sent: Thursday, March 17, 2022 4:44 AM To: Azure/azure-cli-extensions @.> Cc: Giancarlo DiPasquale @.>; Mention @.> Subject: Re: [Azure/azure-cli-extensions] `az image copy - The command failed with an unexpected error (Issue #4542)

The image creation process deletes the vm and os drive.

There is no such logic in az image copy. May I ask what do you mean by The image creation process deletes the vm and os drive. ?

Reply to this email directly, view it on GitHubhttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FAzure%2Fazure-cli-extensions%2Fissues%2F4542%23issuecomment-1070543038&data=04%7C01%7CG.DiPasquale%40microsoft.com%7C28f0ef352c9245789fab08da07f24153%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637831034318734600%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=EjFBWxBy8EnYcTX3aQNsqskOSOlfFqABRK0IW8MoO3A%3D&reserved=0, or unsubscribehttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAMETYIZZPPYSJLXLNMGUPSDVALWEJANCNFSM5Q5DK3CQ&data=04%7C01%7CG.DiPasquale%40microsoft.com%7C28f0ef352c9245789fab08da07f24153%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637831034318734600%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=YLNhaIH0uFYq%2FMCI83UsDIJqHo%2Br0yDWJyERB4d8yy0%3D&reserved=0. Triage notifications on the go with GitHub Mobile for iOShttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fapps.apple.com%2Fapp%2Fapple-store%2Fid1477376905%3Fct%3Dnotification-email%26mt%3D8%26pt%3D524675&data=04%7C01%7CG.DiPasquale%40microsoft.com%7C28f0ef352c9245789fab08da07f24153%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637831034318734600%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=EFGVDX%2FNJCBMfpBY%2FHzt6lFacSzJ353kbI3XW%2FJXf8I%3D&reserved=0 or Androidhttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fplay.google.com%2Fstore%2Fapps%2Fdetails%3Fid%3Dcom.github.android%26referrer%3Dutm_campaign%253Dnotification-email%2526utm_medium%253Demail%2526utm_source%253Dgithub&data=04%7C01%7CG.DiPasquale%40microsoft.com%7C28f0ef352c9245789fab08da07f24153%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637831034318785027%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=B3lOtYzP0kxiPp2rNlN1HwM9E30pojSwbUpXgc3OwFc%3D&reserved=0. You are receiving this because you were mentioned.Message ID: @.***>

gidipas avatar Mar 17 '22 08:03 gidipas

This bug was never fixed and it appears that the az image copy command isn't able to function at all - over a year later from these comments. It isn't a feature request; I don't think that can be disputed. It is a feature that exists and has been broken for years now without being fixed.

I'm just going to leave this here as someone is going to say it anyway. This command supports both disk and images and It will default to the type of image, not disk - according to the documentation:

--source-type Image or vm.

accepted values: image, vm default value: image

Correct command as specified by the documentation:

          az image copy --source-resource-group CustomImagesRG `
          --source-object-name Win10MultiV9.5-20220107 `
          --target-resource-group CustomImagesRG `
          --target-location eastus `
          --target-subscription 12345678-1234-1234-1234-605185bb3005 

Output:

Getting OS disk ID of the source VM/image Creating source snapshot command failed: ['/usr/bin/../../opt/az/bin/python3', '-m', 'azure.cli', 'snapshot', 'create', '--name', 'Win10MultiV9.5-20220107_os_disk_snapshot', '--location', 'eastus', '--resource-group', 'CustomImagesRG', '--source', '/subscriptions/12345678-1234-1234-1234-605185bb3005/resourceGroups/AVDImageBuildRG/providers/Microsoft.Compute/disks/AVDImageBuild_OsDisk_1_4125c892f47a42c09530358ab9632b88', '--hyper-v-generation', 'V1', '--output', 'json', '--tags', 'created_by=image-copy-extension'] output: ERROR: (NotFound) Resource AVDImageBuild_OsDisk_1_4125c892f47a42c09530358ab9632b88 is not found. Code: NotFound Message: Resource AVDImageBuild_OsDisk_1_4125c892f47a42c09530358ab9632b88 is not found.

The command failed with an unexpected error. Here is the traceback: Command '['/usr/bin/../../opt/az/bin/python3', '-m', 'azure.cli', 'snapshot', 'create', '--name', 'Win10MultiV9.5-20220107_os_disk_snapshot', '--location', 'eastus', '--resource-group', 'CustomImagesRG', '--source', '/subscriptions/12345678-1234-1234-1234-605185bb3005/resourceGroups/AVDImageBuildRG/providers/Microsoft.Compute/disks/AVDImageBuild_OsDisk_1_4125c892f47a42c09530358ab9632b88', '--hyper-v-generation', 'V1', '--output', 'json', '--tags', 'created_by=image-copy-extension']' returned >> non-zero exit status 3. Traceback (most recent call last): File "/opt/az/lib/python3.10/site-packages/knack/cli.py", line 231, in invoke cmd_result = self.invocation.execute(args) File "/opt/az/lib/python3.10/site-packages/azure/cli/core/commands/init.py", line 663, in execute raise ex File "/opt/az/lib/python3.10/site-packages/azure/cli/core/commands/init.py", line 726, in _run_jobs_serially results.append(self._run_job(expanded_arg, cmd_copy)) File "/opt/az/lib/python3.10/site-packages/azure/cli/core/commands/init.py", line 697, in _run_job result = cmd_copy(params) File "/opt/az/lib/python3.10/site-packages/azure/cli/core/commands/init.py", line 333, in call return self.handler(*args, **kwargs) File "/opt/az/lib/python3.10/site-packages/azure/cli/core/commands/command_operation.py", line 121, in handler return op(**command_args) File "/home/csp/.azure/cliextensions/image-copy-extension/azext_imagecopy/custom.py", line 108, in imagecopy run_cli_command(cli_cmd) File "/home/csp/.azure/cliextensions/image-copy-extension/azext_imagecopy/cli_utils.py", line 45, in run_cli_command raise ex File "/home/csp/.azure/cliextensions/image-copy-extension/azext_imagecopy/cli_utils.py", line 21, in run_cli_command cmd_output = check_output(cmd, stderr=STDOUT, universal_newlines=True) File "/opt/az/lib/python3.10/subprocess.py", line 420, in check_output return run(*popenargs, stdout=PIPE, timeout=timeout, check=True, File "/opt/az/lib/python3.10/subprocess.py", line 524, in run raise CalledProcessError(retcode, process.args, subprocess.CalledProcessError: Command '['/usr/bin/../../opt/az/bin/python3', '-m', 'azure.cli', 'snapshot', 'create', '--name', 'Win10MultiV9.5-20220107_os_disk_snapshot', '--location', 'eastus', '--resource-group', 'CustomImagesRG', '--source', '/subscriptions/12345678-1234-1234-1234-605185bb3005/resourceGroups/AVDImageBuildRG/providers/Microsoft.Compute/disks/AVDImageBuild_OsDisk_1_4125c892f47a42c09530358ab9632b88', '--hyper-v-generation', 'V1', '--output', 'json', '--tags', 'created_by=image-copy-extension']' returned non-zero exit status 3.

ghost avatar Jun 23 '22 16:06 ghost

First I got this error:

command failed: ['C:\\Program Files (x86)\\Microsoft SDKs\\Azure\\CLI2\\python.exe', '-m', 'azure.cli', 'snapshot', 'create', '--name', 'image_os_disk_snapshot', '--location', 'westus', '--resource-group', 'ImageStoreRG', '--source', '/subscriptions/subID/resourceGroups/rg/providers/Microsoft.Compute/disks/VM-IMAGEVM_UNIQUEID', '--hyper-v-generation', 'V2', '--output', 'json', '--tags', 'created_by=image-copy-extension'] output: ERROR: (NotFound) Resource M-IMAGEVM_disk1_UNIQUEID is not found. Code: NotFound Message: Resource VM-IMAGEVM_disk1_UNIQUEID is not found.

I had to create a new VM off my current image and take a new image so both the source VM and image existed at the same time. That shouldn't be required but is. Next the --target-location is used to generate a storage account name (3 to 24 chars, no spaces or special characters) and doesn't need to be a valid azure location input like 'West US'. WestUS worked for me.


# Login 
$sourceSubscription = "sourceSubID"
az login
az account set --subscription $sourceSubscription

# Set vars
$sourceResourceGroup = "ImageStoreRG"
$sourceObjectName = "myImageName"
$targetLocation = "WestUS"
$targetResourceGroup = "destinationRG"
$targetSubscriptionId = "targetSubID"
# vmName needs to exist as a vm object. It is the VM that you used to create your sourceObjectName imageID
$vmName = "imageVMobj"

# add extension if you don't have it
az extension add --name image-copy-extension
az image copy --source-resource-group $sourceResourceGroup --source-object-name $sourceObjectName --source-type image --target-location $targetLocation --target-resource-group $targetResourceGroup --target-subscription $targetSubscriptionId

I tested this script in PS7 with the latest AZ libraries as of January 2023 and successfully copied from one subscription to another. It shouldn't require both VM image and also the source VM object to take a snapshot of but I have not found a away around that.

DavidDAmato avatar Jan 30 '23 18:01 DavidDAmato

I am also getting an error:


Getting OS disk ID of the source VM/image
The command failed with an unexpected error. Here is the traceback:
'managedDisk'
Traceback (most recent call last):
  File "/opt/homebrew/Cellar/azure-cli/2.56.0/libexec/lib/python3.11/site-packages/knack/cli.py", line 233, in invoke
    cmd_result = self.invocation.execute(args)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/azure-cli/2.56.0/libexec/lib/python3.11/site-packages/azure/cli/core/commands/__init__.py", line 663, in execute
    raise ex
  File "/opt/homebrew/Cellar/azure-cli/2.56.0/libexec/lib/python3.11/site-packages/azure/cli/core/commands/__init__.py", line 726, in _run_jobs_serially
    results.append(self._run_job(expanded_arg, cmd_copy))
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/azure-cli/2.56.0/libexec/lib/python3.11/site-packages/azure/cli/core/commands/__init__.py", line 697, in _run_job
    result = cmd_copy(params)
             ^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/azure-cli/2.56.0/libexec/lib/python3.11/site-packages/azure/cli/core/commands/__init__.py", line 333, in __call__
    return self.handler(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/azure-cli/2.56.0/libexec/lib/python3.11/site-packages/azure/cli/core/commands/command_operation.py", line 121, in handler
    return op(**command_args)
           ^^^^^^^^^^^^^^^^^^
  File "/Users/b0b0cu5/.azure/cliextensions/image-copy-extension/azext_imagecopy/custom.py", line 61, in imagecopy
    source_os_disk_id = json_cmd_output['storageProfile']['osDisk']['managedDisk']['id']
                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
KeyError: 'managedDisk'
To check existing issues, please visit: https://github.com/Azure/azure-cli/issues

barakbd avatar Jan 10 '24 02:01 barakbd