azure cli az image copy 出现错误输出 : ERROR: Resource DISK is not found

标签 azure

我正在使用 Azure CLI 的 az image copy 将镜像从一个区域复制到另一个区域,感谢 How to copy an Azure Image from one region to another region ,我使用

添加扩展名
az extension add --name image-copy-extension

并发出命令:

az image copy --source-resource-group "<src-resource-group-name>" --source-object-name "server-with-appache" --target-location "Southeast Asia" --target-resource-group "<target-resource-group-name>" --cleanup

并收到此错误:

Getting os disk id of the source vm/image
Data disks in the source detected, but are ignored by this extension!
Creating source snapshot
command failed: ['/opt/az/bin/python3', '-m', 'azure.cli', 'snapshot', 'create', '--name', 'server-with-appache_os_disk_snapshot', '--resource-group', '<src-resource-group-name>', '--source', '/subscriptions/d371652e-b4a0-4e59-b82d-4b5ddb762756/resourceGroups/<src-resource-group-name>/providers/Microsoft.Compute/disks/vm-for-iamge-with-apache_disk1_b6938afa59dd4aa385fb58cf4ea6afe6', '--output', 'json', '--tags', 'created_by=image-copy-extension']
output: ERROR: Resource vm-for-iamge-with-apache_disk1_b6938afa59dd4aa385fb58cf4ea6afe6 is not found.

The command failed with an unexpected error. Here is the traceback:

Command '['/opt/az/bin/python3', '-m', 'azure.cli', 'snapshot', 'create', '--name', 'server-with-appache_os_disk_snapshot', '--resource-group', '<src-resource-group-name>', '--source', '/subscriptions/d371652e-b4a0-4e59-b82d-4b5ddb762756/resourceGroups/<src-resource-group-name>/providers/Microsoft.Compute/disks/vm-for-iamge-with-apache_disk1_b6938afa59dd4aa385fb58cf4ea6afe6', '--output', 'json', '--tags', 'created_by=image-copy-extension']' returned non-zero exit status 1.
Traceback (most recent call last):
  File "/opt/az/lib/python3.6/site-packages/knack/cli.py", line 206, in invoke
    cmd_result = self.invocation.execute(args)
  File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 603, in execute
    raise ex
  File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 661, in _run_jobs_serially
    results.append(self._run_job(expanded_arg, cmd_copy))
  File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 654, in _run_job
    six.reraise(*sys.exc_info())
  File "/opt/az/lib/python3.6/site-packages/six.py", line 693, in reraise
    raise value
  File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 631, in _run_job
    result = cmd_copy(params)
  File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 305, in __call__
    return self.handler(*args, **kwargs)
  File "/opt/az/lib/python3.6/site-packages/azure/cli/core/__init__.py", line 485, in default_command_handler
    return op(**command_args)
  File "/home/ubuntu/.azure/cliextensions/image-copy-extension/azext_imagecopy/custom.py", line 82, in imagecopy
    run_cli_command(cli_cmd)
  File "/home/ubuntu/.azure/cliextensions/image-copy-extension/azext_imagecopy/cli_utils.py", line 35, in run_cli_command
    raise ex
  File "/home/ubuntu/.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.6/subprocess.py", line 336, in check_output
    **kwargs).stdout
  File "/opt/az/lib/python3.6/subprocess.py", line 418, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['/opt/az/bin/python3', '-m', 'azure.cli', 'snapshot', 'create', '--name', 'server-with-appache_os_disk_snapshot', '--resource-group', '<src-resource-group-name>', '--source', '/subscriptions/d371652e-b4a0-4e59-b82d-4b5ddb762756/resourceGroups/<src-resource-group-name>/providers/Microsoft.Compute/disks/vm-for-iamge-with-apache_disk1_b6938afa59dd4aa385fb58cf4ea6afe6', '--output', 'json', '--tags', 'created_by=image-copy-extension']' returned non-zero exit status 1.
  • 出于隐私考虑,资源组的名称已被替换,我在资源组 src 和 target 中都有存储帐户,自大约 5 个月前创建源以来,两者都没有来自相同类型。有人遇到这个问题吗?
  • 注意 - 我已经删除了镜像的源 VM 及其磁盘

最佳答案

我发现了这个问题,你不能像这样传输图像,只能传输图像所在的磁盘,你可以做的就是使图像共享图库图像,然后像本教程中那样跨区域共享: https://learn.microsoft.com/en-us/azure/virtual-machines/linux/shared-images

关于azure cli az image copy 出现错误输出 : ERROR: Resource DISK is not found,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58390693/

相关文章:

azure - 无法通过 Azure 管理门户增加虚拟机大小

azure - 将 Angular 2 应用程序部署到 Azure

azure - 如何使用数组中的字段作为过滤器从 Cosmos DB 获取文档?

android - 使用 Azure Windows 10 运行 Android 模拟器

wordpress - 将 Godaddy 域指向我的 Azure Linux VM 时出现问题

azure - 无法在 PowerShell 中安装 Azure 模块

asp.net - 基于 GIT 的 asp.net Web 应用程序无法部署到 Azure,并出现 typescript 编译错误

silverlight - Silverlight 和 Azure Cloud WebRole 之间的 WCF 服务问题

azure - 如何在 Azure Log Analytics 工作区中启用 Client_IP

c# - 具有相同订阅的服务总线多个监听器实例未接收消息