In this demonstration, we're going to do a general introduction to Hyper‑V,
paying particular attention to 2 of the AZ‑800 objectives,
enhanced session mode and nested virtualization.
We're looking at one of my local machines,
but this just as well could be a machine in Azure,
an Azure VM that's enabled for nested virtualization.
Okay, so in that sense from a hybrid administrator perspective,
we're good to go.
Let me bring out VS Code.
This Configure‑hyperv.ps1 script file is in the exercise
files for your reference if you want it.
So, on the Hyper‑V host, my so‑called hardware host,
I'll want to make sure to install the Hyper‑V feature first.
Let me and my VS Code console do a Get‑Windows‑Feature hyperv. Whoops,
I always tend to forget about that hyphen. Yeah,
so I've already installed the server role on this machine, but you can see up
here on line 5 Install‑WindowsFeature Hyper‑V IncludeManagementTools Restart,
and you've got yourself a Hyper‑V host. Because I used the
IncludeManagementTools switch parameter, that means that after the reboot, I
have access to the Hyper‑V Manager MMC console.
And so next we'll go through the process of setting up our
network and creating a new virtual machine.
We can right‑click our host and go to Virtual Switch Manager, and we can
create a new external switch that I will call External Switch.
I'm creating an external switch that's bound to my machine's network
adapter because I want my virtual machines to join the same physical
network that my host is on and get out onto the internet. And you can
see some connection options down below.
We'll talk more about SR‑IOV and some other settings in future lessons.
Let me click Yes that I'm willing to deal with some momentary
network connectivity disruption as Azure creates this.
Now if I open up the hardware host's network properties sheet,
we can see that I have my hardware network interface on the host, and then
Hyper‑V created a virtual network adapter for my external switch. And if I
come in and look at the details, this 10.1.10 I know happens to fall in my
network ID range on my physical network.
So, this interface received an IP address from my network's DHCP
server just like the host's actual network interface card did.
So let me right‑click and do New, Virtual Machine, and we'll
follow this wizard here.
I'll call it server1.
I'll store it in the default location, but we could
override that if we wanted to. Gen 1 versus Gen 2, we're
going to talk more about this later.
Azure supports Gen 1 and Gen 2, but you do have to make sure that your
virtual hard disk is using the VHD and not the VHDX extension.
I'm going to go with Gen 1 here. Scratch that.
I'm going to go with Gen 2.
Here's where we have the memory allocation.
I'm going to go with 1 GB of memory.
I know that's really low, but I can use dynamic memory to create a range to
better or more efficiently assign memory to the machine.
Now,
startup memory is what's given to the machine at startup, and then it
will fluctuate if we've enabled dynamic memory and the needs of that
virtual machine need more or less RAM.
We can connect to our external switch here.
Next, this is where we create our virtual hard disk, 127 GB is the
default, and because this is Gen 2, it's VHDX, and it's a dynamically
expanding rather than fixed disk. So that's going to be better to give me
a smaller disk footprint on my machine.
But in the future, if I want to go to Azure with this machine,
I'm going to need to convert it to a fixed size VHD. Actually, I'll have to
convert it to Gen 1 VHD before uploading it to Azure.
Let's click Next.
I'm going to install an operating system from an ISO image
file that I have on the local file system.
I have a Windows Server 2022 ISO. And then let's
click Finish to create the machine.
I'm going to right‑click and start the machine.
I don't want Hyper‑V to take automatic checkpoints because it can
be too easy for me to revert to an earlier state of the VM, so I'm
temporarily going to turn them off.
I'll right‑click the VM and go to Settings, and we'll come down to
Checkpoints, and I'm going to turn off Checkpoints. We'll learn
more about that later. Now, to connect to the machine using the
VMConnect tool, we can either double left‑click or we can
right‑click and go to Connect.
Now, the operating system installation process here is
identical to any other installation.
So, I'm going to pause the video until after I've completed this installation
because there's certainly no point in covering that here.
Okay, I have the server1 guest VM all running here in the VMConnect utility.
Let me close out and cover enhanced session mode and nested virtualization.
Now you'll have to enable enhanced session mode at the server level.
So back in Hyper‑V Manager,
let's right‑click the server and go to Hyper‑V Settings.
And we'll want to make sure in Enhanced Session Mode Policy we have Allow
Enhanced Session Mode turned on, as you can see here.
And that gives you the opportunity when you connect to a machine to
adjust its display configuration, as you can see here.
And we also have the local resources where we can play or not play.
This is a lot of the stuff that you get with the typical mstsc remote
desktop connection client, as you can see here.
We've got local settings.
Very similar user interface.
All right, now if we go to More,
that's where it allows us to map in drives, like the C drive of the host,
for example. Okay, go back here and click Connect, and I'll
sign into this machine, and we're off and running. Now as
far as nested virtualization, assuming that this machine, server1,
this VM, will become a Hyper‑V host itself, we want to make sure
here at the host level that we've enabled nested virtualization
and configured MAC address spoofing.
So let me bring up my script file again to do the nested
virtualization online, a Set‑VMProcessor for server1 to
expose the virtualization extensions.
Let me right‑click and run that.
Didn't like that confirm option, so let me get rid of that and just leave
ExposeVirtualizationExtensions true, Run Selection. It says it cannot change
the processor functionality while it's running.
Okay.
All right, so let's turn this guy off.
Not a big deal.
Should have remembered that.
And then let's expose those virtualization extensions. That worked. And I
already set MAC address spoofing on for server1 by running line 11, as you
can see. Now let's bring the server back online.
Let's start it.
And we're going to simply prepare ourselves for the next demo.
Okay, that's it for now. We'll see you in the next demo.