Share images across subscriptions and tenants in Azure

Hi Guys,

In this blog post, I’m going to show you how to share images across subscriptions and tenants in Azure. This is a useful feature if you want to reuse your custom images in different environments or share them with other users.

The basic steps are:

  • Create a shared image gallery in your source subscription and tenant.
  • Add your images to the gallery and assign permissions to the target subscriptions and tenants.
  • Use the shared image gallery as a source when creating virtual machines in the target subscriptions and tenants.

Let’s see how it works in detail.

Create a shared image gallery

A shared image gallery is a resource that stores your images and allows you to share them across subscriptions and tenants. You can create one by using the Azure portal, PowerShell, or CLI.

To create a shared image gallery in the Azure portal, follow these steps:

  • Sign in to the Azure portal and select Create a resource.
  • Search for Shared image gallery and select it.
  • Click Create.
  • Enter a name, resource group, location, and description for your gallery.
  • Click Review + create and then Create.

Add images to the gallery and assign permissions

Once you have created a shared image gallery, you can add your images to it and assign permissions to the target subscriptions and tenants. You can do this by using the Azure portal, PowerShell, or CLI.

To add an image to the gallery and assign permissions in the Azure portal, follow these steps:

  • Go to your shared image gallery and select Images under Settings.
  • Click Add image definition.
  • Enter a name, resource group, location, publisher, offer, SKU, operating system type, end of life date, and description for your image definition.
  • Click Next: Image version >.
  • Select an existing image from your source subscription or upload a new one from your local machine or a storage account.
  • Enter a version number for your image version.
  • Click Next: Replication >.
  • Select the regions where you want to replicate your image version.
  • Click Next: Permissions >.
  • Select the target subscriptions and tenants that you want to grant access to your image version. You can also specify the role assignment for each subscription or tenant. The available roles are Reader and Contributor.
  • Click Review + create and then Create.

Use the shared image gallery as a source when creating virtual machines

Now that you have shared your images across subscriptions and tenants, you can use them as a source when creating virtual machines in the target subscriptions and tenants. You can do this by using the Azure portal, PowerShell, or CLI.

To use a shared image as a source when creating a virtual machine in the Azure portal, follow these steps:

  • Sign in to the Azure portal with the target subscription and tenant.
  • Select Create a resource.
  • Search for Virtual machine and select it.
  • Click Create.
  • Enter a name, resource group, location, availability options, size, username, password, inbound port rules, and licensing for your virtual machine.
  • Under Image source, select Shared image gallery.
  • Select your shared image gallery, image definition, and image version from the drop-down lists.
  • Click Review + create and then Create.

That’s it! You have successfully shared images across subscriptions and tenants in Azure. I hope you found this blog post helpful. If you have any questions or feedback, please leave a comment below.

Thanks for reading!

Leave a Reply

Your email address will not be published. Required fields are marked *