In this exercise, we are going to walk through the process of creating a master image for your AVD host pools. The basic concept for a master image is to start with a clean base install of Windows and layer on mandatory updates, applications and configurations. There are many ways to create and manage images for AVD. The steps covered in this exercise are going to walk you through a basic build and capture process that includes core applications and recommended configuration options for AVD.
-
In the JumpVM, go to Azure portal home page and click on Create a resource button.
-
In the search bar type Microsoft Windows 10 and select Microsoft Windows 10 from suggestions.
-
On Microsoft Windows 10 page, select Windows 10 Enterprise multi-session, Version 1909 from dropdown menu and click on Create.
-
Provide the below configurations for the virtual machine, and click on Next: Disks.
- Subscription: Choose the default subscription.
- Resource Group: Select AVD-RG from the drop down.
- Virtual machine name: AVDVMWin10
- Region: EastUS, basically this should be same as the region of your resource group.
- Availability options: No infrastructure redundancy required
- Image: Windows 10 Enterprise multi-session, Version 1909-Gen1
- Size: Standard_D2s_v3
- Username: azuser
- Password: Azure1234567
- Confirm Password: Azure1234567
- Public inbound ports: select Allow selected ports
- Select inbound ports: RDP(3389)
- Select the checkbox saying "I confirm I have an eligible Windows 10 license with multi-tenant hosting rights."
-
On Disks tab, leave all configurations on default and click on Next: Networking.
-
On Networking tab, click on Create new for Virtual network. Then enter avdvm-vnet in the Name block and click on OK.
-
Leave other configurations on default and click on Review + create.
-
The last window helps us to verify if the parameters we filled are correct. Wait for validation to pass, then click on Create to initiate the deployment.
-
Once the deployment completes, click on Go to resource.
-
On the Overview page, copy Public IP address of the virtual machine and paste it in a text editor as we will use it in next step.
-
In Your Own PC/computer/workstation, search for Remote Desktop Connection and select Remote Desktop Connection from the suggestions.
-
On Remote Desktop Connection box, paste the Public IP address against Computer block. Then click on Connect.
-
In Enter your credentials box, enter the following values:
- Username: azuser
- Password: Azure1234567
- Click on OK
-
On Remote Desktop Connection dialog box, click on Yes.
-
The virtual machine will launch and look similar to the screenshot below.
Despite the Azure support teams best efforts, the Marketplace images are not always up to date. The best and most secure practice is to keep your master image up to date.
-
Open AVDVMWin10 virtual machine that you created in the Task 1. Click on Start button and then open Settings.
-
Select Updates & Security in the Settings window.
-
Click on Download to download and install all available windows updates.
-
Once the installation of updates complete, a message will appear asking Restart required. Click on Restart now to restart the virtual machine.
We have used a scripted solution available in Github to assist in automating some common baseline image build tasks. The script includes a UI form, enabling you to quickly select which actions to perform. The end result will be a custom master image that incorporates Microsoft's main business applications, along with the necessary policies and settings for an optimized user experience.
The UI form offers the following actions:
- Office 365 ProPlus - Install the latest version of Office 365 ProPlus monthly channel
- OneDrive for Business - Install the latest version of OneDrive for Business per-machine.
- Microsoft Teams - Install the latest version of Microsoft Teams per-machine.
- Microsoft Edge Chromium - Install the latest version of Microsoft Edge Enterprise.
- FSLogix Profile Containers - Install the latest version of the FSLogix Agent and apply recommended settings.
- OS Settings - Apply the recommended WVD/AVD settings for image capture.
-
Reconnect to AVDVMWin10 virtual machine that you created in the Task 1. Inside the virtual machine click on Start and open Microsoft edge browser.
-
Copy and paste the URL below and click on Save to download and save the Customizations.zip file.
https://minhaskamal.github.io/DownGit/#/home?url=https://github.com/shawntmeyer/WVD/tree/master/Image-Build/Customizations
-
Open file explorer and go to Downloads directory, then right click on Customizations.zip and select Extract All.
-
Click on Extract on the window asking to Select a Destination and Extract Files.
-
Navigate to the taskbar in your virtual machine and search for PowerShell, then select Run as administrator.
-
Use the following command to navigate to "C:\Users\azuser\Documents\Customizations\Prepare-WVDImage".
cd C:\Users\azuser\Downloads\Customizations\Customizations\Prepare-WVDImage
Note: If in case you used a different username for the virtual machine, then in the above command replace azuser with the username of your Virtual Machine that you created earlier.
-
Run the following command to allow script execution in Powershell.
Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope Process -Force
-
Execute the script by running the following command.
.\Prepare-WVDImage.ps1 -DisplayForm
-
This will trigger the Powershell to launch an application that will look similar to image shown below.
-
Now select the following applications listed below:
- Install Office 365
- Install FSLogix Agent - Blank out the value for FSLogix Agent, as shown in the image below.
- Install OneDrive per Machine - Blank out the value for OneDrive per Machine, as shown in the image below.
- Disable Windows Update
- Run System Clean Up (CleanMgr.exe)
- At last, click on Execute.
Note: This script takes about 15 minutes time to run, so be patient as it may seem like nothing is happening for a while, and then applications will begin to install. It will begin configuring the image. DO NOT close any of the remaining windows that appear until the script has finished execution. Doing so will interrupt the process and will require you to start over.
-
Once the script completes, select the Start icon and note that Microsoft Office has been installed.
-
Now open file explorer and delete customizations.zip file and Customizations folder from downloads.
-
In AVDVMWin10 virtual machine, search for command prompt and select Run as administrator.
-
Navigate to "C:\Windows\System32\Sysprep" by running the command below.
cd C:\Windows\System32\Sysprep
-
Run the following command to sysprep the VM and shutdown. A window will appear which wil show that Sysprep is working.
sysprep.exe /oobe /generalize /shutdown
Note: The system will automatically shut down in about 2 minutes and disconnect your RDP session.
-
Navigate to Azure portal in the JumpVM, search for virtual machine and click on Virtual Machines to open it.
-
On the Virtual machines blade, open the VM we used for creating master image i.e., avdwin10.
-
On the Overview blade for the Virtual machine, confirm the Status reflects as Stopped.
-
Click on the Stop button to move it to deallocated state.
-
Click OK to the prompt asking Stop this virtual machine.
-
Once the virtual machine is in deallocated state, click on Capture.
-
Add the following values:
- Resource group: Select AVD-RG from the drop down.
- Share Image to Shared image gallery: No, capture only a managed image
- Name: Leave to default
- Click on Review + Create
-
Once the validation passes, click on Create.
-
Wait for the deployment to succeed, once succeeded it will look similar to the image below.
-
In azure portal search for Azure Virtual Desktop and select Azure Virtual Desktop from suggestions.
-
Open Host pools present under Manage blade, and then click on + Create.
-
On the Basics tab configure your Host pool with following configurations:
- Subscription: Choose the default subscription.
- Resource Group: Select AVD-RG from the drop down.
- Host pool name: AVD-CustomImage-hostpool
- location: EastUS, basically this should be same as the region of your resource group.
- Validation Environment: No
- Host pool type: Personal
- Assignment type: Automatic
- Click on Next: Virtual Machines
-
In the Virtual machines tab, select Yes against Add virtual machines. By doing this, we are stepping towards adding Virtual machines to the host pool.
-
In this step, we will provide the details of the VMs to be created as session Hosts. For your convenience, this step is divided into three sections as follows:
A. Session Host Specifications:
- Resource Group: Select AVD-RG from the drop down.
- Virtual machine location: East US, location should be same as location of your resource group.
- Availability options: Select No infrastructure redundancy required from the drop down.
- Virtual machine size: Standard D4s_v3. Click on Change Size, then select D4s_v3 and click on Select as shown below.
- Name prefix: VmFromImage
- Image type: Gallery
- Image: Click on Browse all images and disks, click on My items and select the Image we created earlier in this exercise, as shown below.
- Number of VMs: 2
- OS disk type: Standard SSD
- Use managed disks: Leave to default
B. Network and Security:
Leave all values to default, except:
- Virtual network: aadds-vnet (choose from dropdown)
- Subnet: sessionhosts-subnet(10.0.1.0/24) (choose from dropdown)
- Public inbound ports: No
C. Domain Administrator Account:
- AD domain join UPN: Paste your username
- Password: Paste the password
- Specify domain or unit: No
Note: This Administrator Account details will be used for domain joining the virtual machines to the Windows AD domain we created using AADDS.
D. Virtual Machine Administrator Account:
- Username: azuser
- Password: Paste the password
- Confirm Password: Paste the password again.
- Click on Next: Workspace to proceed.
-
In the Workspace section, we need to specify if we need to register the default application group to a workspace.
- Register desktop app group: Choose Yes
- To this workspace: Click on Create new
-
Under the Workspace name, fill the name of workspace.
- Workspace name: AVD-CustomImage-workspace
- Click on OK
-
Now click on Review + create on the bottom left corner.
-
The last window helps us to verify if the parameters we filled are correct. Wait for validation to pass, then click on Create to initiate the deployment.
Note: The deployment will take about 15 minutes to succeed.
-
In search bar of Azure portal, search for Azure virtual desktop and select Azure virtual desktop from the suggestions.
-
Under Manage blade, select Application groups. Then click on the Default Application group that was created while creating Host pool in previous task.
-
Now click on Assignments under Manage blade, and then click on + Add button.
-
In the search bar, paste and choose your user by clicking on it. At last, click on Select to save your changes.
-
In the JumpVM, open new browser and navigate to the URL given below.
https://rdweb.wvd.microsoft.com/arm/webclient
Note: In case you are logged in with AVDUser01, then logout and login back using following credentials:
- Username:
- Password:
Note: If there's a dialog box saying Help us protect your account, then select Skip for now option.
-
The AVD dashboard will launch, then click on the tile named Session Desktop under workspace AVD-Customimage-Workspace to launch the desktop.
-
Select Allow on the prompt asking permission to Access local resources.
-
Enter the lab credentials given below, to access the application and click on Submit.
- Username:
- Password:
-
The virtual desktop will launch and look similar to the screenshot below.
-
At last, validate the components relative to the configuration we made in previous task. The desktop should show icons for Microsoft Edge and Microsoft Teams. When you go to the Windows start menu, you can find the Office applications.
-
Click on the Next button present in the bottom-right corner of this lab guide.