In this blog post I will explain how you can add multiple custom images to Azure Stack.
At cubesys we have a brand new Azure Stack environment that we use as a demo and test environment for our consultants. Each consultant has his own subscription with pre-defined quotas that they can use to build, test and destroy whenever and whatever they want to test. One of our senior consultants asked me add the following custom images as he wanted to test and validate a System Center upgrade scenario:
So let’s make our tenant happy shall we?
First of all you will have to sysprep the virtual machines.
Sysprep /generalize /shutdown /oobe /mode:vm
Sysprep /generalize /shutdown /oobe
Once complete the virtual machines will shutdown automatically. Copy the sysprepped virtual hard drives to another location. In my case E:\templates
Once we have all our virtual machines sysprepped and copied the virtual hard drives we can add them to Azure Stack. To add a new image to Azure stack it needs to be added to the Platform Image Repository or PIR. Microsoft has provided a PowerShell script (CopyImageToPlatformImageRepository.ps1) to do this.
You can find this PowerShell script on the MicrosoftAzureStackPOC.vhd virtual hard drive.
The script requires the following parameters:
We can now use the parameters above to launch the script:
.\CopyImageToPlatformImageRepository.ps1 -PlatformImageRespositoryPath \\SOFS\Share\CRP\PlatformImages\ -ImagePath ‘C:\templates\Sysprep2008R2.vhd’ -Publisher "Microsoft" -Offer "WindowsServer" -Sku "2008-R2" -Version 1.0.0 -OsType Windows –Verbose
After the command completes, restart your browser to see the new item in the Marketplace. The image can now be referenced in your virtual machine deployment templates. In some cases it may take up to 5 minutes for this new image to appear in the Marketplace.