12

I need to create an Azure VM image that can be used by other people to create VMs in their own subscriptions.

I've looked at the Azure documentation for VMs and images. I can find info on how to create images and about how to create VMs from an image. But I cannot find any reliable information on whether there's any way to make my VM available to other people with their own subscriptions. The official Microsoft Azure documentation doesn't ever say whether or not this can be done. Some unofficial sources seem to say that I need to put the image in a Container and make the Container public, and people can copy it to their own subscription.

Can anyone tell me whether my goal in the first paragraph is possible, and if so how do I do it?

Rick Kirkham
  • 221
  • 1
  • 2
  • 4
  • 2
    https://docs.microsoft.com/en-us/azure/virtual-machines/windows/shared-image-galleries was the first result from a search for `azure share vm image`. This seems to be what you're looking for? – Michael Hampton Nov 03 '18 at 19:10
  • 1
    Do you want to share this image with entities that you have some association with or do you want to offer it to the Azure market as a whole? If the latter, take a read here: https://azuremarketplace.microsoft.com/en-us/sell#getStarted – joeqwerty Nov 03 '18 at 20:54
  • Have you had any luck doing so @Rick? – Rafs Sep 09 '21 at 10:34
  • @Jabro The project I was working on was cancelled shortly after I posted the question, so I never tried any of the answers. – Rick Kirkham Sep 10 '21 at 00:21

3 Answers3

5

The link Michael provided is the official process of sharing Images within your company (same AD Tenant) across subscription and region.

https://docs.microsoft.com/en-us/azure/virtual-machines/windows/shared-image-galleries

One key thing to point out it's still in preview which means it limited and you will need to manually register the feature.

Hope this help.....

Hannel
  • 651
  • 4
  • 9
  • How can we share the image across AD tenancies? Especially with a CSP customer – Rafs Sep 06 '21 at 08:42
  • That response was 3 years old, the same feature can now share images accross tenants. `Sharing across subscriptions, and even between Active Directory (AD) tenants, using Azure RBAC`. Please review the link – Hannel Sep 07 '21 at 14:59
  • The problem is as a reseller, I'm using the same email address on both ends. It's not clear to me how to share when the email address, the cornerstone of RBAC as I see it, is identical.. – Rafs Sep 09 '21 at 10:29
3

google is your friend!!

besides the new gallery feature mentioned in the comments, you can do it manually, the "old" way.

Create an managed image in the source subscription

Create a managed snapshot of the OS disk from the generalized VM

Copy the managed snapshot to the target Azure subscription

In the target subscription, create an managed image from the copied snapshot

all steps described comprehensively includes code snippets:

https://michaelcollier.wordpress.com/2017/05/03/copy-managed-images/

Falco Alexander
  • 235
  • 1
  • 5
2

According to the shared image gallery docs linked by Hannel:

Q. How can I list all the Shared Image Gallery resources across subscriptions?

A. In order to list all the Shared Image Gallery resources across subscriptions that you have access to on the Azure portal, follow the steps below:

Open the Azure portal. Go to All Resources. Select all the subscriptions under which you’d like to list all the resources. Look for resources of type Private gallery.

To see the image definitions and image versions, you should also select Show hidden types.

To list all the Shared Image Gallery resources across subscriptions that you have permissions to, use the following command in the Azure CLI:

az account list -otsv --query "[].id" | xargs -n 1 az sig list --subscription

Q. How do I share my images across subscriptions?

A. You can share images across subscriptions using Role Based Access Control (RBAC). Any user that has read permissions to an image version, even across subscriptions, will be able to deploy a Virtual Machine using the image version.

Q. Can I move my existing image to the shared image gallery?

A. Yes. There are 3 scenarios based on the types of images you may have.

Scenario 1: If you have a managed image, then you can create an image definition and image version from it.

Scenario 2: If you have an unmanaged generalized image, you can create a managed image from it, and then create an image definition and image version from it.

Scenario 3: If you have a VHD in your local file system, then you need to upload the VHD, create a managed image, then you can create and image definition and image version from it.

If the VHD is of a Windows VM, see Upload a generalized VHD. If the VHD is for a Linux VM, see Upload a VHD

...

Q. Can I create a shared image gallery, image definition, and image version through the Azure portal?

A. No, currently we do not support the creation of any of the Shared Image Gallery resources through Azure portal. However, we do support the creation of the Shared Image Gallery resources through CLI, Templates, and SDKs. PowerShell will also be released soon.

mcint
  • 121
  • 3