az image copy failure

Viewed 26

I have a Windows image that I created with packer stored in West US 2 region. During the image creation process, packer created a VM named pkrvm82hnepqt2r. That is a temporary virtual machine created by Packer. All of my required software is installed on it by ansible, packer then generalizes the machine, shuts it down, creates the image and removes the machine.

The image name created is: wvd-2-baseline-img-20220923001250 The image belons to the a resource group named packer-rg.

I want to copy it to a resource group that we use for disaster recovery that exists in West Central US region. The target resource group is nwm-standby-rg.

I have done this before in the past with other images but its been more than a year ago since I did this. Before attempting the image copy, I updated the az image-copy-extension. It is now at this version: { "experimental": false, "extensionType": "whl", "name": "image-copy-extension", "path": "/Users/john/.azure/cliextensions/image-copy-extension", "preview": false, "version": "0.2.9" }

This is the command I am using: $ az image copy --source-resource-group packer-rg --source-object-name wvd-2-baseline-img-20220923001250 --source-type image --target-location westcentralus --target-resource-group "nwm-standby-rg" --target-name wvd-2-baseline-2022-09-23-img --cleanup

I don't understand why this command is looking for the original VM resource since I only want to copy the image. Here is what it is failing with:

command failed: ['/usr/local/Cellar/azure-cli/2.40.0/libexec/bin/python', '-m', 'azure.cli', 'snapshot', 'create', '--name', 'wvd-2-baseline-img-20220923001250_os_disk_snapshot', '--location', 'westus2', '--resource-group', 'packer-rg', '--source', '/subscriptions/2084802a-c402-4ace-902b-330b68cc51b0/resourceGroups/packer-rg/providers/Microsoft.Compute/disks/pkros82hnepqt2r', '--hyper-v-generation', 'V1', '--output', 'json', '--tags', 'created_by=image-copy-extension'] output: ERROR: (NotFound) Resource pkros82hnepqt2r is not found. Code: NotFound Message: Resource pkros82hnepqt2r is not found.

The command failed with an unexpected error. Here is the traceback: Command '['/usr/local/Cellar/azure-cli/2.40.0/libexec/bin/python', '-m', 'azure.cli', 'snapshot', 'create', '--name', 'wvd-2-baseline-img-20220923001250_os_disk_snapshot', '--location', 'westus2', '--resource-group', 'packer-rg', '--source', '/subscriptions/2084802a-c402-4ace-902b-330b68cc51b0/resourceGroups/packer-rg/providers/Microsoft.Compute/disks/pkros82hnepqt2r', '--hyper-v-generation', 'V1', '--output', 'json', '--tags', 'created_by=image-copy-extension']' returned non-zero exit status 3. Traceback (most recent call last): File "/usr/local/Cellar/azure-cli/2.40.0/libexec/lib/python3.10/site-packages/knack/cli.py", line 233, in invoke cmd_result = self.invocation.execute(args) File "/usr/local/Cellar/azure-cli/2.40.0/libexec/lib/python3.10/site-packages/azure/cli/core/commands/init.py", line 663, in execute raise ex File "/usr/local/Cellar/azure-cli/2.40.0/libexec/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 "/usr/local/Cellar/azure-cli/2.40.0/libexec/lib/python3.10/site-packages/azure/cli/core/commands/init.py", line 697, in _run_job result = cmd_copy(params) File "/usr/local/Cellar/azure-cli/2.40.0/libexec/lib/python3.10/site-packages/azure/cli/core/commands/init.py", line 333, in call return self.handler(*args, **kwargs) File "/usr/local/Cellar/azure-cli/2.40.0/libexec/lib/python3.10/site-packages/azure/cli/core/commands/command_operation.py", line 121, in handler return op(**command_args) File "/Users/jsebast/.azure/cliextensions/image-copy-extension/azext_imagecopy/custom.py", line 108, in imagecopy run_cli_command(cli_cmd) File "/Users/jsebast/.azure/cliextensions/image-copy-extension/azext_imagecopy/cli_utils.py", line 45, in run_cli_command raise ex File "/Users/jsebast/.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 "/usr/local/Cellar/python@3.10/3.10.6_2/Frameworks/Python.framework/Versions/3.10/lib/python3.10/subprocess.py", line 420, in check_output return run(*popenargs, stdout=PIPE, timeout=timeout, check=True, File "/usr/local/Cellar/python@3.10/3.10.6_2/Frameworks/Python.framework/Versions/3.10/lib/python3.10/subprocess.py", line 524, in run raise CalledProcessError(retcode, process.args, subprocess.CalledProcessError: Command '['/usr/local/Cellar/azure-cli/2.40.0/libexec/bin/python', '-m', 'azure.cli', 'snapshot', 'create', '--name', 'wvd-2-baseline-img-20220923001250_os_disk_snapshot', '--location', 'westus2', '--resource-group', 'packer-rg', '--source', '/subscriptions/2084802a-c402-4ace-902b-330b68cc51b0/resourceGroups/packer-rg/providers/Microsoft.Compute/disks/pkros82hnepqt2r', '--hyper-v-generation', 'V1', '--output', 'json', '--tags', 'created_by=image-copy-extension']' returned non-zero exit status 3.

0 Answers
Related