azure-cli: Failed to copy image from one region to another
This is autogenerated. Please review and update as needed.
Describe the bug
Trying to copy an image from region eastus to westus2 and it failed after about an hour.
Command Name
$ az image copy --subscription <subid> --source-resource-group eastrg --source-object-name datapathimageeast06sep2019 --target-location westus2 --target-name datapathimagewest206sep2019 --target-resource-group “west2rg”
Errors:
$ az image copy --subscription <subid> --source-resource-group eastrg --source-object-name datapathimageeast06sep2019 --target-location westus2 --target-name datapathimagewest206sep2019 --target-resource-group "west2rg"
Getting os disk id of the source vm/image
Creating source snapshot
Getting sas url for the source snapshot with timeout: 3600 seconds
Target location count: 1
Starting async process for all locations
westus2 - Creating target storage account (can be slow sometimes)
westus2 - Creating container in the target storage account
westus2 - Copying blob to target storage account
westus2 - Copy progress: 0%
The copy operation didn't succeed. Last status: failed
Command run: ['/usr/bin/python', '-m', 'azure.cli', 'storage', 'blob', 'show', '--name', 'datapathimageeast06sep2019_os_disk_snapshot.vhd', '--container-name', 'snapshots', '--account-name', 'westus2081offob6fsepv16u', '--output', 'json']
Command output: {u'name': u'datapathimageeast06sep2019_os_disk_snapshot.vhd', u'deleted': False, u'content': u'', u'snapshot': None, u'properties': {u'pageRanges': [], u'blobTierInferred': False, u'lastModified': u'2019-09-07T19:15:55+00:00', u'blobTier': None, u'contentLength': 0, u'serverEncrypted': True, u'appendBlobCommittedBlockCount': None, u'deletedTime': None, u'blobTierChangeTime': None, u'blobType': u'PageBlob', u'etag': u'"0x8D733C7CE747FB0"', u'remainingRetentionDays': None, u'contentSettings': {u'contentType': u'application/octet-stream', u'contentLanguage': None, u'contentMd5': u'kGnbuEY/+4VkXdDGkzkBdQ==', u'contentEncoding': None, u'cacheControl': None, u'contentDisposition': None}, u'creationTime': u'2019-09-07T18:16:47+00:00', u'copy': {u'status': u'failed', u'id': u'95808241-afe7-4c43-8588-7f298d3f4898', u'source': u'https://\<blah\>', u'completionTime': u'2019-09-07T19:15:55+00:00', u'progress': u'25654390784/274877907456', u'statusDescription': u'403 AuthenticationFailed "Copy failed when reading the source."'}, u'pageBlobSequenceNumber': 6, u'contentRange': None, u'lease': {u'duration': None, u'status': u'unlocked', u'state': u'available'}}, u'metadata': {u'PIRTag': u'1'}}
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 --subscription <subid> --source-resource-group eastrg --source-object-name datapathimageeast06sep2019 --target-location westus2 --target-name datapathimagewest206sep2019 --target-resource-group “west2rg”
Expected Behavior
It copies the image from region to another.
Environment Summary
Linux-3.10.0-862.3.2.el7.x86_64-x86_64-with-centos-7.5.1804-Core
Python 2.7.5
Shell: bash
azure-cli 2.0.72
Extensions:
image-copy-extension 0.2.1
Additional Context
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 19 (10 by maintainers)
Hello @geminiyeak geminiyeak
I have tested the script in my lab environment and here is an analysis on it.
Error – WARNING: Creating source snapshot WARNING: Getting sas url for the source snapshot with timeout: 3600 seconds WARNING: Creating resource group: image-copy-rg WARNING: Target location count: 1 WARNING: SoutheastAsia - Creating target storage account (can be slow sometimes) WARNING: SoutheastAsia - Creating container in the target storage account WARNING: SoutheastAsia - Copying blob to target storage account WARNING: SoutheastAsia - Copy progress: 0% WARNING: SoutheastAsia - Copy progress: 1% WARNING: SoutheastAsia - Copy progress: 2% WARNING: SoutheastAsia - Copy progress: 3% WARNING: SoutheastAsia - Copy progress: 4% WARNING: SoutheastAsia - Copy progress: 5% WARNING: SoutheastAsia - Copy progress: 6% WARNING: SoutheastAsia - Copy progress: 7% WARNING: SoutheastAsia - Copy progress: 8% WARNING: SoutheastAsia - Copy progress: 9% WARNING: SoutheastAsia - Copy progress: 10% WARNING: SoutheastAsia - Copy progress: 11% WARNING: SoutheastAsia - Copy progress: 12% WARNING: SoutheastAsia - Copy progress: 13% WARNING: SoutheastAsia - Copy progress: 14% ERROR: The copy operation didn’t succeed. Last status: failed ERROR: Command run: [‘C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\python.exe’, ‘-m’, ‘azure.cli’, ‘storage’, ‘blob’, ‘show’, ‘–name’, ‘img-go01-eas-win16datacenter-1.0.6_os_disk_snapshot.vhd’, ‘–container-name’, ‘snapshots’, ‘–account-name’, ‘southeastasia’, ‘–output’, ‘json’, ‘–subscription’, ‘xxxxxxxxxxxx’] ERROR: Command output: {‘content’: ‘’, ‘deleted’: False, ‘metadata’: {‘PIRTag’: ‘1’}, ‘name’: ‘img-go01-eas-win16datacenter-1.0.6_os_disk_snapshot.vhd’, ‘properties’: {‘appendBlobCommittedBlockCount’: None, ‘blobTier’: None, ‘blobTierChangeTime’: None, ‘blobTierInferred’: False, ‘blobType’: ‘PageBlob’, ‘contentLength’: 0, ‘contentRange’: None, ‘contentSettings’: {‘cacheControl’: None, ‘contentDisposition’: None, ‘contentEncoding’: None, ‘contentLanguage’: None, ‘contentMd5’: ‘7qZ8DuL4HTsiWGqirCO0fw==’, ‘contentType’: ‘application/octet-stream’}, ‘copy’: {‘completionTime’: ‘2020-03-03T03:01:39+00:00’, ‘id’: ‘xxxxxxxxxx’, ‘progress’: ‘20410948096/136367309312’, ‘source’: ‘’, ‘status’: ‘failed’, ‘statusDescription’: ‘403 AuthenticationFailed “Copy failed when reading the source.”’}, ‘creationTime’: ‘2020-03-03T02:02:52+00:00’, ‘deletedTime’: None, ‘etag’: ‘“0x8D7BF1F319B07B2”’, ‘lastModified’: ‘2020-03-03T03:01:39+00:00’, ‘lease’: {‘duration’: None, ‘state’: ‘available’, ‘status’: ‘unlocked’}, ‘pageBlobSequenceNumber’: 96, ‘pageRanges’: [], ‘remainingRetentionDays’: None, ‘serverEncrypted’: True}, ‘snapshot’: None} ERROR: Blob copy failed
The az image copy command above is failing due to expiration of lease which is created by default for 3600
Getting os disk id of the source vm/image Creating source snapshot Getting sas url for the source snapshot with timeout: 3600 seconds Creating resource group: image-copy-rg Target location count: 1 Starting async process for all locations westus - Creating target storage account (can be slow sometimes) westus - Creating container in the target storage account westus - Copying blob to target storage account westus - Copy progress: 0% westus - Copy progress: 1% westus - Copy progress: 2%
Please modify the “az image copy” command to include a higher timeout value and perform and let us know if this helps.
az image copy --source-resource-group “XXX” --source-object-name “XXX”
–target-location “XXX” --target-resource-group “XXX” --target-subscription “XXX” --target-name “XXX” --timeout 36000 --cleanup