From 076f947609760d08fe7e725ac767350c34e25e0f Mon Sep 17 00:00:00 2001 From: Ibrahim Abedalghafer <52040217+imabedalghafer@users.noreply.github.com> Date: Fri, 13 Dec 2019 16:39:26 +0200 Subject: [PATCH] To match the new change in Azure ClI As the new Azure CLI create snapshot requires the storage account id to be a parameter based when creating the new snapshot --- src/image-copy/azext_imagecopy/create_target.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/image-copy/azext_imagecopy/create_target.py b/src/image-copy/azext_imagecopy/create_target.py index d5ec78513c2..b2911bdeddd 100644 --- a/src/image-copy/azext_imagecopy/create_target.py +++ b/src/image-copy/azext_imagecopy/create_target.py @@ -39,6 +39,8 @@ def create_target_image(location, transient_resource_group_name, source_type, so json_output = run_cli_command(cli_cmd, return_as_json=True) target_blob_endpoint = json_output['primaryEndpoints']['blob'] + # for the new update on Azure CLI : https://docs.microsoft.com/en-us/cli/azure/release-notes-azure-cli?view=azure-cli-latest#compute + target_sa_id = json_output['id'] # Setup the target storage account cli_cmd = prepare_cli_command(['storage', 'account', 'keys', 'list', @@ -112,12 +114,14 @@ def create_target_image(location, transient_resource_group_name, source_type, so snapshot_resource_group_name = target_resource_group_name else: snapshot_resource_group_name = transient_resource_group_name - + + #To add the storage account ID cli_cmd = prepare_cli_command(['snapshot', 'create', '--resource-group', snapshot_resource_group_name, '--name', target_snapshot_name, '--location', location, - '--source', target_blob_path], + '--source', target_blob_path, + '--source-storage-account-id', target_sa_id], subscription=target_subscription) json_output = run_cli_command(cli_cmd, return_as_json=True)