Unable to copy image to another resource group #1151
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Command Name
az image copy Extension Name: image-copy-extension. Version: 0.2.2.
Errors:
Command '['/usr/bin/python', '-m', 'azure.cli', 'snapshot', 'create', '--name', 'optimizerredis-0.1.3_os_disk_snapshot', '--resource-group', 'sa-beta', '--source', u'https://factoryoptimizerred2235.blob.core.windows.net/vhds/optimizerredis-0.1.3.vhd', '--output', 'json', '--tags', 'created_by=image-copy-extension']' returned non-zero exit status 1 Traceback (most recent call last): python2.7/site-packages/knack/cli.py, ln 206, in invoke cmd_result = self.invocation.execute(args)
Suggested Solution:
Add a new variable to get the storage account id that is created and then pass it to create the snapshot. as in below example :
json_output = run_cli_command(cli_cmd, return_as_json=True)
target_blob_endpoint = json_output['primaryEndpoints']['blob']
target_sa_id = json_output['id']
and on the command to create the new snapshot:
cli_cmd = prepare_cli_command(['snapshot', 'create',
'--resource-group', snapshot_resource_group_name,
'--name', target_snapshot_name,
'--location', location,
'--source', target_blob_path,
'--source-storage-account-id', target_sa_id ],
subscription=target_subscription)
Tested locally and it is working as expected.
This checklist is used to make sure that common guidelines for a pull request are followed.
General Guidelines
azdev style <YOUR_EXT>
locally? (pip install azdev
required)python scripts/ci/test_index.py -q
locally?For new extensions: