WEBVTT

0:00:03.320000 --> 0:00:08.720000
 Hi, in this video, I want to take a look
 at some advanced virtual deployment

0:00:08.720000 --> 0:00:14.020000
 options. And what we're going to take
 a look at is first looking at how

0:00:14.020000 --> 0:00:17.840000
 we can deploy multiple nicks
 for a single virtual machine.

0:00:17.840000 --> 0:00:23.120000
 And then we're going to take a look
 at how we can add multiple disks to

0:00:23.120000 --> 0:00:25.160000
 the same virtual machine actually.


0:00:25.160000 --> 0:00:31.100000
 One thing to take away from this video,
 from this lesson is not, okay,

0:00:31.100000 --> 0:00:35.620000
 here's explicitly how to do multiple
 nicks and how to do multiple disks.

0:00:35.620000 --> 0:00:40.420000
 What I think is more important is the
 fact that there are options that

0:00:40.420000 --> 0:00:45.740000
 are more complex than simply clicking
 through the new blade for virtual

0:00:45.740000 --> 0:00:47.720000
 machines in the portal.

0:00:47.720000 --> 0:00:53.080000
 Now I will say that that experience
 has become more capable than it used

0:00:53.080000 --> 0:00:57.320000
 to be, but there's still options where
 you want to be able to go into

0:00:57.320000 --> 0:01:00.760000
 either a scripting environment, which
 is what the demonstration is going

0:01:00.760000 --> 0:01:05.220000
 to be. I'm going to use Azure PowerShell
 or templating, which is in other

0:01:05.220000 --> 0:01:10.440000
 videos. And so that's really the takeaway
 from this is really look at

0:01:10.440000 --> 0:01:15.100000
 these as two very common examples of
 what you might call, you know, not

0:01:15.100000 --> 0:01:19.600000
 just straight path deployment through
 the portal of a virtual machine.

0:01:19.600000 --> 0:01:22.060000
 So let's go ahead and
 let's dive into this.

0:01:22.060000 --> 0:01:26.920000
 I'm going to start by looking at the
 configuration of a virtual machine

0:01:26.920000 --> 0:01:28.680000
 that would be fairly standard.

0:01:28.680000 --> 0:01:36.140000
 Now what we have in front of us is we've
 got the Azure PowerShell commandlet

0:01:36.140000 --> 0:01:41.220000
 for setting up a configuration
 for a virtual machine.

0:01:41.220000 --> 0:01:44.680000
 If I get my pen here, there we go.


0:01:44.680000 --> 0:01:47.340000
 All right. And key parts of this.

0:01:47.340000 --> 0:01:53.500000
 Go back there. There we go.

0:01:53.500000 --> 0:01:57.140000
 This new Azure new AZVM config.

0:01:57.140000 --> 0:02:01.380000
 That is going to set up
 a configuration object.

0:02:01.380000 --> 0:02:02.720000
 And then you can see this.

0:02:02.720000 --> 0:02:05.900000
 It looks like it's all one statement,
 but there's a bunch of pipes here.

0:02:05.900000 --> 0:02:10.680000
 So I'm taking the output of that statement
 and then piping it into another

0:02:10.680000 --> 0:02:18.240000
 statement. That second statement being
 set AZ operating system and that's

0:02:18.240000 --> 0:02:23.800000
 setting saying, okay, this give
 it a set of credentials.

0:02:23.800000 --> 0:02:28.140000
 Okay, then say, all right, so
 I've got this virtual machine.

0:02:28.140000 --> 0:02:29.040000
 I can see the size.

0:02:29.040000 --> 0:02:29.920000
 It's got a name.

0:02:29.920000 --> 0:02:33.400000
 It's Windows. I got
 to give it a source.

0:02:33.400000 --> 0:02:41.420000
 Now when you go through the portal,
 you just kind of pick an image.

0:02:41.420000 --> 0:02:44.280000
 The actual image definition is
 a four part image definition.

0:02:44.280000 --> 0:02:49.840000
 You've got the publisher name, the
 offer, the skew and the version.

0:02:49.840000 --> 0:02:53.000000
 Although I literally have never used
 any version other than latest.

0:02:53.000000 --> 0:02:55.860000
 It is possible if you have a piece of
 software that, for example, would

0:02:55.860000 --> 0:03:01.300000
 need a very specific version of 2016
 data center, you could use that.

0:03:01.300000 --> 0:03:05.740000
 So I've got my virtual machine configuration,
 my operating system, my

0:03:05.740000 --> 0:03:12.280000
 source image. And then I
 also set the virtual NIC.

0:03:12.280000 --> 0:03:15.140000
 Now that's assuming that I've
 already got a NIC established.

0:03:15.140000 --> 0:03:25.880000
 And that is how we set up, let
 me erase this thing here.

0:03:25.880000 --> 0:03:33.820000
 That is how we set up a standard
 machine deployment in PowerShell.

0:03:33.820000 --> 0:03:39.080000
 So very much like what you would
 do going through the portal.

0:03:39.080000 --> 0:03:44.800000
 But what if you wanted to
 deploy multiple NICs?

0:03:44.800000 --> 0:03:45.800000
 It's very difficult.

0:03:45.800000 --> 0:03:49.960000
 If I've got two NIC definitions that
 are available, two virtual NICs that

0:03:49.960000 --> 0:03:54.460000
 are already created and available, I
 can simply call the add AZVM network

0:03:54.460000 --> 0:03:55.840000
 interface twice.

0:03:55.840000 --> 0:04:00.020000
 One thing I do need to do, if you look
 up at that first network interface

0:04:00.020000 --> 0:04:03.760000
 line, you can see that I marked
 the first interface as primary.

0:04:03.760000 --> 0:04:06.980000
 You always have to have
 one primary NIC.

0:04:06.980000 --> 0:04:09.720000
 Now what about disks
 adding data disks?

0:04:09.720000 --> 0:04:13.980000
 Well, that's also really a fairly
 straightforward process.

0:04:13.980000 --> 0:04:21.220000
 I'm adding disks to my configuration
 by calling the add AZVM data disk

0:04:21.220000 --> 0:04:24.380000
 and specifying the name, the size.


0:04:24.380000 --> 0:04:25.880000
 I don't want any caching.

0:04:25.880000 --> 0:04:27.900000
 Each one has to have
 a unique line.

0:04:27.900000 --> 0:04:29.880000
 And I'm creating them as empty.

0:04:29.880000 --> 0:04:33.880000
 Clearly, of course, looking at that
 scene empty, there are more options

0:04:33.880000 --> 0:04:39.740000
 really for both of these resources that
 are being added to your virtual

0:04:39.740000 --> 0:04:43.940000
 machine. There are other options as well
 that you can go in, you can dive

0:04:43.940000 --> 0:04:48.380000
 in. But the point is, really,
 it's not that complex.

0:04:48.380000 --> 0:04:49.700000
 This looks pretty complex.

0:04:49.700000 --> 0:04:52.780000
 But if you break it down into its component
 parts, it's really not that

0:04:52.780000 --> 0:04:57.200000
 bad. For most people, when they look at
 this, it's almost the piping concept

0:04:57.200000 --> 0:05:00.200000
 that is more complex.

0:05:00.200000 --> 0:05:04.400000
 At the end of the day, when all of this
 runs, it's going to set up that

0:05:04.400000 --> 0:05:10.960000
 configuration VM0 virtual machine.


0:05:10.960000 --> 0:05:16.380000
 And with that, let's go ahead and let's
 take a look at deploying a virtual

0:05:16.380000 --> 0:05:19.080000
 machine with PowerShell.

0:05:19.080000 --> 0:05:22.920000
 And in fact, really the exact
 setup that I just looked at.

0:05:22.920000 --> 0:05:28.760000
 I'm going to go into PowerShell, the
 scripting environment for that.

0:05:28.760000 --> 0:05:32.900000
 And I'm going to go through a
 script that already exists.

0:05:32.900000 --> 0:05:36.780000
 And we're going to really provision
 all of the things that we need for

0:05:36.780000 --> 0:05:42.040000
 a virtual machine in a virtual network
 that right now doesn't have, or

0:05:42.040000 --> 0:05:46.600000
 excuse me, in a resource group that
 doesn't have anything, including a

0:05:46.600000 --> 0:05:47.320000
 virtual network.

0:05:47.320000 --> 0:05:51.000000
 Let's go ahead and let's take
 a quick look at this.

0:05:51.000000 --> 0:05:56.580000
 Okay. This is a script that I have,
 and it is actually missing one thing

0:05:56.580000 --> 0:06:01.060000
 that I will put in
 very quietly here.

0:06:01.060000 --> 0:06:10.440000
 And that is dollar sign
 cred equals credentials.

0:06:10.440000 --> 0:06:13.740000
 There we go. All right.

0:06:13.740000 --> 0:06:18.540000
 Have that in there, and then
 I close it without saving it.

0:06:18.540000 --> 0:06:20.900000
 All right. Now, this is my script.


0:06:20.900000 --> 0:06:22.440000
 I'm going to go down through it.

0:06:22.440000 --> 0:06:26.740000
 And this is something that I sort of
 picked up and developed from a couple

0:06:26.740000 --> 0:06:28.380000
 of other scripts that
 are out there.

0:06:28.380000 --> 0:06:29.840000
 Nothing new under the sun.

0:06:29.840000 --> 0:06:32.840000
 The first thing I'm doing is just setting
 up some variables so that I

0:06:32.840000 --> 0:06:39.260000
 ensure that I am consistent
 throughout my script.

0:06:39.260000 --> 0:06:45.560000
 Okay. Then I am going to go ahead and I
 am going to set up a network security

0:06:45.560000 --> 0:06:49.260000
 group with a really truly terrible name
 there, my network security group.

0:06:49.260000 --> 0:06:54.760000
 That's okay. It has a rule and that
 rule is going to allow traffic on

0:06:54.760000 --> 0:06:59.380000
 3389, which is, of course,
 remote desktop protocol.

0:06:59.380000 --> 0:07:02.280000
 Let's go take a moment
 and that'll create.

0:07:02.280000 --> 0:07:05.740000
 And when that's done, we'll look
 at configuring the network.

0:07:05.740000 --> 0:07:11.700000
 All right. So my network security
 group is created.

0:07:11.700000 --> 0:07:17.200000
 Now what I want to do is take a look
 at the configuration of my virtual

0:07:17.200000 --> 0:07:21.960000
 network. Now this gets a little bit
 more complex, not hugely, but I am

0:07:21.960000 --> 0:07:25.500000
 actually provisioning to subnets.

0:07:25.500000 --> 0:07:28.780000
 So I create a subnet
 here, subnet config.

0:07:28.780000 --> 0:07:34.240000
 That's just a subnet definition and then
 that feeds down into the definition

0:07:34.240000 --> 0:07:36.280000
 of my virtual network.

0:07:36.280000 --> 0:07:38.420000
 And you can see basic
 configuration.

0:07:38.420000 --> 0:07:42.000000
 There are more options, but I went with
 kind of minimal because this isn't

0:07:42.000000 --> 0:07:45.620000
 really the focus of this video.

0:07:45.620000 --> 0:07:51.440000
 And then I've got vnet is equal to new
 Azure virtual network and it includes

0:07:51.440000 --> 0:07:53.060000
 the subnet definition.

0:07:53.060000 --> 0:07:58.660000
 Then after that, I add another virtual
 network or another subnet, which

0:07:58.660000 --> 0:08:03.580000
 is very cleverly named second to the
 same virtual network, given it an

0:08:03.580000 --> 0:08:05.700000
 address prefix. Okay.

0:08:05.700000 --> 0:08:09.740000
 Notice also that the first subnet
 has a network security group.

0:08:09.740000 --> 0:08:12.200000
 The second subnet does not.

0:08:12.200000 --> 0:08:16.260000
 And then the next thing that I need
 to do to kind of set this up and I

0:08:16.260000 --> 0:08:21.080000
 forgot again, not that I forgot,
 I just didn't save it.

0:08:21.080000 --> 0:08:23.960000
 I want to update the
 virtual network.

0:08:23.960000 --> 0:08:25.360000
 So this is one of those.

0:08:25.360000 --> 0:08:30.380000
 If you use PowerShell, this can be a
 little bit inconsistent with Azure

0:08:30.380000 --> 0:08:34.400000
 PowerShell. Sometimes when I'm working
 with Azure PowerShell and I update

0:08:34.400000 --> 0:08:36.760000
 a setting, it updates immediately.


0:08:36.760000 --> 0:08:40.160000
 Sometimes it updates locally and then
 I'll have to push those changes

0:08:40.160000 --> 0:08:46.020000
 into Azure. Honestly, the best way
 to get to know that is take a look

0:08:46.020000 --> 0:08:50.960000
 at the help to run a get help in your
 PowerShell environment, get help

0:08:50.960000 --> 0:08:55.500000
 in the name of the particular PowerShell
 command that you want to use

0:08:55.500000 --> 0:09:00.980000
 and you'll usually see an example and
 if it needs both, it'll show it

0:09:00.980000 --> 0:09:03.140000
 to you. All right.

0:09:03.140000 --> 0:09:06.420000
 Anyways, that's the setup
 of the network.

0:09:06.420000 --> 0:09:12.540000
 So let's go ahead and
 create the network.

0:09:12.540000 --> 0:09:15.360000
 And it's saying that some things have
 changed in the network definition,

0:09:15.360000 --> 0:09:17.880000
 which is fine. That's going to take
 a moment and then we'll go on and

0:09:17.880000 --> 0:09:19.760000
 create the public IP address.

0:09:19.760000 --> 0:09:30.960000
 Okay. Next, I'm going to go ahead and
 set up the public IP address and

0:09:30.960000 --> 0:09:35.320000
 I'm going to go and set up both of the
 network interface cards as well.

0:09:35.320000 --> 0:09:39.420000
 So I create a public IP address resource
 and that creates directly and

0:09:39.420000 --> 0:09:44.220000
 then I'm creating or provisioning
 two network interfaces.

0:09:44.220000 --> 0:09:48.520000
 All right. So the first one is cleverly
 called complex Nick zero.

0:09:48.520000 --> 0:09:51.800000
 It's the resource group
 location, the net.

0:09:51.800000 --> 0:09:55.100000
 It does have a public IP address
 associated with it.

0:09:55.100000 --> 0:10:00.880000
 The second Nick, which is cleverly called
 complex Nick one is pretty much

0:10:00.880000 --> 0:10:05.760000
 the same thing. It goes with the other
 subnet and it does not have a public

0:10:05.760000 --> 0:10:12.140000
 IP address. So let's go
 ahead and run those out.

0:10:12.140000 --> 0:10:19.900000
 And that'll take a moment
 and we'll come right back.

0:10:19.900000 --> 0:10:22.700000
 All right. So we've got
 our virtual network.

0:10:22.700000 --> 0:10:25.600000
 We've got our public IP address.

0:10:25.600000 --> 0:10:27.040000
 We have our next now.

0:10:27.040000 --> 0:10:33.460000
 It's really time to go ahead and
 set up the virtual machine.

0:10:33.460000 --> 0:10:39.340000
 The machine configuration that's on lines
 41 through 50 is the exact same

0:10:39.340000 --> 0:10:45.220000
 configuration that we
 had in the slide.

0:10:45.220000 --> 0:10:47.520000
 So I'm not going to go
 through it too much.

0:10:47.520000 --> 0:10:50.400000
 You can see in blue on
 how I'll clear that.

0:10:50.400000 --> 0:10:55.500000
 I do like the ISA integrated scripting
 environment because it color codes

0:10:55.500000 --> 0:11:01.640000
 things and you can see between 41
 and 49 all of the nice blue there.

0:11:01.640000 --> 0:11:03.700000
 If you're color blind,
 I apologize.

0:11:03.700000 --> 0:11:08.820000
 But pretty much starting out each line
 except for the first are the actual

0:11:08.820000 --> 0:11:11.160000
 PowerShell commandlets that
 you would need to use.

0:11:11.160000 --> 0:11:16.500000
 Minimal ones that you would need to use
 would be the AZVM config, AZ operating

0:11:16.500000 --> 0:11:20.120000
 system, AZ source image and
 one AZ network interface.

0:11:20.120000 --> 0:11:28.200000
 You can also, by the way, configure the
 OS disk, which I'm not doing here.

0:11:28.200000 --> 0:11:30.240000
 We're going to go ahead
 and take that.

0:11:30.240000 --> 0:11:35.360000
 Actually, we're going to go ahead and take
 all of this if I need the credentials.

0:11:35.360000 --> 0:11:47.960000
 There we go. All right.

0:11:47.960000 --> 0:11:49.560000
 Got my credentials.

0:11:49.560000 --> 0:11:56.780000
 And that goes very quickly because
 that's not actually doing anything

0:11:56.780000 --> 0:12:02.440000
 yet. That is just setting
 up a configuration object.

0:12:02.440000 --> 0:12:08.860000
 And then I use my configuration object
 here when I create a new AZVM.

0:12:08.860000 --> 0:12:10.740000
 This is almost trivial.

0:12:10.740000 --> 0:12:15.020000
 All the hard work is done in the setup
 of that configuration and then

0:12:15.020000 --> 0:12:16.760000
 I go and call the new AZVM.

0:12:16.760000 --> 0:12:21.180000
 I should note that when you call new
 AZVM, you can also call it directly

0:12:21.180000 --> 0:12:26.780000
 and you can specify settings
 within the new AZVM.

0:12:26.780000 --> 0:12:29.760000
 However, I still like breaking it out
 because I think it's a little more

0:12:29.760000 --> 0:12:32.440000
 explicit in terms of
 what you're doing.

0:12:32.440000 --> 0:12:35.020000
 And even though there's a lot of calls,
 it actually breaks it out in a

0:12:35.020000 --> 0:12:36.740000
 way that is logical.

0:12:36.740000 --> 0:12:40.860000
 I should also tell you that if you are
 using the Azure CLI, it is designed

0:12:40.860000 --> 0:12:47.180000
 to always have one step calls,
 one step executions.

0:12:47.180000 --> 0:12:52.920000
 So you would in fact, you could in a
 very complex way define your virtual

0:12:52.920000 --> 0:12:55.160000
 machine with the CLI as well.

0:12:55.160000 --> 0:12:58.720000
 I just took this route because it was
 the first one that came up and also

0:12:58.720000 --> 0:13:02.100000
 probably more likely if you're studying
 for the exam, more likely you

0:13:02.100000 --> 0:13:06.740000
 would see PowerShell than you would see
 the CLI though no guarantee either

0:13:06.740000 --> 0:13:10.680000
 way. All right. Let's go ahead and get
 this started and that's going to

0:13:10.680000 --> 0:13:13.220000
 run for several minutes.

0:13:13.220000 --> 0:13:19.300000
 Tell me that it's going to use an existing
 storage account for my boot

0:13:19.300000 --> 0:13:21.060000
 diagnostics, which is fine.

0:13:21.060000 --> 0:13:24.100000
 And other than that, we'll come back
 as soon as this is done and take

0:13:24.100000 --> 0:13:31.200000
 a look at what it has generated.

0:13:31.200000 --> 0:13:36.800000
 All right. It looks as though our deployment
 has completed successfully.

0:13:36.800000 --> 0:13:42.720000
 So let's go ahead and let's take
 a look at that resource group.

0:13:42.720000 --> 0:13:47.620000
 All right. So we're going to go up here
 and just do a search for VM dash

0:13:47.620000 --> 0:13:53.820000
 complex. And there's my resource
 group VM complex demo.

0:13:53.820000 --> 0:13:59.600000
 And here are all of the resources
 that were provisioned.

0:13:59.600000 --> 0:14:02.480000
 We can see my Nix, we
 can see my data disks.

0:14:02.480000 --> 0:14:06.900000
 There is an OS disk, which again, I
 could have controlled that, but I

0:14:06.900000 --> 0:14:10.900000
 don't want to do absolutely everything
 that would take really long time.

0:14:10.900000 --> 0:14:14.280000
 There's my public
 IP address there.

0:14:14.280000 --> 0:14:18.260000
 And most importantly, there's
 my virtual machine.

0:14:18.260000 --> 0:14:21.860000
 And if I look at the virtual machine,
 I can see for example that it's

0:14:21.860000 --> 0:14:23.260000
 got a public IP address.

0:14:23.260000 --> 0:14:25.160000
 It's got a private IP address.

0:14:25.160000 --> 0:14:26.660000
 It actually should
 have two of those.

0:14:26.660000 --> 0:14:31.980000
 And if I go to networking, I can see
 that I actually have two Nix here.

0:14:31.980000 --> 0:14:34.820000
 I've got complex NIC zero.

0:14:34.820000 --> 0:14:37.760000
 And I can see that, for
 example, it's got rules.

0:14:37.760000 --> 0:14:41.340000
 I can see the public IP for that,
 the private IP for that.

0:14:41.340000 --> 0:14:47.500000
 And if I go to complex NIC one, I don't
 have a public IP associate with

0:14:47.500000 --> 0:14:49.520000
 that. It's on a different subnet.

0:14:49.520000 --> 0:14:51.720000
 So it's got a different
 IP address.

0:14:51.720000 --> 0:14:54.800000
 So I can see where all
 of that is configured.

0:14:54.800000 --> 0:15:00.360000
 And if I go to disks, I can see that
 it's got the two data disks attached

0:15:00.360000 --> 0:15:03.940000
 to it, as well as of
 course, the OS disk.

0:15:03.940000 --> 0:15:10.180000
 And that is why you want to start looking
 at really either scripting or

0:15:10.180000 --> 0:15:13.500000
 taking the next level and going to
 templating so you get what's called

0:15:13.500000 --> 0:15:15.520000
 infrastructure as code, right?

0:15:15.520000 --> 0:15:17.080000
 Because I can rerun this now.

0:15:17.080000 --> 0:15:21.520000
 I can reset up this complex architecture,
 which oftentimes you're going

0:15:21.520000 --> 0:15:24.860000
 to need to do. You've
 got database servers.

0:15:24.860000 --> 0:15:27.700000
 Database servers have to have a specific
 configuration of hardware and

0:15:27.700000 --> 0:15:30.840000
 software. Rather than going through and
 walking through that process every

0:15:30.840000 --> 0:15:33.960000
 time and having opportunities for errors,
 it's a lot better to have that

0:15:33.960000 --> 0:15:37.920000
 as a script or as a template that you
 can simply deploy when you need

0:15:37.920000 --> 0:15:42.480000
 to deploy it. And it will configure your
 resources the way you need every

