How to Provide IaaS Images with Azure Stack

Save to My DOJO

How to Provide IaaS Images with Azure Stack

What is Azure Stack IaaS?

Infrastructure as a Service (IaaS) is a common definition for running virtual machines in Azure or other public cloud services.

what is Azure stack IaaS

As you can see in the second pillar of the picture above, IaaS means that you start from the guest operating system level and above. So, you are not responsible for managing the underlying hypervisor technology as this is the responsibility of the cloud provider.

In general, moving from on-prem to the cloud might be a huge project for a company, but looking at an easy and quick solution for this, the “lift and shift” scenario is quite easy. This means “just” moving the virtual machines from A to Z (on-prem to the cloud). The most important key values in such a project are:

  • Connectivity
  • (Right-) Sizing
  • Migrating to a new Hyper-V based virtual machine environment (e.g. using Azure Site Recovery), if you’re using something else
  • Understanding the new administrative Model

When we’re talking about IaaS for Azure Stack specifically, the connectivity and new administrative model are pushed – more or less – to the end of the list. Azure Stack is being run in your datacenter, you’ve made sure all the needed components are present, and you are responsible to run it.

Connectivity aside (it’s self-explanatory), looking at the two other points, the technical migration (maybe) to Hyper-V based technology (e.g. if you are on VMware) and the right-sizing of the machines are to be solved during the migration. Azure Stack itself is running on Window Server technology, and with that in mind, it supports the following VM Types:

  • A Series
  • Av2 Series
  • D Series
  • DS Series
  • DSv2 Series
  • F Series
  • Fs Series
  • Fsv2 Series

This means, there are two options when it comes to conforming to these sizes during a migration:

  1. Start from scratch
  2. Squeeze the VM to the “nearest fitting” size

Best-practice would be to deploy from scratch and migrate the data if possible, but that’s not always feasible. A lift and shift may inadvertently have issues at a later date due to not having run on Azure Stack infrastructure for its life span. This isn’t to say a full migration doesn’t work, just keep in mind the pros and cons of each scenario when making your decision.

ARM Templates in Azure Stack

Each Azure technology-based VM is based on the json file declarative approach using Azure Resource Manager (ARM) definition files. The following picture describes this a little be more in depth:

Azure Resource Manager templates

At this point, the question often becomes: “where the hell do I get these magic templates from?” With Azure Stack, the answer is quite easy, as there are three ways of doing that:

  1. Create the template in a DevOps Tool
  2. Upload an existing VM image
  3. Download an existing image from Azure to Azure Stack

As the easiest way is to download an already existing image from Azure and deploy it to Azure Stack, we will have a look at that option first. If you have deployed Azure Stack ASDK as described in this series of articles, the configuration script from Matt McSpirit has already accomplished this for you. If you are on a multi-node environment, it is part of the deployment process of the hardware OEM. So, it is almost there.

As the steps are somewhat different regarding the second scenario, we will have to look into this in two parts.

Azure Stack IaaS in Connected Scenarios

In a connected scenario, there is a way directly from the Azure Stack Admin Portal to add images from your linked Azure subscription and download them to Azure Stack.

Azure Stack Admin Portal 1

After clicking on “Add from Azure”, you will be directed to the Azure Marketplace and will see a list of marketplace items that are tagged to be supported on Azure Stack.

Azure Stack Admin Portal 2

After having chosen your appropriate new item, the download will start directly.

Azure Stack Admin Portal 3

If an image already exists, you will be able to remove or update it to a more recent version. For example, you have Windows Server already available on the Azure Stack Marketplace, but you want to provide a release with the most recent updates, it will be available here.

Depending on your internet connection speed, it may take some time to have the download finished. Once finished, you will notice that the new image is already available in the marketplace for all your Azure Stack customers. As of today, there is no way to customize the marketplace per user account.

As you may see too, other compute solutions like containers or service fabric are available via the marketplace syndication, too. Azure Stack Admin Portal 4

This means, that if you would like to deploy these solutions to your Azure Stack environment, the technical basics are similar to virtual machines

Azure Stack IaaS in Disconnected Scenarios

When Azure Stack is deployed in disconnect mode (Without Internet connectivity) you cannot use the built-in portal feature to syndicate Azure Market place items and make them available to your users.

Powershell commands are your friend to download Azure Marketplace Items with a machine that has internet connectivity and load them. The downloaded items need to be transferred to a machine with has connectivity to the Azure Stack deployment before importing them.

The tool will allow you to download an Azure Marketplace item(s) along with its dependencies.

Import the module and start the export process for an Azure Marketplace item

Import-Module .AzureStack.MarketplaceSyndication.psm1

Export-AzSOfflineMarketplaceItem -destination "[Destination path]" -azCopyDownloadThreads "[AzCopy threads number]"

You will be prompted to select an Azure Marketplace item to download locally.

Azure Marketplace

Now let us validate the download before uploading them to Azure Stack:

Test-AzSOfflineMarketplaceItem -Destination "[content folder]"

The downloaded items folder should look similar to this on complete:

Now let us upload the image to Azure Stack:

Import-Module .AzureStack.MarketplaceSyndication.psm1

$credential = Get-Credential -Message "Enter the azure stack operator credential"

Import-AzSOfflineMarketplaceItem -origin "[marketplace folder]" -AzsCredential $credential

After having this done properly, you will be able to see the new images in your Azure Stack Marketplace.

Custom IaaS Images

If you do not want to start using fresh deployments and need to create customized images, then the following tasks need to be completed.

  1. Make sure that the image is VHD format and NOT VHDX
  2. Upload the image to a Blob storage that has the following format: <storageAccount>/<blobContainer>/<targetVHDName>.vhd
  3. To make the blob anonymously accessible, go to the storage account blob container where the VM image VHD was uploaded. Select Blob, and then select Access policy. Optionally, you can generate a shared access signature for the container and include it as part of the blob URI. This step makes sure the blob is available to be used for adding this as an image. If the blob is not anonymously accessible, the VM image will be created to in a failed state.

Custom IaaS Images

  1. Add the new VM to Azure Stack as described in the section above using PowerShell
  2. Create a new Gallery item as described here
  3. If there are VM extensions that need to be added, this PowerShell wizardry will help

Now, the new VM is available in the Azure Stack Marketplace with your custom image, icon and optionally the VM extension.


As you have seen in this article, adding virtual machines to Azure Stack as templates are relatively straightforward using a step by step approach. This is one of the most important project steps after having deployed Azure Stack in your environment as this setup provides your customers the ability to deploy virtual machines in an IaaS scenario using your environment. It even provides the technical basis to provide some higher level cloud solutions eventually as well, like Platform as a Service (PaaS) as they all ultimately rely on virtual machines. The only goal of PaaS is that you do not have to manage the PaaS solution, you just could consume it. But nevertheless, it is a set of virtual machines when used on Azure Stack. We’ll be getting more into PaaS in a future segment.

Again, if you just want to migrate virtual machines from your on-premises environment to Azure Stack, there are different options available:

  1. Using the downtime approach and uploading the VHD to Azure Stack (Like shown above), re-configuring the VM and powering it on
  2. Using Azure Site Recovery to migrate the VM to Azure compatible format and then upload and reconfigure it. – Can be time-consuming
  3. Using 3rd party software solutions to synchronize them to Azure Stack

By the end, nevertheless, which technology you start with for your Azure Stack migration process, it will all result in the “lift and shift” scenario and will move your VMs to Azure Stack. Once complete your old production environment can be demoted, and you’re now officially a tenant of Azure Stack.

Thanks for reading! Do let us know if you have questions in the comments section below!

More Great Content on Azure Stack For You

An Introduction to the Microsoft Hybrid Cloud Concept and Azure Stack

How to Install the Azure Stack Development Toolkit (ASDK)

The Ultimate Azure Stack Post-Installation Checklist

Altaro Hyper-V Backup
Share this post

Not a DOJO Member yet?

Join thousands of other IT pros and receive a weekly roundup email with the latest content & updates!

Leave a comment or ask a question

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

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

Notify me of follow-up replies via email

Yes, I would like to receive new blog posts by email

What is the color of grass?

Please note: If you’re not already a member on the Dojo Forums you will create a new account and receive an activation email.