Building your Azure RemoteApp template images is quite a straightforward operation. You can create your image .vhd on-premises or you can use the Windows Server 2012 R2 Session Host from the Azure Gallery. The latter contains a complete script to check if all requirements are met before shutting down the VM with Sysprep (but doesn’t facilitate the requirement mentioned in this post).
Fortunately, Microsoft was nice to provide an overview with the requirements which must be met to prepare your template image(s) which is available at the following location:
https://azure.microsoft.com/en-us/documentation/articles/remoteapp-imagereqs
Unfortunately, one requirement is missing which will cause the image upload process to fail. Before creating a generalized .vhd with Sysprep the file %SYSTEMDRIVE%\Windows\Panther\unattend.xml needs to be removed.
You can see in the Upload-AzureRemoteAppTemplateImage.ps1 file downloaded from Azure that the presence of this file is checked before the actual upload.
Below is the relevant part of the script that does this checking:
# verify unattend file locations
if(Test-Path -LiteralPath ($winVolume + “windows\Panther\Unattend\Unattend.xml”) -PathType Leaf)
{
Write-Error ($CurrentCultureTable[$UnattendFileError] + ” $winDrive\windows\Panther\Unattend\Unattend.xml.”)
$validImage = $false
}
if(Test-Path -LiteralPath ($winVolume + “windows\Panther\Unattend\Autounattend.xml”) -PathType Leaf)
{
Write-Error ($CurrentCultureTable[$UnattendFileError] + ” $winDrive\windows\Panther\Unattend\Autounattend.xml.”)
$validImage = $false
}
if(Test-Path -LiteralPath ($winVolume + “windows\Panther\Unattend.xml”) -PathType Leaf)
{
Write-Error ($CurrentCultureTable[$UnattendFileError] + ” $winDrive\windows\Panther\Unattend.xml.”)
$validImage = $false
}
if(Test-Path -LiteralPath ($winVolume + “windows\Panther\Autounattend.xml”) -PathType Leaf)
{
Write-Error ($CurrentCultureTable[$UnattendFileError] + ” $winDrive\windows\Panther\Autounattend.xml.”)
$validImage = $false
}
if(Test-Path -LiteralPath ($winVolume + “Unattend.xml”) -PathType Leaf)
{
Write-Error ($CurrentCultureTable[$UnattendFileError] + ” Found: $winDrive\Unattend.xml.”)
$validImage = $false
}
if(Test-Path -LiteralPath ($winVolume + “Autounattend.xml”) -PathType Leaf)
{
Write-Error ($CurrentCultureTable[$UnattendFileError] + ” $winDrive\Autounattend.xml.”)
$validImage = $false
}
Too bad that Microsoft forgot to mention this in the requirements overview…