1.5 hours
- 4 Learning Objectives
About this Hands-on Lab
When architecting solutions in the cloud that leverage compute, it is very common to need to rapidly deploy Windows or Linux servers, which fit a specific purpose.
VM images allow you to have a Windows or Linux server, which is pre-configured with applications, software, security, and more. We can then speed up [and automate] the deployment of VMs, which are built from these images and are ready for use.
Within this lab, you’ll gain experience creating a custom VM image from a Windows virtual machine.
Learning Objectives
Successfully complete this lab by achieving the following learning objectives:
Configure a Virtual Machine with IISUse the Azure Portal to perform the following tasks. Please log in with the credentials provided to you for this lab.
Please
be aware you will need an RDP client to connect to the Windows server. To connect to vm1
, use the credentials provided on the lab page.
Connect to VM1 Using RDP- Navigate to the Virtual Machines services page.
- Open the existing VM called vm1.
- Click on the Connect option in the command bar, and select RDP.
- Use the RDP file with your preferred RDP client.
Note: You may choose to copy the public IP address and connect via RDP manually with your RDP client, instead of using the RDP file.
Configure a Web Server- Click Start, Windows PowerShell, then Windows PowerShell.
- Type the command:
Install-WindowsFeature -name Web-Server -IncludeManagementTools
Install-WindowsFeature -name Web-Server -IncludeManagementTools
Create a Basic HTML Page- Click Start, Windows PowerShell, then Windows PowerShell.
- Type the command:
ConvertTo-Html -InputObject [Get-Date] | Out-File C:inetpubwwwrootindex.html
ConvertTo-Html -InputObject [Get-Date] | Out-File C:inetpubwwwrootindex.html
You can test that the webserver is working by opening //locahost in Internet Explorer. It should display the test HTML page you just created [date-time].
Remain connected to the server by RDP for the next task.
Generalize the Windows ServerEnsure you are still connected to VM1 using RDP, as per the previous task.
Perform Sysprep- Right-click the start menu.
- Click on Run.
- Type
the following:
%WINDIR%system32sysprep
. - Click OK to open the folder.
- Double-click on the
sysprep.exe
file. - Use the following settings:
- System Cleanup Action: Enter System Out-of-Box Experience [OOBE]
- Generalize: tick the tickbox
- Shutdown Options: Shutdown
- NOTE: When you click OK, the computer will generalize and then shutdown
- Click OK.
%WINDIR%system32sysprep
.sysprep.exe
file.- System Cleanup Action: Enter System Out-of-Box Experience [OOBE]
- Generalize: tick the tickbox
- Shutdown Options: Shutdown
- NOTE: When you click OK, the computer will generalize and then shutdown
Note: The above task can
be completed in with the following command-line option if preferred: %WINDIR%system32sysprepsysprep.exe /generalize /shutdown /oobe
.
Use the Azure Portal to perform the following tasks. Please login with the credentials provided to you for this lab.
Convert VM1 to an Image- Navigate to the Virtual Machines services page.
- Open the existing VM called vm1.
- Check that the Status
is showing as stopped.
- Use the RDP file with your preferred RDP client.
- Click on the Capture option in the command menu, and use the following settings:
- Name:
vmimage1
- Resource group: leave the default selected
- Automatically delete this virtual machine: no
- Type the virtual machine name:
vm1
- Click on Create.
- Name:
vmimage1
- Resource group: leave the default selected
- Automatically delete this virtual machine: no
- Type the virtual machine name:
vm1
- Click on Create.
Note: You will no longer be able to start vm1 after completing this step.
Create a VM using the VM ImageUse the Azure Portal to perform the following tasks. Please login with the credentials provided to you for this lab.
Create a VM from the Image- Navigate to the Images services page.
- Click on vmimage1, which we just created.
- Click on the + Create VM option in the command
menu, and use the following settings:
- Basics
- Subscription: leave as-is
- Resource group: leave as-is
- Virtual machine name: vm2
- Region: leave as-is
- Availability options: none
- Image: leave as-is
- Size: B2s
- Administrator account: use the provided VM credentials
- Public inbound ports: none
- License Type: Windows Server
- Would
you like to use an existing Windows Server license?: No
- Click on Next: Disks.
- Disks
- Leave as-is
- Click on Next: Networking
- Networking
- Virtual network: vnet1
- Subnet: subnet1
- Public IP: leave as-is
- NIC network security group: None
- Click on Review + create.
- Click on
Create.
- Basics
- Subscription: leave as-is
- Resource group: leave as-is
- Virtual machine name: vm2
- Region: leave as-is
- Availability options: none
- Image: leave as-is
- Size: B2s
- Administrator account: use the provided VM credentials
- Public inbound ports: none
- License Type: Windows Server
- Would
you like to use an existing Windows Server license?: No
- Click on Next: Disks.
- Disks
- Leave as-is
- Click on Next: Networking
- Leave as-is
- Networking
- Virtual network: vnet1
- Subnet: subnet1
- Public IP: leave as-is
- NIC network security group: None
- Click on Review + create.
- Click on Create.
Note: We have network security already associated with vnet1. This will allow RDP access to vm2.
Test the VM- Connect to the VM using the steps followed earlier.
Ensure you use the new public IP address for vm2. - Once connected, you can verify the VM is created from the image by performing the following test:
- Test: Open
//localhost
in Internet Explorer
Result: You should see the
page we created earlier.
Ensure you use the new public IP address for vm2.
- Test: Open
//localhost
in Internet Explorer
Result: You should see the page we created earlier.
The above test validates that your new server has [a] IIS configuration from vm1, and [b] the index.html file you generated on vm1.
You've
recently been hired as a solution architect by The Pupper Camp [TPC]. The Pupper Camp is a dog services company that works across the globe. Your IT manager has asked you to provide a proof-of-concept virtual machine image for a website that TPC needs to scale rapidly.Additional Resources
You will need to create a VM image with IIS [Web Server] installed, including a test HTML file. This image must then be used to demonstrate the deployment of a virtual machine using your image.
Note: When creating a VM using the VM Image, choose License Type: Windows Server. On the question Would you like to use an existing Windows Server license?: choose No.
What are Hands-on Labs
Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.