Azure CLI Image Copy Extension – allows you to copy virtual machine images between regions with just one command.
Published Mar 21 2019 10:03 AM 4,840 Views
First published on MSDN on Jan 18, 2018

This is an extension to azure cli that allows copying virtual machine images between regions with just one command.

The extension simplifies the process and also enables you to save time by copying to multiple regions in parallel. This is now becoming a question I am getting a lot from UK Academics who now wish to move existing Azure resources to the UK Azure Data Center

How to use

Step1. You need Azure Command Line Interface Installed

Step 2. Install Azure CLI


Install on macOS

On macOS, you are able to install either with Homebrew or manually.

Install with Homebrew
  1. If you don't have it already, install Homebrew by following the Homebrew installation instructions .

  2. If you have previously installed the CLI manually, follow the manual uninstall instructions.

  3. Update your local Homebrew repositories.


    brew update
  4. Install the azure-cli package.


    brew install azure-cli


If you previously installed the Azure CLI 1.0 with Homebrew, instead of installing the package you can get CLI 2.0 through the regular Homebrew upgrade process.


brew upgrade
Install manually
  1. Install Azure CLI 2.0 with curl .


    curl -L | bash
  2. You may have to restart your shell for some changes to take effect.


    exec -l $SHELL
  3. Run the CLI from the command prompt with the az command.

Install on WindowsInstall with MSI for the Windows command-line

To install the CLI on Windows and use it in the Windows command-line, download and run the Azure CLI Installer (MSI) .

Install with apt-get for Bash on Ubuntu on Windows
  1. If you don't have Bash on Windows, install it .

  2. Open the Bash shell.

  3. Modify your sources list.


    echo "deb [arch=amd64] wheezy main" | \
    sudo tee /etc/apt/sources.list.d/azure-cli.list
  4. Run the following sudo commands:


    sudo apt-key adv --keyserver --recv-keys 52E16F86FEE04B979B07E28DB02C46DF417A0893
    sudo apt-get install apt-transport-https
    sudo apt-get update && sudo apt-get install azure-cli

  5. Run the CLI from the command prompt with the az command

Step 3. Install the Extension

First, install the extension:

az extension add --name image-copy-extension

Step4, Run the Extension command

Then, call it as you would any other az command:

az image copy --source-resource-group mySources-rg --source-object-name myImage --target-location uksouth northeurope --target-resource-group "images-repo-rg" --cleanup

One thing you should keep in mind is that we are relying on the source os disk as the actual source for the copy. So, when you "capture" a new image off a vm in Azure, don't delete the os disk if your intention is to copy it to other regions.

Other options and examples of using the extensions can be viewed with the help command:

az image copy --help


This extension is also available at so if your interested in building out your own extensions.

1 Comment
Version history
Last update:
‎Mar 21 2019 10:03 AM
Updated by: