WEBVTT

0:00:02.720000 --> 0:00:10.160000
 In a production environment, repeatability
 is really important and repeatability

0:00:10.160000 --> 0:00:11.660000
 and manageability.

0:00:11.660000 --> 0:00:15.860000
 And that's what we're going
 to talk about in this video.

0:00:15.860000 --> 0:00:18.740000
 I'm going to talk about
 arm template deployment.

0:00:18.740000 --> 0:00:20.740000
 And of course, we'll talk about
 what arm templates are.

0:00:20.740000 --> 0:00:24.200000
 We're going to talk about
 why we want arm templates.

0:00:24.200000 --> 0:00:27.220000
 And we're going to start out by talking
 about repeatable deployments with

0:00:27.220000 --> 0:00:33.220000
 arm templates. Then we're going to
 get into actual arm templates.

0:00:33.220000 --> 0:00:35.960000
 We're going to take a look at what an
 arm template is, what the elements

0:00:35.960000 --> 0:00:37.980000
 of an arm template are.

0:00:37.980000 --> 0:00:42.720000
 We'll look specifically at the elements
 for deploying virtual machines,

0:00:42.720000 --> 0:00:46.800000
 including virtual VHDs,
 virtual hard drives.

0:00:46.800000 --> 0:00:51.040000
 And we'll also look at how you can do this,
 kind of the easy way by generating

0:00:51.040000 --> 0:00:54.160000
 an arm template from an
 existing deployment.

0:00:54.160000 --> 0:00:55.540000
 Which is pretty cool.

0:00:55.540000 --> 0:01:00.040000
 And then we'll wrap it up by demonstrating
 pretty much all of that.

0:01:00.040000 --> 0:01:03.320000
 So let's go ahead and let's
 jump into this, right?

0:01:03.320000 --> 0:01:07.920000
 If you think about the different ways
 that you can deploy, one way that

0:01:07.920000 --> 0:01:11.140000
 you can deploy is, of course,
 through the portal.

0:01:11.140000 --> 0:01:12.700000
 And I use the portal a lot.

0:01:12.700000 --> 0:01:14.640000
 I use it for demonstrations.

0:01:14.640000 --> 0:01:19.880000
 But there is an issue in a production
 environment, really any kind of

0:01:19.880000 --> 0:01:24.700000
 environment with using the portal
 for your main deployments.

0:01:24.700000 --> 0:01:28.300000
 And that is really, well,
 it's really kind of two.

0:01:28.300000 --> 0:01:33.600000
 One is repeatability and then related
 to that is opportunities for errors.

0:01:33.600000 --> 0:01:39.180000
 Let's say that you need to deploy a dozen
 virtual machines, not unreasonable.

0:01:39.180000 --> 0:01:43.680000
 Or you need to deploy a single environment
 with three or four different

0:01:43.680000 --> 0:01:47.640000
 virtual machines that are kind of related,
 but have some differentiation.

0:01:47.640000 --> 0:01:50.380000
 Well, you could do that through
 the portal, right?

0:01:50.380000 --> 0:01:53.480000
 But if you think about the portal experience,
 you're going to go through

0:01:53.480000 --> 0:01:55.120000
 all of these sections.

0:01:55.120000 --> 0:01:59.380000
 You've got all of these options
 that you need to set.

0:01:59.380000 --> 0:02:01.680000
 And yeah, this is just
 one example of that.

0:02:01.680000 --> 0:02:07.240000
 And so going through and setting that
 up is going to be time consuming,

0:02:07.240000 --> 0:02:10.680000
 right? And it's also, like I said,
 lots of opportunities for errors.

0:02:10.680000 --> 0:02:14.020000
 What if one time you select the wrong
 resource group, which I do all the

0:02:14.020000 --> 0:02:16.960000
 time, right? Or the wrong availability
 option, right?

0:02:16.960000 --> 0:02:18.520000
 Just lots of opportunities.

0:02:18.520000 --> 0:02:24.900000
 And if you do this 12 times, that's 12
 times this opportunity for errors.

0:02:24.900000 --> 0:02:29.480000
 And that's something that it's
 not a repeatable process.

0:02:29.480000 --> 0:02:30.640000
 Portal is fantastic.

0:02:30.640000 --> 0:02:32.280000
 Like I said, I use
 it all the time.

0:02:32.280000 --> 0:02:34.020000
 I demonstrate the creation
 of things.

0:02:34.020000 --> 0:02:36.640000
 If I'm doing a one-off, even in production,
 if I'm doing some kind of

0:02:36.640000 --> 0:02:40.360000
 one-off, don't need to worry about
 using again, then I can do it.

0:02:40.360000 --> 0:02:43.720000
 Or if I want to generate a template
 and I don't want to put any effort

0:02:43.720000 --> 0:02:47.520000
 out, I could do that to actually create
 the resources I would use to then

0:02:47.520000 --> 0:02:50.040000
 generate a template and
 make it repeatable.

0:02:50.040000 --> 0:02:54.480000
 But in general, as a production activity,
 not really what you want.

0:02:54.480000 --> 0:02:59.660000
 Now, on the other side, you do have the
 ability to script this out, right?

0:02:59.660000 --> 0:03:05.180000
 But I will tell you, scripting is,
 I would say, exponentially complex,

0:03:05.180000 --> 0:03:12.940000
 in that the more elements of an environment
 that you need to script out,

0:03:12.940000 --> 0:03:18.180000
 the more complex and not in a linear
 fashion, that deployment is going

0:03:18.180000 --> 0:03:22.520000
 to be. You need to make sure that you've
 got things scripted in the right

0:03:22.520000 --> 0:03:25.980000
 order, that you're handling dependencies,
 that you're handling errors.

0:03:25.980000 --> 0:03:28.680000
 What about having to
 redeploy that script?

0:03:28.680000 --> 0:03:31.940000
 Let's say it goes halfway through and
 you want to be able to just redeploy

0:03:31.940000 --> 0:03:35.620000
 it without having to do a lot
 of manual implementation.

0:03:35.620000 --> 0:03:38.520000
 Then you're going to have to write
 a lot of testing into that, make it

0:03:38.520000 --> 0:03:41.340000
 what's called idempotent, which just
 means you can repeat the process

0:03:41.340000 --> 0:03:43.600000
 without affecting what
 you've already done.

0:03:43.600000 --> 0:03:49.220000
 It certainly is repeatable, but I wouldn't
 say that it's highly manageable.

0:03:49.220000 --> 0:03:53.120000
 The alternative is
 to use templates.

0:03:53.120000 --> 0:03:58.340000
 Templates allow you to define, declaratively,
 what you want to deploy,

0:03:58.340000 --> 0:04:00.880000
 not how to deploy it.

0:04:00.880000 --> 0:04:02.500000
 And you save these, they're files.


0:04:02.500000 --> 0:04:05.180000
 They can be integrated
 into a DevOps process.

0:04:05.180000 --> 0:04:09.400000
 You can set up a CI, CD pipeline
 if you're familiar with that.

0:04:09.400000 --> 0:04:12.280000
 Lots of things that you can
 do because it's text-based.

0:04:12.280000 --> 0:04:15.100000
 And then the actual deployment
 is pretty straightforward.

0:04:15.100000 --> 0:04:18.320000
 Now I can actually deploy it, I can
 have a template, I can deploy the

0:04:18.320000 --> 0:04:21.780000
 template from the portal, but also if
 I want to just deploy it from the

0:04:21.780000 --> 0:04:24.880000
 command line, I've got a single
 command to deploy a template.

0:04:24.880000 --> 0:04:29.580000
 Now, I will also tell you this is
 a little bit misleading, right?

0:04:29.580000 --> 0:04:36.100000
 Because if I look at that, or even
 that, relative to one command line,

0:04:36.100000 --> 0:04:38.520000
 well, then that's always
 going to be the answer.

0:04:38.520000 --> 0:04:42.740000
 However, do be aware that you have
 to create the template first.

0:04:42.740000 --> 0:04:47.000000
 What this command line is not showing
 you is that all of the heavy lifting

0:04:47.000000 --> 0:04:51.720000
 is really being done in that file.


0:04:51.720000 --> 0:04:54.200000
 And I'm going to show you that
 file and that's easy enough.

0:04:54.200000 --> 0:04:58.380000
 But there's a lot of tools that you have
 that can help you generate those

0:04:58.380000 --> 0:05:02.940000
 files. Whether it's using tools like I'm
 going to demonstrate, using Visual

0:05:02.940000 --> 0:05:06.380000
 Studio Code, Visual Studio,
 both great tools.

0:05:06.380000 --> 0:05:10.440000
 There are hundreds of what are called
 Quick Start, which are templates

0:05:10.440000 --> 0:05:13.760000
 that are already defined, that are out
 there on GitHub that you can pick

0:05:13.760000 --> 0:05:18.940000
 up. As I mentioned, you can actually
 create resources and then generate

0:05:18.940000 --> 0:05:20.460000
 a template off the resources.

0:05:20.460000 --> 0:05:23.680000
 So you have that template and
 you can use it going forward.

0:05:23.680000 --> 0:05:26.400000
 Lots of things that you
 can do with templates.

0:05:26.400000 --> 0:05:32.820000
 Now, the template itself is a file
 and it's a text file and it uses a

0:05:32.820000 --> 0:05:37.880000
 format called JSON or JavaScript
 Object Notation, JSON.

0:05:37.880000 --> 0:05:43.640000
 JSON is a data structure that is
 designed to be very lightweight.

0:05:43.640000 --> 0:05:47.060000
 You define objects and you don't need
 to worry about that, but you can

0:05:47.060000 --> 0:05:54.300000
 see objects or groups of settings really
 which are delimited with braces.

0:05:54.300000 --> 0:05:57.280000
 And then within that, you have properties
 or you can think of them as

0:05:57.280000 --> 0:06:00.980000
 settings. And an ARM template
 has all of these.

0:06:00.980000 --> 0:06:04.600000
 It's got the schema, the content version,
 which you'll probably never

0:06:04.600000 --> 0:06:09.640000
 touch. I will tell you the API profile,
 which you will almost never touch.

0:06:09.640000 --> 0:06:12.240000
 Functions, which you
 probably won't touch.

0:06:12.240000 --> 0:06:15.520000
 And so really, it kind of comes
 down to four that are important.

0:06:15.520000 --> 0:06:18.620000
 Parameters, variables,
 resources, and outputs.

0:06:18.620000 --> 0:06:21.760000
 And out of all of these, the only one
 that's actually required out of

0:06:21.760000 --> 0:06:24.920000
 those four is resources.

0:06:24.920000 --> 0:06:28.340000
 So there's three sections
 that are required.

0:06:28.340000 --> 0:06:31.140000
 Two of them are pretty much given to you
 and you're not going to do anything

0:06:31.140000 --> 0:06:33.500000
 with them, the schema and
 the content version.

0:06:33.500000 --> 0:06:36.940000
 And then you need to
 define the resources.

0:06:36.940000 --> 0:06:39.360000
 Now, we're talking about
 virtual machines here.

0:06:39.360000 --> 0:06:44.720000
 So let's look at the elements
 for a virtual machine.

0:06:44.720000 --> 0:06:49.100000
 This is what would go into
 that resources section.

0:06:49.100000 --> 0:06:53.900000
 So you create the template itself, which
 has those six or seven different

0:06:53.900000 --> 0:06:57.860000
 sections. And then within the resources,
 that's where you start defining

0:06:57.860000 --> 0:07:05.200000
 your resources. And each resource has
 a type that is the actual defined

0:07:05.200000 --> 0:07:06.940000
 Azure resource type.

0:07:06.940000 --> 0:07:08.280000
 There's going to be
 a resource provider.

0:07:08.280000 --> 0:07:10.220000
 In this case, Microsoft Compute.

0:07:10.220000 --> 0:07:14.240000
 And then the actual resource, which
 in this case is virtual machines.

0:07:14.240000 --> 0:07:17.240000
 There are a wide range of APIs.

0:07:17.240000 --> 0:07:19.220000
 You need to know the API version.

0:07:19.220000 --> 0:07:21.440000
 That can seem very painful.

0:07:21.440000 --> 0:07:26.500000
 But again, the tooling is going to give
 you that if you're using any of

0:07:26.500000 --> 0:07:27.800000
 a range of tools.

0:07:27.800000 --> 0:07:30.400000
 You can do this in a text editor.

0:07:30.400000 --> 0:07:34.200000
 Also, the API versions are
 not that hard to find.

0:07:34.200000 --> 0:07:36.980000
 Every resource has to have a name.


0:07:36.980000 --> 0:07:42.420000
 That name is going to be unique within
 the resource group and type.

0:07:42.420000 --> 0:07:44.800000
 Some cases, the name has
 to be globally unique.

0:07:44.800000 --> 0:07:51.040000
 For example, if I were deploying a
 storage account or a SQL server, I

0:07:51.040000 --> 0:07:53.480000
 would need and many others, I would
 need to have those unique.

0:07:53.480000 --> 0:07:56.200000
 In the case of a virtual machine, it
 really doesn't have to be unique.

0:07:56.200000 --> 0:07:59.500000
 Globally, it just has to be unique within
 the resource group you're deploying

0:07:59.500000 --> 0:08:03.280000
 to. Location, that's pretty
 straightforward.

0:08:03.280000 --> 0:08:08.580000
 Then one that I think this is incredibly
 powerful right there depends

0:08:08.580000 --> 0:08:13.860000
 on. What you can do very easily with
 templates, and it's where I think,

0:08:13.860000 --> 0:08:17.080000
 one of the reasons I think templates excel,
 and I legitimately use templates

0:08:17.080000 --> 0:08:23.000000
 all the time. Most of my demos, I set
 up my template tasks that I have

0:08:23.000000 --> 0:08:25.580000
 students do. They're
 set up by template.

0:08:25.580000 --> 0:08:29.620000
 They're just something that
 I rely on in my day to day.

0:08:29.620000 --> 0:08:34.100000
 One of the reasons is I have this dependency,
 and I can explicitly define

0:08:34.100000 --> 0:08:39.120000
 dependency. For example, I know that
 a virtual machine is going to depend

0:08:39.120000 --> 0:08:41.440000
 on a network interface.

0:08:41.440000 --> 0:08:46.300000
 And I know that network interface is
 going to depend on a virtual network,

0:08:46.300000 --> 0:08:48.360000
 and possibly a public IP.

0:08:48.360000 --> 0:08:54.680000
 So what I can do is I can define
 a link on the depends on.

0:08:54.680000 --> 0:08:59.520000
 So this virtual machine, let's say it's
 going to depend on a network interface

0:08:59.520000 --> 0:09:05.160000
 named Nick1. So I would reference
 Nick1 in the depends on.

0:09:05.160000 --> 0:09:08.800000
 And what that will do when I submit
 this template, it's going to look

0:09:08.800000 --> 0:09:11.960000
 at dependencies and make sure that they're
 processed in the right order.

0:09:11.960000 --> 0:09:15.620000
 So the templates are actually processed
 by default in parallel.

0:09:15.620000 --> 0:09:20.860000
 So it will be deploying multiple resources
 simultaneously, but it's not

0:09:20.860000 --> 0:09:24.940000
 going to, it will wait in terms
 of your dependencies.

0:09:24.940000 --> 0:09:31.080000
 So again, it won't try to deploy a network
 interface and a virtual machine

0:09:31.080000 --> 0:09:33.460000
 that depends on that or going
 to face at the same time.

0:09:33.460000 --> 0:09:36.700000
 It'll finish the network interface
 and then go to the virtual machine.

0:09:36.700000 --> 0:09:38.340000
 All right, so that one
 is pretty important.

0:09:38.340000 --> 0:09:42.760000
 Now, every element that you deploy,
 every resource you deploy is going

0:09:42.760000 --> 0:09:44.220000
 to have a property section.

0:09:44.220000 --> 0:09:47.920000
 All of the elements above the property
 section, the type API version name

0:09:47.920000 --> 0:09:49.340000
 location depends on.

0:09:49.340000 --> 0:09:51.360000
 Those are all standard.

0:09:51.360000 --> 0:09:55.060000
 Every resource you deploy
 in Azure will have those.

0:09:55.060000 --> 0:09:56.660000
 And there's a few others as well.

0:09:56.660000 --> 0:09:59.400000
 But the properties is where different
 types of resources are going to

0:09:59.400000 --> 0:10:00.500000
 be differentiated.

0:10:00.500000 --> 0:10:06.140000
 And what you have for a virtual machine
 is you have hardware profile,

0:10:06.140000 --> 0:10:11.740000
 operating system or OS profile, storage
 profile, the network of profile,

0:10:11.740000 --> 0:10:14.700000
 and diagnostics profile, which
 kind of makes sense, right?

0:10:14.700000 --> 0:10:16.680000
 These are the things
 you have to set up.

0:10:16.680000 --> 0:10:20.280000
 So hardware profile pretty
 much virtual machine size.

0:10:20.280000 --> 0:10:25.300000
 OS profile, things like computer
 name, type of OS, etc.

0:10:25.300000 --> 0:10:26.440000
 Storage profile.

0:10:26.440000 --> 0:10:27.380000
 All right, you're building this.

0:10:27.380000 --> 0:10:30.220000
 If you're building it based off an image,
 what is the image you're building

0:10:30.220000 --> 0:10:32.860000
 it off of? That's a
 four part reference.

0:10:32.860000 --> 0:10:36.800000
 Definition of your OS disk and definition
 of your data disks if you have

0:10:36.800000 --> 0:10:39.020000
 them. Network profile.

0:10:39.020000 --> 0:10:41.940000
 What network interfaces
 are you going to have?

0:10:41.940000 --> 0:10:45.000000
 And if you have more than one,
 which one is the primary?

0:10:45.000000 --> 0:10:46.980000
 Okay, and then diagnostics.

0:10:46.980000 --> 0:10:48.140000
 Do you have boot diagnostics?

0:10:48.140000 --> 0:10:49.260000
 Do you want boot diagnostics?

0:10:49.260000 --> 0:10:53.420000
 You can set that up with the diagnostics
 profile, which I just realized

0:10:53.420000 --> 0:10:56.680000
 is missing. And you
 didn't see that.

0:10:56.680000 --> 0:11:00.900000
 There we go. Missing
 a close brace.

0:11:00.900000 --> 0:11:04.060000
 So that's the ARM template
 for virtual machines.

0:11:04.060000 --> 0:11:10.280000
 If you want to get a little bit more
 sophisticated, you can actually speck

0:11:10.280000 --> 0:11:14.580000
 out your VHD templates.

0:11:14.580000 --> 0:11:20.040000
 So your OS disk for example, when you're
 setting your OS disk, you would

0:11:20.040000 --> 0:11:21.060000
 set the OS type.

0:11:21.060000 --> 0:11:22.720000
 Windows or Linux.

0:11:22.720000 --> 0:11:28.300000
 You can set up your encryption,
 custom disk encryption.

0:11:28.300000 --> 0:11:29.800000
 You're going to give
 the disk a name.

0:11:29.800000 --> 0:11:33.100000
 Name's got to be unique within
 the resource group.

0:11:33.100000 --> 0:11:36.940000
 If you're using unmanaged disks, which
 you probably are not, you could

0:11:36.940000 --> 0:11:38.820000
 set the VHD setting there.

0:11:38.820000 --> 0:11:46.780000
 You set the image, which can be either
 a URI or just an image ID.

0:11:46.780000 --> 0:11:49.280000
 You set up the caching.

0:11:49.280000 --> 0:11:52.220000
 Do you want that to cache or not?

0:11:52.220000 --> 0:11:57.760000
 If you want right accelerator, if you
 want different thing disks, you

0:11:57.760000 --> 0:11:58.840000
 can set that up.

0:11:58.840000 --> 0:12:04.260000
 Create option. It's going
 to be attached or new.

0:12:04.260000 --> 0:12:05.620000
 Okay, your size.

0:12:05.620000 --> 0:12:10.140000
 Now I will tell you in most cases, when
 you're using an image for an OS,

0:12:10.140000 --> 0:12:12.500000
 you're not changing
 the disk OS size.

0:12:12.500000 --> 0:12:14.760000
 And you can set up managed disk.

0:12:14.760000 --> 0:12:18.160000
 If you want to, for example, set the
 storage account type, you can do

0:12:18.160000 --> 0:12:22.200000
 that. If you're attaching a managed
 disk, that's where you would put in

0:12:22.200000 --> 0:12:26.500000
 the ID of the managed disk
 that you are attaching.

0:12:26.500000 --> 0:12:31.280000
 Now that's for the OS disk.

0:12:31.280000 --> 0:12:35.960000
 The VHD template for
 data disks, similar.

0:12:35.960000 --> 0:12:40.360000
 I've got one thing that's a little
 different for the data disks.

0:12:40.360000 --> 0:12:44.640000
 You have a LUN that you need to set,
 and each data disk has to have a

0:12:44.640000 --> 0:12:49.060000
 unique LUN. Other than that, mostly
 the same, except you can actually

0:12:49.060000 --> 0:12:51.400000
 set one up to be detached.

0:12:51.400000 --> 0:12:55.300000
 So you're going to attach it and
 then just detach it afterwards.

0:12:55.300000 --> 0:13:00.880000
 All right, and that's it
 for your VHD elements.

0:13:00.880000 --> 0:13:07.040000
 Now, in addition to that, you don't want
 to do all of that work yourself.

0:13:07.040000 --> 0:13:11.940000
 There is an option to generate ARM
 templates, and not just for virtual

0:13:11.940000 --> 0:13:16.920000
 machines, but for any resource or for
 an entire resource group, you'll

0:13:16.920000 --> 0:13:20.880000
 find in the blade for that resource or
 resource group the option to export

0:13:20.880000 --> 0:13:26.360000
 a template. When you export a template,
 it will actually generate a template

0:13:26.360000 --> 0:13:29.320000
 file for you. So I'm going to go through
 and generate a template file

0:13:29.320000 --> 0:13:31.700000
 from scratch. We'll
 see how to do that.

0:13:31.700000 --> 0:13:32.640000
 I'm using tooling.

0:13:32.640000 --> 0:13:36.400000
 I'm going to use Visual
 Studio Code to do this.

0:13:36.400000 --> 0:13:41.060000
 And then after I do that, and I'll show
 you how to deploy that, I'll go

0:13:41.060000 --> 0:13:45.300000
 into an existing virtual machine, and
 I will capture the template for

0:13:45.300000 --> 0:13:47.360000
 that machine using the portal.

0:13:47.360000 --> 0:13:50.840000
 So kind of going back to the very beginning
 of this, where I said, ah,

0:13:50.840000 --> 0:13:53.980000
 you don't want to use a portal to create
 because it's not repeatable.

0:13:53.980000 --> 0:13:59.840000
 However, if you want to use the portal
 to cheat, I'm completely behind

0:13:59.840000 --> 0:14:03.120000
 that. Well, don't cheat generally,
 but for this one, it's fine.

0:14:03.120000 --> 0:14:06.840000
 And what you can do is you can go, let's
 say you know you want to create

0:14:06.840000 --> 0:14:10.060000
 multiple copies of a VM with certain
 configuration, but you're not really

0:14:10.060000 --> 0:14:11.420000
 exactly sure how to
 do the template.

0:14:11.420000 --> 0:14:12.660000
 You don't have time to
 do a lot of research.

0:14:12.660000 --> 0:14:18.460000
 You could go in, set up a virtual machine,
 set up whatever else you need

0:14:18.460000 --> 0:14:22.760000
 for it, hard drive, your
 networking, etc.

0:14:22.760000 --> 0:14:27.300000
 And actually capture the entire thing,
 which is, I think, pretty cool.

0:14:27.300000 --> 0:14:31.800000
 And so that can be done
 from the portal.

0:14:31.800000 --> 0:14:37.940000
 Now, what I'm going to do is demonstrate
 arm template deployment.

0:14:37.940000 --> 0:14:41.420000
 So I'm going to first generate
 an ARM template.

0:14:41.420000 --> 0:14:45.400000
 Then within that ARM template, I'm
 going to generate the template for

0:14:45.400000 --> 0:14:47.180000
 a virtual machine.

0:14:47.180000 --> 0:14:52.280000
 And I'll add, I'll make a few modifications
 to it, and I will add in a

0:14:52.280000 --> 0:14:53.960000
 virtual hard drive.

0:14:53.960000 --> 0:14:55.560000
 We'll add in a data disk.

0:14:55.560000 --> 0:14:57.720000
 And then I'll go ahead
 and deploy it.

0:14:57.720000 --> 0:15:00.520000
 And while it's deploying, I'll skip
 over and we'll take a look at how

0:15:00.520000 --> 0:15:05.280000
 you could generate this without actually
 having to do, well, any work,

0:15:05.280000 --> 0:15:07.900000
 which is always something
 I try to strive for.

0:15:07.900000 --> 0:15:11.380000
 All right, let's go ahead and
 let's take a look at this.

0:15:11.380000 --> 0:15:15.220000
 All right, I have Visual
 Studio Code.

0:15:15.220000 --> 0:15:19.000000
 It is a cross platform tool that
 Microsoft makes available.

0:15:19.000000 --> 0:15:20.540000
 It's open source.

0:15:20.540000 --> 0:15:24.720000
 And it's one of those things I've been
 using Visual Studio since 2001

0:15:24.720000 --> 0:15:25.660000
 when it came out.

0:15:25.660000 --> 0:15:29.720000
 And really before that, I was using its
 precursor, including Visual Basic

0:15:29.720000 --> 0:15:31.140000
 back in the day.

0:15:31.140000 --> 0:15:33.160000
 So very, very familiar with that.

0:15:33.160000 --> 0:15:39.080000
 I have over the last year become more
 and more enamored with Visual Studio

0:15:39.080000 --> 0:15:41.340000
 Code. And so that's
 what I'm using.

0:15:41.340000 --> 0:15:42.420000
 Now, I have this.

0:15:42.420000 --> 0:15:44.480000
 I have it set up with
 some extensions.

0:15:44.480000 --> 0:15:47.000000
 They're going to make it easier
 for me to code this.

0:15:47.000000 --> 0:15:50.780000
 The extensions I'm using with one exception,
 I created my own snippet

0:15:50.780000 --> 0:15:52.160000
 and I'll show you that.

0:15:52.160000 --> 0:15:55.920000
 But these are all available,
 easy to set up.

0:15:55.920000 --> 0:15:58.960000
 So it's very easy to configure this if
 you wanted to use this environment,

0:15:58.960000 --> 0:16:00.460000
 but by no means have to.

0:16:00.460000 --> 0:16:04.740000
 Anyways, I have a JSON file.

0:16:04.740000 --> 0:16:06.960000
 VM deployed.json.

0:16:06.960000 --> 0:16:07.940000
 It's in a folder.

0:16:07.940000 --> 0:16:09.100000
 It doesn't matter where it is.

0:16:09.100000 --> 0:16:14.560000
 And what I'm going to do is I'm going to
 start out by generating the structure

0:16:14.560000 --> 0:16:17.660000
 of an arm template.

0:16:17.660000 --> 0:16:24.320000
 And so I pop that in and
 make this a bit bigger.

0:16:24.320000 --> 0:16:27.500000
 And a little bit.

0:16:27.500000 --> 0:16:30.660000
 There we go. Get that
 out of the way.

0:16:30.660000 --> 0:16:34.620000
 All right. Now this has
 the primary element.

0:16:34.620000 --> 0:16:40.880000
 So I've got a schema, got a content
 version, got parameters, variables,

0:16:40.880000 --> 0:16:45.060000
 and resources. And I'm going to add a
 couple parameters, a couple variables.

0:16:45.060000 --> 0:16:48.780000
 I have to at least add one parameter
 because otherwise I could not deploy

0:16:48.780000 --> 0:16:50.960000
 this in good conscience.

0:16:50.960000 --> 0:16:52.260000
 We'll get there.

0:16:52.260000 --> 0:16:54.680000
 Okay. But what I'm going to do is
 I'm going to go into resources.

0:16:54.680000 --> 0:17:01.280000
 And I want to generate the template
 required for a virtual machine.

0:17:01.280000 --> 0:17:08.460000
 And so what I'm going to do is I'm just
 going to go ARM dash VM and we'll

0:17:08.460000 --> 0:17:10.020000
 go with Windows.

0:17:10.020000 --> 0:17:13.800000
 Now when I do this, there's actually
 quite a number of things that are

0:17:13.800000 --> 0:17:19.740000
 generated and I can manage
 some bringing this out.

0:17:19.740000 --> 0:17:25.400000
 There we go. There's actually a
 template outline that I can use.

0:17:25.400000 --> 0:17:29.000000
 And so a storage account
 was created.

0:17:29.000000 --> 0:17:30.340000
 And the first thing I'm going to do
 is I'm going to remove that because

0:17:30.340000 --> 0:17:31.780000
 I don't need a storage account.

0:17:31.780000 --> 0:17:34.220000
 That's fine. Very
 easy to work with.

0:17:34.220000 --> 0:17:38.580000
 Then a public IP address
 is created.

0:17:38.580000 --> 0:17:42.080000
 Now the public IP address, I'm going
 to change around a little bit because

0:17:42.080000 --> 0:17:48.120000
 I don't want a DNS prefix on that.


0:17:48.120000 --> 0:17:52.540000
 I've got a virtual network and
 the virtual network is set up.

0:17:52.540000 --> 0:17:54.340000
 It's got an address
 space and subnets.

0:17:54.340000 --> 0:17:59.060000
 All the things that I need kind of
 for a minimal virtual network.

0:17:59.060000 --> 0:18:01.240000
 We'll change some things
 around there.

0:18:01.240000 --> 0:18:05.420000
 Then I've got my network interface
 and the network interface has some

0:18:05.420000 --> 0:18:09.680000
 dependencies. It's dependent on both
 the virtual network and the public

0:18:09.680000 --> 0:18:15.240000
 IP. So those have to be in place before
 this network interface is provisioned.

0:18:15.240000 --> 0:18:19.620000
 And the reason for that is because
 they're both referenced.

0:18:19.620000 --> 0:18:23.780000
 So here's the public IP address that's
 associated with the IP configuration

0:18:23.780000 --> 0:18:26.220000
 for the network interface.

0:18:26.220000 --> 0:18:30.740000
 And then there's the subnet that's also
 associated with the network interface.

0:18:30.740000 --> 0:18:34.540000
 And then down here I've got
 the actual virtual machine.

0:18:34.540000 --> 0:18:38.120000
 Now again I'm going to change up a number
 of things and it's kind of fun

0:18:38.120000 --> 0:18:41.000000
 tool. I don't know maybe my idea of
 fun might be a little bit different

0:18:41.000000 --> 0:18:46.060000
 than many. But I'm going to go down
 here for example under resources and

0:18:46.060000 --> 0:18:54.800000
 I'm not going to set up actual
 collection of diagnostics.

0:18:54.800000 --> 0:18:58.420000
 And in fact I'm not even going
 to collect boot diagnostics.

0:18:58.420000 --> 0:19:02.900000
 I'm going to turn that to false and remove
 the reference to the boot diagnostics.

0:19:02.900000 --> 0:19:07.800000
 I can always go in and change this
 and update it and redeploy it.

0:19:07.800000 --> 0:19:10.080000
 And I'm also going
 to come up here.

0:19:10.080000 --> 0:19:11.180000
 We're going to take a look.

0:19:11.180000 --> 0:19:17.700000
 Here's my OS disk name, Windows VM,
 one OS disk, terrible name, set up

0:19:17.700000 --> 0:19:22.440000
 to read write and it's being
 created from an image.

0:19:22.440000 --> 0:19:25.100000
 And here's the image.

0:19:25.100000 --> 0:19:28.300000
 So it's a Markzell Windows server.


0:19:28.300000 --> 0:19:36.360000
 As a publisher the offers Windows server
 the SKU with 2016 data center.

0:19:36.360000 --> 0:19:41.060000
 Latest. So that's deploying.

0:19:41.060000 --> 0:19:44.660000
 Now the username and password I'm going
 to change that as well as the

0:19:44.660000 --> 0:19:50.440000
 computer name. I'm going to actually
 make all of those to be dynamic.

0:19:50.440000 --> 0:19:52.040000
 I'll get to that in a second.

0:19:52.040000 --> 0:19:57.840000
 Three change the VM size.

0:19:57.840000 --> 0:20:01.560000
 Now depends on I don't have
 the storage account.

0:20:01.560000 --> 0:20:04.820000
 I don't need it because I'm
 not setting up diagnostics.

0:20:04.820000 --> 0:20:07.120000
 I do need the network interface.

0:20:07.120000 --> 0:20:08.600000
 Then I've got the name.

0:20:08.600000 --> 0:20:11.120000
 Now one one problem and
 it's the way I built it.

0:20:11.120000 --> 0:20:12.160000
 So it's not really a huge problem.


0:20:12.160000 --> 0:20:14.420000
 One problem is that
 this is very static.

0:20:14.420000 --> 0:20:16.580000
 Okay, it would be pretty
 hard to reuse this.

0:20:16.580000 --> 0:20:20.040000
 In fact in some ways I wouldn't
 be able to just redeploy this.

0:20:20.040000 --> 0:20:23.120000
 So what I want to do is I'm going
 to modify this a little bit.

0:20:23.120000 --> 0:20:24.600000
 And I'm going to do a few things.

0:20:24.600000 --> 0:20:29.160000
 First of all I am going
 to add a parameter.

0:20:29.160000 --> 0:20:35.560000
 And that is going to be password because
 I do not want to hard code the

0:20:35.560000 --> 0:20:39.540000
 password. With the parameter there's a
 bunch of things I could do including

0:20:39.540000 --> 0:20:43.600000
 down the road. I could actually set
 it up so that the password is being

0:20:43.600000 --> 0:20:48.020000
 held in a key vault.

0:20:48.020000 --> 0:20:51.460000
 And then referenced by this I'm not
 going to go to that depth or that

0:20:51.460000 --> 0:20:52.620000
 length but I could.

0:20:52.620000 --> 0:20:56.720000
 And so say password here.

0:20:56.720000 --> 0:21:00.400000
 Plus I'm going to add
 some variables.

0:21:00.400000 --> 0:21:04.300000
 And the reason we use variables is this
 way I don't accidentally reference

0:21:04.300000 --> 0:21:06.100000
 the wrong things.

0:21:06.100000 --> 0:21:09.040000
 So I'm going to come
 up with a base name.

0:21:09.040000 --> 0:21:19.860000
 And we're just going
 to call this az 104.

0:21:19.860000 --> 0:21:22.020000
 Arm. It's my base name.

0:21:22.020000 --> 0:21:26.020000
 And then I am going
 to create a VM name.

0:21:26.020000 --> 0:21:29.740000
 And there's going to be a
 little bit of code here.

0:21:29.740000 --> 0:21:32.460000
 Don't worry about
 the code so much.

0:21:32.460000 --> 0:21:33.580000
 Actify it was nice.

0:21:33.580000 --> 0:21:36.280000
 I would have just done this.

0:21:36.280000 --> 0:21:39.340000
 Had this so I could pop
 it up but I didn't.

0:21:39.340000 --> 0:21:41.920000
 That's okay base name.

0:21:41.920000 --> 0:21:46.380000
 I will copy and paste
 a little bit at least.

0:21:46.380000 --> 0:21:48.940000
 So you're not watching
 me type too much.

0:21:48.940000 --> 0:21:51.280000
 It's got the VM name.

0:21:51.280000 --> 0:21:54.060000
 Oops. The pip name.

0:21:54.060000 --> 0:21:57.200000
 The nickname. The vnet name.

0:21:57.200000 --> 0:21:58.660000
 And the subnet name.

0:21:58.660000 --> 0:22:02.820000
 It's yelling at me because it's saying
 these are all the same but it'll

0:22:02.820000 --> 0:22:10.300000
 change. Pip. Nick.

0:22:10.300000 --> 0:22:18.040000
 Vnet. VNoot. Similar to Vnet
 but a little bit different.

0:22:18.040000 --> 0:22:22.600000
 And subnet name.

0:22:22.600000 --> 0:22:35.720000
 And so that's just
 going to be Nick.

0:22:35.720000 --> 0:22:42.400000
 Vnet. And actually the whole thing
 is just going to be default because

0:22:42.400000 --> 0:22:45.500000
 that is my subnet name.

0:22:45.500000 --> 0:22:48.800000
 Okay so now I have these which is great
 but I kind of want to use them

0:22:48.800000 --> 0:22:53.200000
 a little bit. So I'm going to
 go in and reference them.

0:22:53.200000 --> 0:22:58.920000
 So my Nick is going to be referenced
 as variables or my pip.

0:22:58.920000 --> 0:23:01.820000
 This is my pip name.

0:23:01.820000 --> 0:23:05.400000
 And that's not dependent
 on anything.

0:23:05.400000 --> 0:23:10.080000
 My vnet virtual network.

0:23:10.080000 --> 0:23:18.160000
 Variables. Vnet name.

0:23:18.160000 --> 0:23:21.100000
 And then the subnet.

0:23:21.100000 --> 0:23:26.900000
 Going to be variables.

0:23:26.900000 --> 0:23:33.300000
 Subnet name. I could make everything
 dynamic but this is just a quick

0:23:33.300000 --> 0:23:38.960000
 demo. And you'll see in a moment
 why I want to do it this way.

0:23:38.960000 --> 0:23:41.840000
 Okay this is going
 to be variables.

0:23:41.840000 --> 0:23:52.760000
 Nick name. Ah. Nick name.

0:23:52.760000 --> 0:23:54.820000
 There we go. Better.

0:23:54.820000 --> 0:23:56.080000
 Now this is dependent.

0:23:56.080000 --> 0:23:59.320000
 It's dependent on
 public IP address.

0:23:59.320000 --> 0:24:03.740000
 But since I'm making that dynamic in
 this way I know it's always going

0:24:03.740000 --> 0:24:06.920000
 to be the same. Wherever
 I reference it.

0:24:06.920000 --> 0:24:11.040000
 That's really why I do this because
 otherwise it's guaranteed that I'm

0:24:11.040000 --> 0:24:13.100000
 going to have a mistake
 when I deploy this.

0:24:13.100000 --> 0:24:18.280000
 Get the idea. Vnet.

0:24:18.280000 --> 0:24:22.340000
 And now I also have to reference
 it down here properly.

0:24:22.340000 --> 0:24:30.040000
 My public IP. IP.

0:24:30.040000 --> 0:24:34.420000
 And then for the virtual network I'm
 actually referencing the subnet so

0:24:34.420000 --> 0:24:48.140000
 I need both the virtual
 network and the subnet.

0:24:48.140000 --> 0:24:52.460000
 So I know this is
 a little tedious.

0:24:52.460000 --> 0:24:53.820000
 But pretty straightforward.

0:24:53.820000 --> 0:24:55.200000
 Now it depends on this.

0:24:55.200000 --> 0:24:58.360000
 I'm now on the virtual machine
 so we're just about done.

0:24:58.360000 --> 0:25:01.220000
 That's very sad for everybody
 watching this.

0:25:01.220000 --> 0:25:03.980000
 So variables one more time.

0:25:03.980000 --> 0:25:09.600000
 If nothing else you'll know that it's
 a good idea to use variables if

0:25:09.600000 --> 0:25:14.840000
 you have these. Okay and then admin
 username it's going to be student.

0:25:14.840000 --> 0:25:18.200000
 Usually I would make that a variable
 but I thought I've probably just

0:25:18.200000 --> 0:25:21.160000
 about lost you so I didn't
 want to do that.

0:25:21.160000 --> 0:25:24.800000
 And then really the whole reason I want
 to do this is that the admin password

0:25:24.800000 --> 0:25:29.460000
 I want that to be a parameter.

0:25:29.460000 --> 0:25:35.640000
 Okay. All right now I was going to
 add in another disk but we'll just

0:25:35.640000 --> 0:25:38.560000
 leave it at that because
 this has taken a while.

0:25:38.560000 --> 0:25:41.840000
 And oh last thing I almost forgot this
 I need to change the idea of my

0:25:41.840000 --> 0:25:42.440000
 network interface.

0:25:42.440000 --> 0:25:43.820000
 So I'm going to add
 a new database.

0:25:43.820000 --> 0:25:50.120000
 Variables nickname.

0:25:50.120000 --> 0:25:53.880000
 All right so I've got my resources I've
 got my reference to my resources

0:25:53.880000 --> 0:25:56.860000
 and we should be good to go.

0:25:56.860000 --> 0:25:59.560000
 All right now I need
 to deploy this.

0:25:59.560000 --> 0:26:07.140000
 And I'm actually just going to open
 up a terminal in visual studio code.

0:26:07.140000 --> 0:26:10.100000
 Now I've already got
 this set up to.

0:26:10.100000 --> 0:26:13.340000
 Oh you know what I don't think I
 have this set up to write one.

0:26:13.340000 --> 0:26:18.780000
 So I'm going to actually
 deploy this to.

0:26:18.780000 --> 0:26:24.400000
 Well let's see if I
 can get that there.

0:26:24.400000 --> 0:26:31.140000
 There we go. I'm actually going
 to deploy this via the portal.

0:26:31.140000 --> 0:26:32.460000
 We'll just upload
 it via the portal.

0:26:32.460000 --> 0:26:33.640000
 I'll show you how to do that.

0:26:33.640000 --> 0:26:39.160000
 So I'm going to create a
 resource in the portal.

0:26:39.160000 --> 0:26:41.980000
 Template deployment.

0:26:41.980000 --> 0:26:43.540000
 And I'm going to create.

0:26:43.540000 --> 0:26:47.980000
 So I'm using the portal but I'm using
 it to deploy a template that I've

0:26:47.980000 --> 0:26:49.260000
 already defined.

0:26:49.260000 --> 0:26:51.200000
 So I'm going to build
 my own template.

0:26:51.200000 --> 0:26:53.620000
 Notice there's a ton of
 existing templates.

0:26:53.620000 --> 0:26:56.180000
 There's four examples there or there's
 these quick starts you could use

0:26:56.180000 --> 0:26:58.520000
 but we'll just go here.

0:26:58.520000 --> 0:27:02.000000
 And what I'm going to
 do is load a file.

0:27:02.000000 --> 0:27:10.540000
 Go pick a file. See if I can
 remember where that file is.

0:27:10.540000 --> 0:27:14.640000
 There we go. There's my
 file VM deploy JSON.

0:27:14.640000 --> 0:27:15.380000
 And there it is.

0:27:15.380000 --> 0:27:20.660000
 It pulls it up. And I see my resources
 and I can see my variables.

0:27:20.660000 --> 0:27:23.720000
 And so lots of good stuff there.

0:27:23.720000 --> 0:27:25.440000
 I can save this.

0:27:25.440000 --> 0:27:29.880000
 Now when I save it, I
 get this interface.

0:27:29.880000 --> 0:27:37.320000
 I'm going to create a new
 resource group for this.

0:27:37.320000 --> 0:27:39.140000
 To deploy it to.

0:27:39.140000 --> 0:27:42.340000
 To deploy it to the East US.

0:27:42.340000 --> 0:27:47.140000
 I always deploy everything to the East
 US and the interface refuses to

0:27:47.140000 --> 0:27:48.720000
 accept that. All right.

0:27:48.720000 --> 0:27:51.160000
 Then I'm going to
 put in a password.

0:27:51.160000 --> 0:27:55.700000
 And I'm going to agree to
 the terms and conditions.

0:27:55.700000 --> 0:27:59.880000
 And then I'm going to go
 ahead and purchase this.

0:27:59.880000 --> 0:28:03.860000
 And again, I was going
 to do this through the.

0:28:03.860000 --> 0:28:11.180000
 Through the. Visual Studio code, which
 I absolutely could have done, but

0:28:11.180000 --> 0:28:13.680000
 I kind of feel like I showed
 you enough code.

0:28:13.680000 --> 0:28:16.080000
 And so I made that snap decision.

0:28:16.080000 --> 0:28:17.360000
 Hope everybody's OK with that.

0:28:17.360000 --> 0:28:20.540000
 All right. So now I'm going to make
 you watch this thing spin for about

0:28:20.540000 --> 0:28:21.420000
 three to five minutes.

0:28:21.420000 --> 0:28:23.280000
 No, I'm not going to do that.

0:28:23.280000 --> 0:28:28.200000
 What I am going to do is I'm going
 to skip ahead and show you how you

0:28:28.200000 --> 0:28:34.280000
 can take an existing virtual machine
 and generate a template based on

0:28:34.280000 --> 0:28:35.540000
 that virtual machine.

0:28:35.540000 --> 0:28:41.500000
 So let's go. To my
 virtual machines.

0:28:41.500000 --> 0:28:44.620000
 I should have a whole
 bunch to choose from.

0:28:44.620000 --> 0:28:52.040000
 All right. And so I've got
 this AZ 104 restore.

0:28:52.040000 --> 0:28:53.960000
 I think BC should have something.

0:28:53.960000 --> 0:28:55.740000
 Let's see. Yep. There we go.

0:28:55.740000 --> 0:29:00.520000
 OK. Now what I'm going to do is I'm
 going to actually go over to this

0:29:00.520000 --> 0:29:03.280000
 resource group. So I'm going
 to use the resource group.

0:29:03.280000 --> 0:29:07.160000
 I'm going to look at everything
 in this resource group.

0:29:07.160000 --> 0:29:09.180000
 That's way too much.

0:29:09.180000 --> 0:29:10.920000
 So we won't use the entire
 resource group.

0:29:10.920000 --> 0:29:12.340000
 We'll just go here.

0:29:12.340000 --> 0:29:14.300000
 Good thing I planned that out.

0:29:14.300000 --> 0:29:17.840000
 All right. What I'm going to do at
 this point is just export this and

0:29:17.840000 --> 0:29:21.980000
 not get. To wrapped up in it.

0:29:21.980000 --> 0:29:25.060000
 All right. So I just
 hit export template.

0:29:25.060000 --> 0:29:29.160000
 OK. And what that does is
 it exports a resource.

0:29:29.160000 --> 0:29:31.120000
 Now this parameterizes it.

0:29:31.120000 --> 0:29:35.180000
 Now as you saw very much
 like parameters, but.

0:29:35.180000 --> 0:29:39.300000
 I'm going to go over here and I'm
 going to de-parameterize it.

0:29:39.300000 --> 0:29:42.800000
 Just so we can see now
 this only generated.

0:29:42.800000 --> 0:29:49.660000
 One. Template. One resource
 in the template.

0:29:49.660000 --> 0:29:52.940000
 OK. And that is my
 virtual machine.

0:29:52.940000 --> 0:29:57.860000
 So you can see I've got the schema content
 version parameters variables.

0:29:57.860000 --> 0:29:59.060000
 All those are blank.

0:29:59.060000 --> 0:29:59.800000
 And then the resource.

0:29:59.800000 --> 0:30:02.740000
 The only thing that's required well,
 schema and content version are not

0:30:02.740000 --> 0:30:04.800000
 blank, but I just leave
 those defaults.

0:30:04.800000 --> 0:30:07.980000
 But the parameters and variables
 in this case are blank.

0:30:07.980000 --> 0:30:15.620000
 I've got the same type API version, the
 name, location, hardware profile.

0:30:15.620000 --> 0:30:18.220000
 This was a DS1 V2 image.

0:30:18.220000 --> 0:30:20.580000
 This was 2016 data center.

0:30:20.580000 --> 0:30:23.420000
 OS disk, OS type windows.

0:30:23.420000 --> 0:30:27.020000
 Just don't actually have to set the
 name of the OS disk creating from

0:30:27.020000 --> 0:30:29.960000
 an image. That's going to use
 that image right there.

0:30:29.960000 --> 0:30:33.500000
 OK. The manage disk that's
 got standard SSD, LRS.

0:30:33.500000 --> 0:30:36.020000
 That means it's using
 standard SSD.

0:30:36.020000 --> 0:30:43.000000
 OK. The ID. And of the manage
 disk, the OS profile.

0:30:43.000000 --> 0:30:46.840000
 You see the network interface and diagnostics
 in this case are set to

0:30:46.840000 --> 0:30:49.340000
 true. Now I could simply
 download this.

0:30:49.340000 --> 0:30:52.700000
 I could actually choose
 to deploy it right now.

0:30:52.700000 --> 0:30:55.000000
 I could also add it to a library.

0:30:55.000000 --> 0:30:57.780000
 I'm not really a huge fan
 of the library concept.

0:30:57.780000 --> 0:31:02.720000
 It's in there. It's part of Azure, but
 I don't personally think it does

0:31:02.720000 --> 0:31:05.800000
 a whole lot. If you're going to take
 the exam, it is covered elsewhere

0:31:05.800000 --> 0:31:06.920000
 in another video.

0:31:06.920000 --> 0:31:08.440000
 So we're not going to
 do that right now.

0:31:08.440000 --> 0:31:11.740000
 But point is I've got this
 template as a text file.

0:31:11.740000 --> 0:31:12.840000
 I can download it.

0:31:12.840000 --> 0:31:17.980000
 I could work with it and kind
 of do what I want with it.

0:31:17.980000 --> 0:31:23.240000
 Now let's see if that deployment
 truly finished.

0:31:23.240000 --> 0:31:27.880000
 All right. And so I've deployed in
 here, I've got this Windows VM1 in

0:31:27.880000 --> 0:31:34.420000
 my AZ-1043. If I click on that, I can
 see that it's got a public IP address.

0:31:34.420000 --> 0:31:36.680000
 It's got a private IP address.

0:31:36.680000 --> 0:31:44.100000
 I see the virtual network, the name
 of the virtual network is AZ-104-arm

0:31:44.100000 --> 0:31:51.100000
-vnet. I actually forgot to replace the
 virtual machine name with the variable,

0:31:51.100000 --> 0:31:53.160000
 but I could do that.

0:31:53.160000 --> 0:31:55.520000
 And basically, all of
 my setup is here.

0:31:55.520000 --> 0:31:57.340000
 So here's the disk that I created.


0:31:57.340000 --> 0:31:58.600000
 Also didn't rename that.

0:31:58.600000 --> 0:32:00.140000
 So I kind of messed
 up a little bit.

0:32:00.140000 --> 0:32:03.000000
 But not in a huge way.

0:32:03.000000 --> 0:32:05.260000
 Here's my networking
 settings in general.

0:32:05.260000 --> 0:32:07.480000
 I see my NIC, AZ-104-arm-NIC.

0:32:07.480000 --> 0:32:15.300000
 Now if I wanted to, one thing that's
 pretty cool is I could make minor

0:32:15.300000 --> 0:32:19.900000
 changes to this deployment
 template.

0:32:19.900000 --> 0:32:30.720000
 For example, the name of my virtual machine
 should be variables, VM name.

0:32:30.720000 --> 0:32:33.260000
 That should be the name of it.

0:32:33.260000 --> 0:32:36.160000
 And the computer name, really
 shouldn't be Windows VM1.

0:32:36.160000 --> 0:32:42.360000
 It should be variables, base name.


0:32:42.360000 --> 0:32:49.380000
 And then my OS disk
 of a better name.

0:32:49.380000 --> 0:32:59.460000
 That's going to be cat variables just
 because I forgot to do this before

0:32:59.460000 --> 0:33:09.540000
 OS disk. And what I could do is I can
 save this, and I'm not going to

0:33:09.540000 --> 0:33:12.220000
 make you watch me go through the process
 of it, but I'm going to ask you

0:33:12.220000 --> 0:33:13.260000
 to take my word.

0:33:13.260000 --> 0:33:15.660000
 Now I could take this
 and redeploy it.

0:33:15.660000 --> 0:33:19.120000
 And what's going to happen, it's going
 to look and it's going to see the

0:33:19.120000 --> 0:33:21.200000
 public IP address
 is already there.

0:33:21.200000 --> 0:33:23.200000
 It's going to see the virtual
 network is already there.

0:33:23.200000 --> 0:33:26.940000
 It's going to see the Windows VM is already
 there, or the network interface

0:33:26.940000 --> 0:33:28.120000
 is already there.

0:33:28.120000 --> 0:33:31.680000
 But the Windows VM is not.

0:33:31.680000 --> 0:33:34.400000
 So it's then going to go and
 recreate the Windows VM.

0:33:34.400000 --> 0:33:38.020000
 Now the problem with this is if I tried
 to deploy this exactly as is,

0:33:38.020000 --> 0:33:45.580000
 it would fail because the public IP
 address and the NIC are already in

0:33:45.580000 --> 0:33:47.960000
 use and they can only be
 used by one resource.

0:33:47.960000 --> 0:33:51.780000
 So the existing public IP address
 is being used by the existing NIC.

0:33:51.780000 --> 0:33:55.880000
 The existing NIC is being used by
 the existing virtual machine.

0:33:55.880000 --> 0:33:59.320000
 Right. But if I were to say delete the
 virtual machine and then redeploy

0:33:59.320000 --> 0:34:04.440000
 this, it would only redeploy the
 virtual machine and its OS disk.

0:34:04.440000 --> 0:34:07.680000
 Alternatively, one of the reasons I
 like having this kind of environment

0:34:07.680000 --> 0:34:10.980000
 is I could simply change
 the base name.

0:34:10.980000 --> 0:34:12.260000
 All right. So I changed one thing.


0:34:12.260000 --> 0:34:15.500000
 It would redeploy everything
 with a new name, right.

0:34:15.500000 --> 0:34:18.500000
 Or I could take that base name and
 I could make it a parameter.

0:34:18.500000 --> 0:34:22.560000
 So every time I redeployed this, I could
 set the value of the base name,

0:34:22.560000 --> 0:34:27.720000
 meaning I could use this template to set
 up a number of development environments,

0:34:27.720000 --> 0:34:31.380000
 a number of test environments, and
 then finally deploy it and deploy a

0:34:31.380000 --> 0:34:34.220000
 production environments as well.

0:34:34.220000 --> 0:34:37.180000
 So again, I know that was a bit
 lengthy of a demonstration.

0:34:37.180000 --> 0:34:39.480000
 There's a lot that you're
 looking at right there.

0:34:39.480000 --> 0:34:43.400000
 But also keep in mind that other than
 going back and kind of tweaking

0:34:43.400000 --> 0:34:48.520000
 it to make it my own, really, there
 were really just a few things I had

0:34:48.520000 --> 0:34:52.180000
 to add in. And also keep in mind, if
 you really wanted to, you can just

0:34:52.180000 --> 0:34:57.340000
 generate these templates
 from the portal itself.

0:34:57.340000 --> 0:34:59.320000
 Right. There's also these
 Quick Start templates.

0:34:59.320000 --> 0:35:02.560000
 Just do a search for Azure Quick Start
 and what you want to deploy, let's

0:35:02.560000 --> 0:35:05.480000
 say, a simple Windows
 virtual machine.

0:35:05.480000 --> 0:35:08.000000
 And you'll find these Quick Start templates
 that you can choose to use

0:35:08.000000 --> 0:35:13.000000
 as well. But that is the idea behind
 templates and the fact that you can

0:35:13.000000 --> 0:35:18.600000
 use them to have a very controlled and
 structured deployment and redeployment

0:35:18.600000 --> 0:35:19.680000
 of your resources.

