Deploying Web server (IIS) Virtual Machine Role through Gallery from WAP Tenant Portal

When I tried to deploy the Web server (IIS) VM role from WAP. I ran into multiple issues. I thought to share so that it can help others.
I imported the IIS gallery item using GRIT 1.2 tool and tried to deploy from the WAP Tenant Portal and got below errors

This I got when I used the manually syspreped VHDX:

Error (13206)
Virtual Machine Manager cannot locate the boot or system volume on virtual machine Computer002. The resulting virtual machine might not start or operate properly.

This I got when I used the Convert-WindowsImage.ps1 without including the NetFx3 feature in VHD:

Error (31304)
VM Role resource (iis01) was not successfully deployed in the Cloud Service.

Error (22011)
VMM failed to enable the specified server features Web-WMI;Web-Request-Monitor;Web-Scripting-Tools;Web-Custom-Logging;Web-Digest-Auth;Web-Windows-Auth;Web-Url-Auth;Web-WHC;Web-Static-Content;Web-Ftp-Server;Web-Mgmt-Console;Web-Default-Doc;Web-ISAPI-Filter;Web-Server;Web-Filtering;Web-App-Dev;Web-Net-Ext45;Web-Log-Libraries;Web-CertProvider;Web-Dyn-Compression;Web-Includes;Web-Basic-Auth;Web-WebServer;Web-Lgcy-Scripting;Web-Http-Logging;Web-IP-Security;Web-Http-Errors;Web-Stat-Compression;Web-CGI;Web-ISAPI-Ext;Web-ASP;Web-AppInit;Web-Ftp-Service;Web-Security;Web-Lgcy-Mgmt-Console;Web-Dir-Browsing;Web-Mgmt-Tools;Web-Http-Redirect;Web-Ftp-Ext;Web-Mgmt-Service;Web-WebSockets;Web-Cert-Auth;Web-Metabase;Web-Performance;Web-Client-Auth;Web-Http-Tracing;Web-Health;Web-Asp-Net45;Web-Net-Ext;Web-Asp-Net;Web-DAV-Publishing;Web-Common-Http;Web-ODBC-Logging;Web-Mgmt-Compat; on the guest virtual machine COMPUTER001. For more information, log on to the virtual machine and view the event log: .

Recommended Action
Log on to the virtual machine and view the event logs.

Error (20400)
1 parallel subtasks failed during execution.

Error (21952)
Application deployment failed for one or more tiers or application hosts in the service iis01. Check job logs to get more information on the failed operation.

Error (22042)
The service iis01 was not successfully deployed. Review the event log to determine the cause and corrective actions.

Event Log from the Guest VM which failed to complete IIS installation:

Log Name: Setup
Source: Microsoft-Windows-Servicing
Date: 9/19/2014 10:35:25 AM
Event ID: 11
Task Category: (1)
Level: Information
Keywords:
User: SYSTEM
Computer: Computer003
Description:
Update NetFx3 of package Microsoft .NET Framework 3.0 failed to be turned on. Status: 0x800f0906.

Follow the below Steps to successfully deploy the Web server (IIS) Virtual Machine Role:

  • Using windows 2012 R2 ISO create the VHDX like below

  • Download the “Convert-WindowsImage.ps1” from below link

  • https://gallery.technet.microsoft.com/scriptcenter/Convert-WindowsImageps1-0fe23a8f

  • Open elevated PowerShell, change the parameters according to your environment

  • Then run the command as below

  • Convert-WindowsImage.ps1 -SourcePath D:\Tool\Windows_Server_2012_R2-Datacenter_Edition–EN-US-X64.ISO -VHDFormat VHDX -VHDType Dynamic -VHDPath "D:\Tool\WAP gallery VHD creation tool\Windows2012R2.vhdx" -SizeBytes 40GB -Edition ServerDataCenter “-Feature NetFx3” 

  • Copy the VHDX to SCVMM library share and refresh the library

Also Verify the Read-only library share Path is added to cloud properties if it’s not added then in tenant portal the VHDX will not list and Capability properties is are also unchecked
Cloud Properties:

Now Login to SPF server and Follow below Steps to Import the Gallery Item

  • Open the elevated PowerShell on SPF server

  • Ran the .\GalleryResourceImportTool.ps1 PowerShell 

  • Selected the IIS Gallery Resource and clicked continue

  • In next Wizard click on Virtual Disks Configuration

  • Select the Windows 2012 R2 Standard

  • It will list all the VHD from your Library

  • Select the Syspreped Windows 2012 R2 VHDX as OS disk, Uncheck the “Apply Resulting Tags for Family Name” then click on Apply these OS disk settings to selected disks and wait until it completes

  • We need at least one Data drive for VM Role, So  select on Bland VHDX and click on Apply these Data disk settings

  • Now the required Tags are set on OS and Data Disk

  • Click on Gallery Resource Import option

  • Select the library server share and click on Import Gallery Resource Extension

  • Once import is successful

  • Go to WAP Admin Portal ->Go to Plans-> Add the Web Server(IIS) gallery item from Gallery item section

  • Login to Tenant Portal and Deploy the Web server (IIS) Virtual Machine Role. It will deploy successfully now