there's many vm sizes to choose from in the cloud
which one is right for you well it sort of depends on your workload
and just recently there were some new sizes added and we should really take a
look at them and let's have some fun
i'm Dean Cefola and this is the azure academy
so i had a few people reach out to me in regards to the new sizes that we're
going to take a look at today and asking about
certain features and one in particular was quite interesting because it's
something i haven't thought about in a long time
over in the azure docs if we scroll down we got the windows
virtual machines here and let's click on that and in the filter over here we're
going to type the word size and we'll click on this first
option here for vm sizes there's many different families of
virtual machines from general purpose down to high
performance compute as you can see in the docs and each one of those
families has within it many different sizes to pick from
and one of the key things to controlling your cost in the cloud is picking the
right size virtual machine for your workload so
that you can get done what you need to do
but don't over provision the system so that you have wasted resources so
on june 15th it was announced that the d and e v 4 virtual machine
series were introduced to the cloud and v4 is the latest
generation as of this video and the d series are the general purpose virtual
machines and these new v4 ones are running on the
intel xeon platinum 8272 cl
processors that go up to 3.4 gigahertz turboing on all cores
and that means you can get more cpu performance the e
series are the memory optimized virtual machines so if you're using some
high memory intensive applications and also need to have
premium or ultra disk performance then you can go with the
e series v4 machines over in the azure portal our vms have also gotten a
facelift you can see things look quite a bit different we've actually got
little sub categories now for our virtual machines and on the properties
window you've got your basic vm information the name the operating
system which generation it is you also see the
version of the azure agent that is on it now
whether or not you're located in a proximity placement group
and also your networking information as well as your vm size and
disk layout on the monitoring tab we can see all of
the standard azure monitoring stuff for your disks network and cpu under
capabilities we have some quick links just to kind of
centralize everything in one place rather than going down the blade like
you have in the past and there's even a tutorial section now
so that you can get a little more understanding of how to manage
your virtual machines and some links out to some free training on microsoft learn
now the feature that caught my eye again this week was
nested virtualization nested virtualization is when we can have a
virtual machine and inside that virtual machine
we can run other virtual machines kind of like the
same concept around containers but it's done slightly
differently back in the azure docs if we go back to our windows
virtual machines under the how to guides under managed vms and we scroll down
we can enable nested virtual machines in azure and this is a feature that is
accessible to you if you are using the right vm sizes and
you can see this first link talks about the virtual machine sizes compatible
with nested virtualization and the brand new dv4 series are also
compatible and this stock basically walks us
through today's process we're going to build ourselves a virtual machine that's
compatible with this feature enable hyper-v inside the virtual
machine and then we're going to have to set up a
nat virtual switch inside the machine so that our
vms can get out and make use of all the other
resources that we have in the cloud and you'll see a lot of
these similar concepts when we introduce our videos on kubernetes and containers
but i want to scroll back up a little bit to this section on
enable hyper-v feature in an azure vm because there are
two links here that we need to pay attention
to we'll open this first one on the nv blog which is the nested
virtualization blog so this graphic gives us an idea of what's going to be
going on today so at the very bottom level 0 that would
be azure that's the physical servers running in the azure data centers
and then you build your virtual machines on top of those
on the vm sizes that support nested virtualization you can install the
hyper-v roll on those systems and then you can
provision your own guests within there going down to level
number two but it doesn't have to stop there
you can re-provision hyper-v again and then go down to level three
and so on and once you get into that nested virtualization
layer the system doesn't know any different so it functions
just like it would on any other physical device
so not only is this a very cool feature but it's also something we're gonna have
a little fun with today so you've already seen my virtual
machine in azure and this is provisioned with one of the new dv4
vms i have four cpus and 16 gigs of ram and this vm is already up and running
and in here i have enabled hyper-v and then i have another machine here
called level two and i'm gonna show you how to get this all up and running to
where your vms can get out to the internet even from these nested levels
and that also means you'll be able to join your domains that are either
on-prem or running in azure and have access to all of the same
features and functionality that you would
in any normal environment back in the azure portal let's start at the
beginning we'll deploy a new virtual machine and
i'll just search for windows server 2019 and then set my
publisher here for microsoft then we'll click on
windows server and select the particular sku that we are interested in
i just use the 2019 data center and we'll hit create on that and i'll build
this in my resource group that's called nested we'll call this vm hyper dash 2
in the east us and if we scroll down for our vm
size we have the dv4 vm size here selected
but there are other sizes and now azure shows you the ones you have recently
used as well as those recommended by the image publisher
and you've got this one right up here that i'll call your attention to
the d4 asb4 and this is one of the new amd epic
processor vms that are in the cloud so there's
another great option for you but i'll stick with the size i built
the other system on just to keep them all identical
and i've got my credentials all listed here and we'll hit next
and i'll be using a premium ssd for this system because i need to run the
operating system disk as well as the virtual
machine disks but i could just as easily add
multiple data disks and then link them together with windows storage spaces or
storage spaces direct but we'll keep this
simple for this example and we'll go next and i'll use my existing virtual
network in azure and click next and i've added
all my standard tags for this build and we'll hit next
and everything looks good so let's create now normally
i go to a black screen here while the creation process happens
because it normally takes a couple minutes
however these new v4 vms actually deploy quite quickly now your mileage of course
may vary but i'm having this timer here so you
can see how long the build process takes and so i'll speed it up so
we can get to the end here and you can see
exactly how long it took to provision a new v4 system
and there you go we are now built back in the azure docs here we have all of
the commands that are necessary to get all of this up
and running and so i'll just copy each one of these code blocks from this
entire page into my powershell so the very first command here that we're going
to run is to install the hyper-v feature and then we're going to reboot
our system so we'll run that real quick
so if everything has worked correctly so far you should have the hyper-v
manager on your system which i'll open and when you open hyper-v
for the first time it's going to be unconfigured and you can go through and
set where you want your virtual machines and hard drives to be
stored and we're also going to need to set up a
virtual switch and that's what some of the
code here that we got out of the azure docs is going to do next
and this is where i made some small tweaks to the code that's right out of
the azure docs and i'll explain why so i want this to run as automated as
completely possible so i'm going to create my new switch
when i do that switch is going to get an index
so if i run the powershell command for get net adapter
you'll see that every network card on every machine everywhere gets an index
and that's a unique identifier that lets the system know
which nic it's talking to so when we create this new switch we're
going to get an index as well and in the docs they tell you to run this command
then run getnetadapter check what the index number is
and then use that in the command that's on line 17.
i didn't want to do that i wanted this to be totally automated so i had it go
and create the switch then wait for two seconds
and then run this variable and capture the index and then i pass the index to
command 17 and do this all in an automated way
so i can run this whole thing now which will be done in just a moment and
there we go we've now captured our index and passed it
correctly as well as set up this last command
which is the new net nat command which does internal
network address translation so that we can get our nested
vms out to the rest of the network so now that all of that
is configured if we go back to hyper-v and look at our virtual switch manager
we have a new network switch created and this is an
internal only switch and if we run the get
net adapter command again we can see that now we've got
two network cards our network card that we got
from azure as well as the one that we have just generated as part of our
virtual switch so now we can provision a new virtual
machine and i'll call it nested vm and i'll
build it in the c hyper-v folder and i will make
this a generation 2 vm and i'll allow it to use
dynamic memory and then we'll connect it to our internal
nat and i'll make my hard drive 64 gigs and then we'll install our image from an
iso that i copied it down locally for server 2019 and we'll click
finish and then we'll go to connect to our vm
then we'll push start to get it running and we'll press a key to boot off of our
iso and we can start our installation of
windows so i'll just fast forward to the end here
and our vm is up and running however if we try to go out
to the internet we see things are not working
and if we try to ping out to our domain again
not working so what's going on if we do an ipconfig
we see that we do not have a valid ip address now you can solve this
in two ways you can set yourself manually
an ip address on this virtual machine or you can set up your own dhcp scope now
this is a thing that we don't normally do
in azure because azure is our dhcp but in this
nested virtualization world we don't have that
so we do have the option of standing it up and making a scope
that's going to be internal only so back on our hyper 2
host machine we're going to add a dhcp role
and we'll do that by going up to manage and then going to add a role in feature
and we'll click next on the wizard and then we'll just
check the box for dhcp server and click add feature and then
hit next and then install
and now that that's done we'll click the link here to complete the dhcp
configuration and on the dhcp administration console
we'll right click on ipv4 and create ourselves a new scope
and i'll call this a nested scope and then we have to set an
ip range for our nested vms and i'll use a private ip
range for this and click next and then i want to add some exclusions here
and i'll exclude from dot one through dot 99
and that's just in case i want to add more hosts later and i'll click next
and the default lease duration of eight days is fine with me
and i'll click next to configure our scope options and this is going to be
the ip address of our virtual network switch and i'll click add for that and
hit next and here is the key to making this work
the dns server settings you want to leave
these with whatever your azure virtual machine
is giving you so back in azure if we look at our virtual machine and click
over here on our virtual network subnet you can
see at the top here listed as my dns servers and those
match what we just saw inside our scope and these need to match so that your vms
internally can talk to the virtual switch on the
host and then go out to the dns servers that hyper2 is using so that you
can get out to all the public dns resources and we'll
click next on the rest of the wizard and activate our scope
and in order for us to get our new address information
we need to run a couple commands so i'll run ipconfig
space forward slash flush dns just in case there was anything there
i'll also run ipconfig forward slash release
and then ipconfig forward slash renew and now you see i've gotten my dns
information and a gateway and in the background here
bing has now started to work and we are up
and running so now i can ping my domain controller and now
we get a valid response so everything is now up and running so
now that we have all of this what can we do with it i've created
another vm in the background this is to deploy windows 10 and i will
connect to this machine and just start it up and
would you look at that i can do pixie boot in
azure something that is not natively supported but because i'm on my own
internal private network i can now do a pixie boot so doing your image
customization and all that could be shifted up into azure
leveraging some kind of nested hyper-v scenario
and notice i'm using here the microsoft deployment toolkit
and i've already got a task sequence configured and that is going through and
setting up my system over a pixie boot we'll come back and check
on that in a moment back in our nested vm i've already run the powershell
exactly as we did on our level above it and hyper-v is
already installed and i've got my nested nat
virtual switch configured already and i've pre-staged a virtual
machine here as well which i can go ahead and connect
to and hit start
and there you go three levels deep on nested virtualization and if we go back
to our other build from pixi that has
completed as well so you could use this as creating your
own environments inside of azure your own isolated lab
environments testing scenarios or you can implement things like
clustering the one thing that you do need to keep in mind is that everything
is ultimately running on one virtual machine in azure so the
further down the rabbit hole you go the fewer system
resources are going to be at your disposal
and that means that your top level virtual machine might need to be
a larger virtual machine depending on how much nested virtualization you are
planning on doing and once again here's that graphic we have the azure physical
host layer 0 at the bottom and then we've got
our hyper 2 vm that we deployed at level one nested
vm at level two and then a windows 10 vm at level three
and these principles will all carry over when we start talking about our
container series and the azure kubernetes service
so hope that you've enjoyed looking at this fun video
about nested virtualization and the new vm
skus that are in azure and of course nested virtualization is just
one of the very cool things you can do in the cloud so if you had a good time
today or learn something new go ahead and click that thumbs up
and let me know that you appreciated this video and if you have any questions
about this or any other things going on around azure
give me those in the comments field down below and i'll be sure to respond
to them and especially let me know if you have an idea for a new video we
always love to make things that the community is interested in
today's video was inspired by conversations i had with folks this week
and if you haven't subscribed yet to the azure academy it's not getting any
cheaper so join us here at our community because everything here
is totally free and we just want to help everyone learn
more about azure and to help you keep on learning over here on the right we've
got our latest video on the top and one that we've picked out
at the bottom especially for you i hope you enjoyed today's video and
come back and see us soon happy learning