[Azure Stack] Add a custom image to your Library

February 4, 2016 at 7:00 am in Azure Stack, Microsoft, TP1 by Florent

I continue to discover the Azure Stack every day, and today, I will explain to you on how to import a VHD in your Azure Stack compute interface (Platform Image Repository).

To start, deploy your virtual machine, in GENERATION 1 and with a VHD. It’s very important because Azure Stack doesn’t support Generation 2 VMs in this TP1 and doesn’t support VHDX. I will deploy a Windows Server 2016 TP4 VM. When the VM is installed, we need to sysprep the VM. Do a sysprep:

image

When the sysprep is done, copy the VHD to a temp folder, for example, in C:\Temp:

image

Now, navigate to your DataImage hard drive. In my lab, it’s the G:\ and go to the following path:

cd G:\CRP\VM\Microsoft.AzureStack.Compute.Installer\content\Scripts

Here, you have some scripts:

image

We will use the script named CopyImageToPlatformImageRepository.ps1. This script will copy your custom VHD to the share \\sofs\Share\CRP\PlatformImages and create a custom Manifest for this disk.

This script must have the following parameter:

  • PlatformImageRepositoryPath: For this TP1, it’s \\SOFS\Share\CRP\PlatformImages\
  • ImagePath: The path where is the VHD that you syspreped
  • Publisher: The name of the publisher or what you want
  • Offer: The type of the offer
  • Sku: A tag for the VHD
  • Version: The version of this VHD
  • OSType: Windows or Linux

For the parameter Publisher, Offer and Sku, keep the value that you provide, because if you want to create a custom item in the Market Place, you will need them. Now, adapt the following script and execute it:

.\CopyImageToPlatformImageRepository.ps1 -PlatformImageRespositoryPath \\SOFS\Share\CRP\PlatformImages\ -ImagePath ‘C:\Temp\WindowsServer2016TP4.vhd’ -Publisher "FlorentAppointaire" -Offer "WindowsServer" -Sku "2016-TP4" -Version 1.0.0 -OsType Windows –Verbose

image

The new VHD is now deploy with a manifest with your parameters:

image

image

Restart your browser to see the new VHD in the Compute part on https://portal.azurestack.local:

image

You can deploy it and after few minutes, you will be able to connect to it:

image

In the next tuto, I will explain to you how to create a custom template for the market place Sourire