Azure / azure-cli-extensions

Public Repository for Extensions of Azure CLI.
https://docs.microsoft.com/en-us/cli/azure
MIT License
383 stars 1.24k forks source link

Error trying to move an image from eastus2 to westeurope #981

Closed nemrism closed 4 years ago

nemrism commented 5 years ago

Describe the bug

Command Name az image copy Extension Name: image-copy-extension. Version: 0.2.1.

Errors:

Command '['C:\\Program Files (x86)\\Microsoft SDKs\\Azure\\CLI2\\python.exe', '-m', 'azure.cli', 'snapshot', 'create', '--name', 'devopsVS2017-image-20191005203740_os_disk_snapshot', '--resource-group', 'AzureDeOps-rg', '--source', '/subscriptions/6f335c6c-6850-40da-a64c-37021daaa4c6/resourceGroups/AZUREDEOPS-RG/providers/Microsoft.Compute/disks/devopsVS2017_OsDisk_1_bf58f98dc70144cab32b31b4630d8a61', '--output', 'json', '--tags', 'created_by=image-copy-extension']' returned non-zero exit status 1.
Traceback (most recent call last):
pip-install-rg707cll\knack\knack\cli.py, ln 206, in invoke
cli\core\commands\__init__.py, ln 603, in execute
cli\core\commands\__init__.py, ln 661, in _run_jobs_serially
...

To Reproduce:

Expected Behavior

Expected result is a successful move of the VM image to the new location in order to recreate the VM in the targeted resource group and location.

Environment Summary

Windows-10-10.0.18995-SP0
Python 3.6.6
Shell: powershell.exe

azure-cli 2.0.73 *

Extensions:
azure-devops 0.12.0
image-copy-extension 0.2.1

Additional Context

tamirkamara commented 5 years ago

@nemrism please provide the debug output by running the command again with the --debug flag

nemrism commented 5 years ago

Here we go, with a fresh new image, @tamirkamara https://1drv.ms/u/s!Attz0_FK8eIXhss1LGmY8xK-zAOhZw?e=Q8dFSf

tamirkamara commented 5 years ago

Thank you. The error indicates that the OS disk of the VM used to create the image is missing. Are you aware that this is a requirement for the extension to be able to copy the image? If you are aware, please confirm that you see the disk in your subscription.

nemrism commented 5 years ago

Indeed, I've checked the resource URI / ID and can access it without any problem in my subscription

nemrism commented 5 years ago

And here you'll find its properties @tamirkamara

/subscriptions/6f335c6c-6850-40da-a64c-37021daaa4c6/resourceGroups/AzureDevOps-rg/providers/Microsoft.Compute/disks/devopsVS2017_OsDisk_1_bf58f98dc70144cab32b31b4630d8a61

image

tamirkamara commented 5 years ago

Can you try and run the failing step "by hand"? az snapshot create --name devopsVS2017-image-20191019202000_os_disk_snapshot --resource-group AzureDevOps-rg --source /subscriptions/6f335c6c-6850-40da-a64c-37021daaa4c6/resourceGroups/AZUREDEVOPS-RG/providers/Microsoft.Compute/disks/devopsVS2017_OsDisk_1_bf58f98dc70144cab32b31b4630d8a61 --output json --tags created_by=image-copy-extension

if it fails please also add --debug and send me the output

nemrism commented 5 years ago

Of course, and if it succeeds, how do I continue the move please? I'll post the result in a few

nemrism commented 5 years ago

@tamirkamara, got the exact same problem, which is quite coherent ^^ https://1drv.ms/u/s!Attz0_FK8eIXhss27eacjNCycJ-tcA?e=99wmSB

tamirkamara commented 5 years ago

Yes... so it looks like not something specific to the extension since the native command also fails. I would do the following:

  1. try to snapshot the disk on the azure portal to see if it works or not. you should see the button "create snapshot" when viewing the disk resource.
  2. with the result, open a support ticket to have their help get to the root of the problem
nemrism commented 5 years ago

Ok, thanks for your help @tamirkamara

I already have an open ticket for the overall operation but have no solution yet...

nemrism commented 5 years ago

Actually just tested, and it works using Azure Portal

image

tamirkamara commented 5 years ago

I would add the information above to help the support engineer focus on the actual issue...

nemrism commented 5 years ago

@tamirkamara Could you tell me what are the other steps the extension is wrapping under the image copy command?

I'll try to make them all under the Portal to see if I can achieve the move like this.

tamirkamara commented 5 years ago

Hi, Have a look in the code here. This is the step which fails for you to create the snapshot. If you follow along you'll find a bunch of commands getting issued from that custom.py file as well as create_target.py. I hope that helps.

nemrism commented 5 years ago

@tamirkamara I've been told by the support that azure cli does not support moving image between those regions for the moment. They are guiding me to make it through Powershell which is the only way to do it right now. It should be interesting to document that limitation in the extension wiki/help if it is not already the case!

tamirkamara commented 5 years ago

Hi, While support is right, this isn't exactly what I wanted their help with. Granted that the cli doesn't have builtin support for copying images, which is exactly why the extension exists. The 2 regions aren't related. The extension worked great for the last 2 years between those two regions (and many others). You have a somewhat special case for a reason we don't know yet, which causes a problem to create a disk snapshot through the CLI. I believe there're a couple of other issues from other users that look very similar to yours, and I wanted to get support help in finding out the root cause so we could potentially fix the issue.

Would it be possible for you to ask support a very simple question:

Why does the following command fail: az snapshot create --name devopsVS2017-image-20191019202000_os_disk_snapshot --resource-group AzureDevOps-rg --source /subscriptions/6f335c6c-6850-40da-a64c-37021daaa4c6/resourceGroups/AZUREDEVOPS-RG/providers/Microsoft.Compute/disks/devopsVS2017_OsDisk_1_bf58f98dc70144cab32b31b4630d8a61 --output json

Thanks, Tamir

nemrism commented 5 years ago

Hi Tamir,

I would answer to you like this:

Welcome to my wonderful real world with MS support ^^

While I'm quite aligned with you and would like to understand the root cause of the problem, I was wondering if there is a way for me to copy you directly in my mail thread with those guys.

Moreover, I'll stay in touch with them until I got a full solution. As it will probably also fail using the Powershell commands, which also rely on the Azure API, I'll keep you updated with this.

Best, Aymeric

tamirkamara commented 5 years ago

Sure. My email - firstname.lastname at microsoft.com

nemrism commented 5 years ago

Hi @tamirkamara

As expected (or not), I had the session with L2 support engineer which was unsuccessful using Powershell too... I don't know exactly why but you weren't cced in the emails we exchanged during this unsuccessful session. I'll forward you the latest summary and asked them to get in touch with you or at least look at the work with done together using this Github thread.

nemrism commented 5 years ago

@tamirkamara things are still ongoing. I'm about to start the 3rd debugging session with support engineers tomorrow. We are currently trying to perform this move using a shared image library, after it failed to perform it with Powershell! (2x)

I've tried to ask them if we could investigate the failing az cli command, but it seems they are bigger fans of Powershell. Anyway, I'll keep you posted at the end of the support ticket.

Do you want to join us, at some times, in one of our Teams session?

nemrism commented 4 years ago

hi @tamirkamara I'm closing this issue as MS support won't investigate further and finally gave me a workaround as it was impossible to perform the move via AzCLI or PS... We finally used a distributed shared image accross regions!

ghost commented 4 years ago

Thanks for working with Microsoft on GitHub! Tell us how you feel about your experience using the reactions on this comment.