WEBVTT 0:00:03.020000 --> 0:00:07.520000 In this video, we're going to take a look at virtual machine scale sets. 0:00:07.520000 --> 0:00:10.380000 The topics that we're going to cover include what virtual machine scale 0:00:10.380000 --> 0:00:12.120000 sets are, some basic concepts. 0:00:12.120000 --> 0:00:17.060000 We're going to talk about auto scale, what auto scale is, why it's important. 0:00:17.060000 --> 0:00:19.220000 And then also, we'll talk about load balancing. 0:00:19.220000 --> 0:00:21.320000 All of these really go together. 0:00:21.320000 --> 0:00:25.220000 And finally, I'm going to demonstrate a virtual machine scale set. 0:00:25.220000 --> 0:00:28.360000 So let's go ahead and let's jump into this. 0:00:28.360000 --> 0:00:31.500000 When I think about a virtual machine scale set, you need to think about 0:00:31.500000 --> 0:00:34.120000 what the purpose of this is. 0:00:34.120000 --> 0:00:35.160000 And here's the idea. 0:00:35.160000 --> 0:00:36.820000 Let's say that you've got a workload. 0:00:36.820000 --> 0:00:42.620000 And I've got a workload and I want some redundancy for my workload. 0:00:42.620000 --> 0:00:45.480000 So I've got three virtual machines and let's say it's a web app. 0:00:45.480000 --> 0:00:52.160000 They're all running the same web app. 0:00:52.160000 --> 0:01:00.200000 And if I'm going to have any kind of actual availability, I want a load 0:01:00.200000 --> 0:01:03.200000 balancer in front of that and also the load balancer itself has to be 0:01:03.200000 --> 0:01:03.960000 highly available. 0:01:03.960000 --> 0:01:10.280000 And you can do this exactly like this in Azure, no problem using virtual 0:01:10.280000 --> 0:01:13.160000 machines, a load balancer, and that all works fine. 0:01:13.160000 --> 0:01:18.280000 The problem is that it's a little bit difficult to reproduce. 0:01:18.280000 --> 0:01:24.080000 So let's say that I want to go up to four instances. 0:01:24.080000 --> 0:01:30.380000 Well, not only do I need the virtual machine, I actually need the NIC 0:01:30.380000 --> 0:01:34.460000 associated with the virtual machine and I need to configure the load balancer. 0:01:34.460000 --> 0:01:38.520000 Oh, and by the way, I also need to configure whatever's going to go in, 0:01:38.520000 --> 0:01:43.880000 whatever settings are going to go into that new instance. 0:01:43.880000 --> 0:01:46.460000 And so there's a lot of manual activity. 0:01:46.460000 --> 0:01:53.180000 Also what happens when these are all maxed out, they're all at 100% across 0:01:53.180000 --> 0:01:58.480000 the board. Then I have to go and manually say, oh no, all of my machines 0:01:58.480000 --> 0:02:01.640000 are at 100% because that is exactly how I would say it. 0:02:01.640000 --> 0:02:03.900000 And I would have to manually add another one. 0:02:03.900000 --> 0:02:09.940000 Or likewise, what if we have all these machines and we're at 20% capacity. 0:02:09.940000 --> 0:02:14.300000 I could look at that and I could say, oh no, we're wasting lots of money 0:02:14.300000 --> 0:02:16.860000 because we have all these machines that aren't doing anything. 0:02:16.860000 --> 0:02:20.980000 And I'd have to go in there and I would have to manually add or remove 0:02:20.980000 --> 0:02:27.420000 instances. And so while that's absolutely possible, it's in no way optimal. 0:02:27.420000 --> 0:02:30.540000 There's a lot of manual interaction. 0:02:30.540000 --> 0:02:31.780000 This is not automated. 0:02:31.780000 --> 0:02:37.640000 It can't really be responsive to changes in load, not certainly again 0:02:37.640000 --> 0:02:38.700000 in an automated way. 0:02:38.700000 --> 0:02:42.880000 So to get around all of this, we have what's called the virtual machine 0:02:42.880000 --> 0:02:47.280000 scale set. And the virtual machine scale set simplifies the management 0:02:47.280000 --> 0:02:49.860000 of a scalable workload. 0:02:49.860000 --> 0:02:55.740000 With a virtual machine scale set, we have one resource. 0:02:55.740000 --> 0:02:58.980000 That is my virtual machine scale set. 0:02:58.980000 --> 0:03:06.820000 Now, associated with the virtual machine scale set are a set of instances. 0:03:06.820000 --> 0:03:11.740000 And these instances are in fact virtual machines. 0:03:11.740000 --> 0:03:15.940000 But they're managed, I'm going to say I for instance, they're managed 0:03:15.940000 --> 0:03:19.220000 through a single virtual machine scale set. 0:03:19.220000 --> 0:03:25.680000 And the virtual machine scale set is associated, you can draw that properly, 0:03:25.680000 --> 0:03:29.420000 with a load balancer. 0:03:29.420000 --> 0:03:31.520000 And it's automatic. 0:03:31.520000 --> 0:03:35.600000 So as instances are added to the virtual machine scale set, those instances 0:03:35.600000 --> 0:03:38.960000 are automatically properly registered with the load balancer. 0:03:38.960000 --> 0:03:42.820000 And if instances are then removed from the virtual machine scale set, 0:03:42.820000 --> 0:03:46.180000 that is also automatically updated with the load balancer. 0:03:46.180000 --> 0:03:54.160000 The virtual machine scale set also supports auto scale. 0:03:54.160000 --> 0:04:03.560000 Auto scale is actually a separate resource that monitors the virtual machine 0:04:03.560000 --> 0:04:10.160000 scale set and can be set with rules to really manage the number of instances 0:04:10.160000 --> 0:04:14.980000 that you have. The auto scale capability, the auto scale resource is actually 0:04:14.980000 --> 0:04:20.500000 the same resource that's used for virtual machine scale sets and for app 0:04:20.500000 --> 0:04:23.960000 services. So web apps and API apps, et cetera. 0:04:23.960000 --> 0:04:28.500000 And it just monitors whatever criteria, the kind of the simplest one is 0:04:28.500000 --> 0:04:32.880000 if you think about say percent of processor, but there's other criteria 0:04:32.880000 --> 0:04:39.140000 as well. And it will add instances or it will take instances away. 0:04:39.140000 --> 0:04:42.460000 Now another thing that you typically want with your virtual machine scale 0:04:42.460000 --> 0:04:47.240000 set, as I add new instances, I do not want to have to go in and manually 0:04:47.240000 --> 0:04:49.400000 configure a new instance. 0:04:49.400000 --> 0:04:52.900000 I want each instance to come up and be ready to go. 0:04:52.900000 --> 0:04:54.760000 There's a couple of different ways that you can do that. 0:04:54.760000 --> 0:05:00.620000 One, I can base my instances on a custom image. 0:05:00.620000 --> 0:05:09.020000 So I have a custom image here. 0:05:09.020000 --> 0:05:13.440000 And it has all the software, all the configurations so that anytime a 0:05:13.440000 --> 0:05:19.560000 new instance is provisioned, it automatically picks up everything it needs 0:05:19.560000 --> 0:05:21.880000 from that custom image. 0:05:21.880000 --> 0:05:29.840000 Or alternatively, I could use extensions such as the custom script extension. 0:05:29.840000 --> 0:05:40.800000 And have that automatically fire up each time a new instance is provisioned. 0:05:40.800000 --> 0:05:44.580000 So let's say for example, I've got a, I want to use a marketplace Ubuntu 0:05:44.580000 --> 0:05:50.740000 image, but I've got a script that configures my own web service on that. 0:05:50.740000 --> 0:05:53.540000 And I just want to make sure that that script gets run every time a new 0:05:53.540000 --> 0:05:57.340000 instance is fired up, then I could set that up with a custom script. 0:05:57.340000 --> 0:06:01.420000 Regardless of whether you go with some kind of extension for the automatic 0:06:01.420000 --> 0:06:05.420000 configuration at the OS level, or if you use a custom image, you really 0:06:05.420000 --> 0:06:10.980000 want to have a situation where you don't have to manually interact with 0:06:10.980000 --> 0:06:14.760000 new instances. You can set it up, for example, through the load balancers 0:06:14.760000 --> 0:06:19.760000 so that you have your NAT rules that would allow you to connect up and 0:06:19.760000 --> 0:06:24.560000 establish SSH or establish RDP with individual instances. 0:06:24.560000 --> 0:06:28.680000 And in fact, they're going to be on a virtual network. 0:06:28.680000 --> 0:06:31.300000 If you can get to that virtual network, you can also connect to them. 0:06:31.300000 --> 0:06:34.440000 But that's kind of antithetical to what you want to do. 0:06:34.440000 --> 0:06:38.260000 My goal, if I have a virtual machine scale set, is that I should never 0:06:38.260000 --> 0:06:42.180000 have to individually interact with the instances. 0:06:42.180000 --> 0:06:43.900000 I want to interact with it as a whole. 0:06:43.900000 --> 0:06:48.660000 Doesn't mean I can't in an emergency, but just conceptually I want that 0:06:48.660000 --> 0:06:52.160000 to be an automated process because that's kind of the point of having 0:06:52.160000 --> 0:06:55.240000 a scale set. All right, so that's the idea of a scale set. 0:06:55.240000 --> 0:06:59.000000 Now let's talk about some of the concepts here. 0:06:59.000000 --> 0:07:04.520000 First of all, as I mentioned, Azure AutoScale, the auto scale component 0:07:04.520000 --> 0:07:09.660000 of a virtual machine scale set is managed by this independent resource, 0:07:09.660000 --> 0:07:11.940000 if you will. It's obviously tied in. 0:07:11.940000 --> 0:07:14.780000 And it applies to three things actually right now. 0:07:14.780000 --> 0:07:17.600000 It applies, as I said, to the virtual machine scale set and to an app 0:07:17.600000 --> 0:07:21.500000 service. You might see it applied to a cloud service, which is part of 0:07:21.500000 --> 0:07:25.640000 what is called classic or the Azure service management model is the original 0:07:25.640000 --> 0:07:30.200000 Azure model. They are still around, but anything new that you would do, 0:07:30.200000 --> 0:07:33.960000 you would be doing as a virtual machine scale set or an app service. 0:07:33.960000 --> 0:07:38.580000 So that's probably not something that's going to be really central to 0:07:38.580000 --> 0:07:40.160000 the way you work in Azure. 0:07:40.160000 --> 0:07:45.500000 Or, for example, if you're looking to study for the exam, the cloud service 0:07:45.500000 --> 0:07:49.320000 would be extremely unlikely to be the right solution to anything. 0:07:49.320000 --> 0:07:52.320000 But it is there if you see it, so you'll just know what that is. 0:07:52.320000 --> 0:07:56.920000 What's interesting is that it is provided as a resource from a completely 0:07:56.920000 --> 0:07:59.780000 different resource provider, still Microsoft. 0:07:59.780000 --> 0:08:03.260000 Whereas a virtual machine scale set is provided through Microsoft. 0:08:03.260000 --> 0:08:07.480000 Compute, the auto scale is actually provided through Microsoft. 0:08:07.480000 --> 0:08:13.820000 Insights. And insights is actually just the original name of what is now 0:08:13.820000 --> 0:08:16.280000 log analytics or that kind of whole framework. 0:08:16.280000 --> 0:08:19.020000 It was kind of the foundational framework that log analytics has evolved 0:08:19.020000 --> 0:08:21.500000 from. But that's neither here nor there. 0:08:21.500000 --> 0:08:24.100000 But if you see that again, that's more one of those things that you just 0:08:24.100000 --> 0:08:27.080000 know that's what you've got. 0:08:27.080000 --> 0:08:28.800000 Now load balancing. 0:08:28.800000 --> 0:08:30.720000 Couple things with load balancing. 0:08:30.720000 --> 0:08:34.600000 First of all, you're going to integrate your virtual machine scale set 0:08:34.600000 --> 0:08:39.320000 with either a load balancer or you can actually now integrate it with 0:08:39.320000 --> 0:08:41.000000 an application gateway. 0:08:41.000000 --> 0:08:42.280000 An application gateway. 0:08:42.280000 --> 0:08:44.440000 I'm going to go with a load balancer just because honestly it's worth 0:08:44.440000 --> 0:08:46.100000 telling it forever. 0:08:46.100000 --> 0:08:50.100000 The load balancer, again, when it's integrated with a virtual machine 0:08:50.100000 --> 0:08:53.900000 scale set, it's going to automatically account for scale operations. 0:08:53.900000 --> 0:08:58.860000 You can set NAT rules for direct access to instances. 0:08:58.860000 --> 0:09:01.740000 However, I don't recommend doing that. 0:09:01.740000 --> 0:09:04.780000 Again, not that I don't recommend doing that. 0:09:04.780000 --> 0:09:06.480000 I don't recommend relying on that. 0:09:06.480000 --> 0:09:09.380000 Try to make sure that you never need to do that. 0:09:09.380000 --> 0:09:13.080000 But maybe if you need to have it for emergency purposes, you can. 0:09:13.080000 --> 0:09:18.760000 Also, you can deploy a virtual machine scale set from the portal. 0:09:18.760000 --> 0:09:21.580000 Don't. It doesn't deploy quite right. 0:09:21.580000 --> 0:09:24.400000 At least not at the time that I'm making this video. 0:09:24.400000 --> 0:09:28.720000 This has really been the case ever since you could deploy through the 0:09:28.720000 --> 0:09:32.720000 portal. What you want to do is you want to deploy via a template. 0:09:32.720000 --> 0:09:36.720000 Now, in the demonstration, I am going to generate a template using a tool. 0:09:36.720000 --> 0:09:38.580000 I'm actually going to use Visual Studio. 0:09:38.580000 --> 0:09:44.320000 I usually use Visual Studio code, but Visual Studio actually has a little 0:09:44.320000 --> 0:09:48.460000 bit better tooling, specifically for the virtual machine scale set. 0:09:48.460000 --> 0:09:54.400000 However, also know that there are quite a number of examples of virtual 0:09:54.400000 --> 0:09:55.660000 machine scale set templates. 0:09:55.660000 --> 0:10:00.120000 In fact, there's a number of the Azure Quick Starts that give you variations 0:10:00.120000 --> 0:10:02.400000 of virtual machine scale sets. 0:10:02.400000 --> 0:10:06.540000 The reality is you will likely never have to create a virtual machine 0:10:06.540000 --> 0:10:08.560000 scale set template from scratch. 0:10:08.560000 --> 0:10:12.380000 Go pick one up that's close to what you need and then just modify it as 0:10:12.380000 --> 0:10:15.380000 necessary. That is something you always want to do with virtual machine 0:10:15.380000 --> 0:10:19.840000 scale set is deploy via a template because that's going to deploy it right. 0:10:19.840000 --> 0:10:23.520000 It's just a little bit of a quirk with the system. 0:10:23.520000 --> 0:10:27.580000 With that said, I am going to demonstrate a virtual machine scale set. 0:10:27.580000 --> 0:10:29.900000 I'm going to provision a virtual machine scale set. 0:10:29.900000 --> 0:10:34.160000 Again, I'm going to provision it via a template. 0:10:34.160000 --> 0:10:37.580000 I'm going to build that template from scratch. 0:10:37.580000 --> 0:10:39.700000 I'm actually not going to do a lot of the work. 0:10:39.700000 --> 0:10:42.280000 The Visual Studio environment is going to do a lot of the work. 0:10:42.280000 --> 0:10:46.280000 By the way, I'm using Visual Studio Express which is free. 0:10:46.280000 --> 0:10:49.640000 The only thing with Visual Studio Express, unlike Visual Studio Code, 0:10:49.640000 --> 0:10:51.520000 it's not cross-platform. 0:10:51.520000 --> 0:10:57.560000 If you are working in Windows and you want a tool that has a lot of really 0:10:57.560000 --> 0:11:00.940000 Azure related capabilities, including the ability to manage templates, 0:11:00.940000 --> 0:11:03.300000 then you might want to look at Visual Studio. 0:11:03.300000 --> 0:11:06.660000 I've kind of gotten to the point though that from a tooling standpoint, 0:11:06.660000 --> 0:11:11.900000 almost always. I think I prefer Visual Studio Code. 0:11:11.900000 --> 0:11:14.460000 It's kept, frankly, just kept up a little more. 0:11:14.460000 --> 0:11:16.220000 It just doesn't have the virtual machine scale set. 0:11:16.220000 --> 0:11:19.800000 Not a big deal. Hit a button I wasn't supposed to hit there. 0:11:19.800000 --> 0:11:24.580000 All right. Let's go ahead and let's take a look at this demonstration. 0:11:24.580000 --> 0:11:29.580000 Again, what I'm going to do is I'm going to generate a template for a 0:11:29.580000 --> 0:11:32.000000 virtual machine scale set based on Linux. 0:11:32.000000 --> 0:11:40.520000 Then I am also going to inject a custom script into that virtual machine 0:11:40.520000 --> 0:11:41.960000 scale set template. 0:11:41.960000 --> 0:11:44.560000 Now, what I'm doing is I'm in Visual Studio. 0:11:44.560000 --> 0:11:48.660000 I've created what's called a Visual Studio Solution, which is a blank 0:11:48.660000 --> 0:11:53.960000 solution. I'm going to add a project to this. 0:11:53.960000 --> 0:11:58.540000 This is Visual Studio 2019. 0:11:58.540000 --> 0:12:02.420000 I'm going to add an Azure Resource Group project. 0:12:02.420000 --> 0:12:10.440000 I'm going to call this Deploy VMSS. 0:12:10.440000 --> 0:12:12.280000 Framework doesn't matter. 0:12:12.280000 --> 0:12:17.580000 It does matter is picking the right template. 0:12:17.580000 --> 0:12:22.020000 Even here, even though I am quote unquote creating this from scratch, 0:12:22.020000 --> 0:12:26.080000 I've got templates and I could also go and actually pull Quick Starts 0:12:26.080000 --> 0:12:28.620000 directly, which is pretty cool. 0:12:28.620000 --> 0:12:30.380000 That's what I want though. 0:12:30.380000 --> 0:12:31.820000 Linux virtual machine scale set. 0:12:31.820000 --> 0:12:33.060000 I'm going to click OK. 0:12:33.060000 --> 0:12:37.140000 This is going to generate the Azure template for me. 0:12:37.140000 --> 0:12:45.100000 Here is my Linux virtual machine scale set as a JSON file. 0:12:45.100000 --> 0:12:47.720000 That out of the way. 0:12:47.720000 --> 0:12:51.000000 I have a number of parameters here. 0:12:51.000000 --> 0:12:54.020000 I've got the VM size. 0:12:54.020000 --> 0:13:06.500000 I'm going to make that a D2S V3 because that is my go-to. 0:13:06.500000 --> 0:13:17.240000 I'm going to make this 16.04 LTS. 0:13:17.240000 --> 0:13:22.600000 That is kind of my go-to 16 or 18. 0:13:22.600000 --> 0:13:25.360000 My go-to Ubuntu servers. 0:13:25.360000 --> 0:13:27.500000 Name, we're good. 0:13:27.500000 --> 0:13:28.920000 Instance count, I'm good. 0:13:28.920000 --> 0:13:31.760000 Admin username, admin password, all of those. 0:13:31.760000 --> 0:13:38.660000 I'm fine with those as parameters. 0:13:38.660000 --> 0:13:42.120000 And locations. These are variables. 0:13:42.120000 --> 0:13:45.200000 Now I'm going to make some changes to this because for some reason this 0:13:45.200000 --> 0:13:51.460000 still does this with unmanaged disks and I'm going to change that. 0:13:51.460000 --> 0:13:56.740000 We're going to leave all of this in here because I'm not going to trim 0:13:56.740000 --> 0:14:01.580000 it down as I normally would. 0:14:01.580000 --> 0:14:03.200000 And that's all good. 0:14:03.200000 --> 0:14:05.800000 And so my virtual network, I've got a virtual network. 0:14:05.800000 --> 0:14:08.580000 It's got an address, it's got a subnet. 0:14:08.580000 --> 0:14:16.000000 I've got a storage account that's getting generated based on this array 0:14:16.000000 --> 0:14:18.460000 of unique strings. 0:14:18.460000 --> 0:14:22.620000 And I'll let it create all of them. 0:14:22.620000 --> 0:14:28.280000 Got a public IP address that is going to be associated with my load balancer. 0:14:28.280000 --> 0:14:35.100000 I have a load balancer and the load balancer has a NAT rule which is going 0:14:35.100000 --> 0:14:40.440000 to bring in the front end 50,000 to 50,000 in nine, mapping that to the 0:14:40.440000 --> 0:14:44.320000 back import of 22. 0:14:44.320000 --> 0:14:49.280000 And come down here and I've got my virtual machine scale set. 0:14:49.280000 --> 0:14:59.180000 Now, if I want, I could go 26, 2017, 03,30. 0:14:59.180000 --> 0:15:07.960000 Give me an API version that lets me use managed disks. 0:15:07.960000 --> 0:15:17.420000 And we're going to really pretty much take everything. 0:15:17.420000 --> 0:15:28.140000 And what I'm going to do is delete that and that should be good. 0:15:28.140000 --> 0:15:32.700000 All right. And computer name prefix, fine admin username, password, network 0:15:32.700000 --> 0:15:35.740000 profile. Now the network profile for a virtual machine scale set is different 0:15:35.740000 --> 0:15:41.500000 than the network profile for a virtual machine because rather than tying 0:15:41.500000 --> 0:15:48.420000 to an existing NIC, you're actually going to define the entire network 0:15:48.420000 --> 0:15:52.500000 interface configuration in the network profile. 0:15:52.500000 --> 0:15:57.680000 And then it's got a diagnostics extension which is quite well extensive. 0:15:57.680000 --> 0:16:01.560000 All right. So this is actually, you can see it's 257 lines until we get 0:16:01.560000 --> 0:16:06.780000 there. And then it is a good bit more from 257 to 519. 0:16:06.780000 --> 0:16:10.300000 It's all just the diagnostics extension. 0:16:10.300000 --> 0:16:12.920000 Now, in addition to that, I'm going to add a few more things. 0:16:12.920000 --> 0:16:18.800000 I'm going to go over here to my outline and I'm going to add a new resource. 0:16:18.800000 --> 0:16:23.540000 And what I want to do is add an auto scale resource. 0:16:23.540000 --> 0:16:30.720000 And this is going to be demo auto scale because I have no creativity. 0:16:30.720000 --> 0:16:32.740000 I'm simply going to add that. 0:16:32.740000 --> 0:16:40.380000 And what that does is it sets up auto scale rules. 0:16:40.380000 --> 0:16:46.660000 And my auto scale rules, I'm using this over, there we go. 0:16:46.660000 --> 0:16:50.000000 I see that the auto scale rules come from Microsoft Insights, auto scale 0:16:50.000000 --> 0:16:51.540000 settings as I said. 0:16:51.540000 --> 0:16:54.780000 It, of course, depends on the virtual machine scale set. 0:16:54.780000 --> 0:16:59.180000 And it goes down and just sets some rules. 0:16:59.180000 --> 0:17:00.980000 So this goes between one and ten. 0:17:00.980000 --> 0:17:03.620000 We're going to save between one and three. 0:17:03.620000 --> 0:17:07.400000 And then it's got metrics. 0:17:07.400000 --> 0:17:10.740000 And so it's looking for the processor, which is a variable. 0:17:10.740000 --> 0:17:13.860000 And it's just looking, if it's greater than 80, it's going to scale up. 0:17:13.860000 --> 0:17:16.940000 And if it's under, I think what is it, 60, it's going to scale down. 0:17:16.940000 --> 0:17:20.060000 There's just basic rules that it's putting in place. 0:17:20.060000 --> 0:17:21.500000 And that's fine. 0:17:21.500000 --> 0:17:28.400000 And then I want to do one other thing, which is I'm going to add a custom 0:17:28.400000 --> 0:17:32.140000 script for Linux VMSs. 0:17:32.140000 --> 0:17:42.100000 And we'll say demo scripts. 0:17:42.100000 --> 0:17:45.460000 Apparently it didn't want to do demo script. 0:17:45.460000 --> 0:17:55.980000 Let's try that again. 0:17:55.980000 --> 0:17:59.080000 And I hit cancel instead of add. 0:17:59.080000 --> 0:18:01.960000 All right. Now I did. 0:18:01.960000 --> 0:18:02.840000 And it just didn't pick it up. 0:18:02.840000 --> 0:18:04.440000 That's intriguing. 0:18:04.440000 --> 0:18:14.520000 One moment. Delete that. 0:18:14.520000 --> 0:18:15.760000 And we'll try this again. 0:18:15.760000 --> 0:18:18.200000 Hadn't had that one happen to me before. 0:18:18.200000 --> 0:18:29.740000 I really wanted to show you how you can add a script to a virtual machine 0:18:29.740000 --> 0:18:33.580000 scale set. All right. 0:18:33.580000 --> 0:18:37.200000 Well, this does not appear to want to add it in. 0:18:37.200000 --> 0:18:41.780000 That is an order added in twice. 0:18:41.780000 --> 0:18:45.060000 All right. We're going to pause here for a moment while I figure out why 0:18:45.060000 --> 0:18:46.720000 it's, oh, there it is. 0:18:46.720000 --> 0:18:47.580000 It did add it in twice. 0:18:47.580000 --> 0:18:49.060000 We're not going to pause. 0:18:49.060000 --> 0:18:51.700000 It just was lying to me. 0:18:51.700000 --> 0:18:54.080000 Okay. There we go. 0:18:54.080000 --> 0:18:54.760000 We'll take that out. 0:18:54.760000 --> 0:18:56.820000 So it's only going in there once. 0:18:56.820000 --> 0:18:59.740000 And now it has this file URIs. 0:18:59.740000 --> 0:19:03.820000 And normally what it does, what this tool does, is it actually generates 0:19:03.820000 --> 0:19:06.560000 a script file for you that you could go in and you could set up. 0:19:06.560000 --> 0:19:10.160000 But I already have a script file. 0:19:10.160000 --> 0:19:15.860000 So what I want to do is I want to actually pick up that script file. 0:19:15.860000 --> 0:19:21.380000 Or at least pick up the URL for that script file. 0:19:21.380000 --> 0:19:26.880000 That out of the way. 0:19:26.880000 --> 0:19:32.120000 And replace file UR with an existing script file. 0:19:32.120000 --> 0:19:37.320000 And this is just a file that installs a very simple web server. 0:19:37.320000 --> 0:19:40.800000 It's just a Python script web server. 0:19:40.800000 --> 0:19:52.500000 And then I want that to run just this bit right here. 0:19:52.500000 --> 0:20:02.420000 All right. And I have now set up a fairly complex. 0:20:02.420000 --> 0:20:05.480000 Oh, let's see. Are we good there? 0:20:05.480000 --> 0:20:08.900000 Nope. I didn't delete the demo script. 0:20:08.900000 --> 0:20:12.320000 Oh, I deleted one. 0:20:12.320000 --> 0:20:13.780000 So I'd done that like three times. 0:20:13.780000 --> 0:20:15.700000 There we go. Now we're good. 0:20:15.700000 --> 0:20:17.920000 All right. Third time's charm. 0:20:17.920000 --> 0:20:20.340000 All right. But I've got a demo script that I've added. 0:20:20.340000 --> 0:20:29.080000 It already added the ability to capture diagnostic data. 0:20:29.080000 --> 0:20:30.740000 I've added auto scale. 0:20:30.740000 --> 0:20:34.680000 And so I've got everything that I want for this particular deployment. 0:20:34.680000 --> 0:20:38.000000 And this tool actually lets me deploy directly from here. 0:20:38.000000 --> 0:20:40.620000 So I'm going to go ahead and deploy. 0:20:40.620000 --> 0:20:44.320000 I have to wait for this to come up with my subscription. 0:20:44.320000 --> 0:20:47.080000 There we go. That is the subscription that I want. 0:20:47.080000 --> 0:20:49.300000 Create a new deployment. 0:20:49.300000 --> 0:20:59.220000 Putting it as always in the east us. 0:20:59.220000 --> 0:21:06.260000 Now the next thing I'm going to do, it actually has a template parameter 0:21:06.260000 --> 0:21:09.460000 file. I'm going to go ahead and edit the parameters. 0:21:09.460000 --> 0:21:12.660000 And we're going to go in and give this a name of. 0:21:12.660000 --> 0:21:18.740000 I need a demo of VMSS. 0:21:18.740000 --> 0:21:21.620000 I want two instances. 0:21:21.620000 --> 0:21:24.420000 Admin username of student. 0:21:24.420000 --> 0:21:26.640000 I'm not going to put in the admin password. 0:21:26.640000 --> 0:21:29.960000 Now what I would normally do, actually I'm going to do this just to show 0:21:29.960000 --> 0:21:32.860000 you. Totally off topic, but pretty cool. 0:21:32.860000 --> 0:21:35.260000 I don't want to put a sensitive piece of data in here. 0:21:35.260000 --> 0:21:43.780000 I've actually got a key vault setup where I have an admin password in 0:21:43.780000 --> 0:21:47.800000 my key vault. And this tool actually let me go and just pick that up. 0:21:47.800000 --> 0:21:54.980000 And it's going to inject the right markup so that I pull my password out 0:21:54.980000 --> 0:21:57.620000 of that key vault. 0:21:57.620000 --> 0:22:00.640000 So the password is never in plain text. 0:22:00.640000 --> 0:22:02.900000 And then I deploy. 0:22:02.900000 --> 0:22:05.860000 And once I start deploying, I'm going to wait for a little while. 0:22:05.860000 --> 0:22:08.380000 It's going to take a few minutes to come back and we'll see if we have 0:22:08.380000 --> 0:22:09.980000 a virtual machine scale set. 0:22:09.980000 --> 0:22:17.840000 All right, if we look at this, we can see that this was a swimming success. 0:22:17.840000 --> 0:22:19.060000 Look here, it says succeeded. 0:22:19.060000 --> 0:22:23.580000 Now I'm going to pull back the curtain and be fully forthright with you 0:22:23.580000 --> 0:22:26.500000 because otherwise would not be a good thing. 0:22:26.500000 --> 0:22:31.000000 It's entirely possible that this failed the first time and then was very 0:22:31.000000 --> 0:22:34.360000 stubborn about me getting it fixed until such time as I realized what 0:22:34.360000 --> 0:22:39.080000 was happening. And I think it's a worthwhile exercise for you to see what 0:22:39.080000 --> 0:22:44.840000 actually did happen and why it took a while for that to actually complete 0:22:44.840000 --> 0:22:48.480000 successfully. All right, if I go down here to my definition of the virtual 0:22:48.480000 --> 0:22:55.020000 machine scale set and if I go to, let's collapse a bunch of stuff, if 0:22:55.020000 --> 0:22:59.880000 I go to my script where I was deploying the script, when I first deployed 0:22:59.880000 --> 0:23:02.620000 it, I forgot to put the SH in there. 0:23:02.620000 --> 0:23:06.160000 And so when it deployed and it tried to deploy the extension, I got an 0:23:06.160000 --> 0:23:09.060000 error. And then I fixed it, I tried to deploy again, I kept getting the 0:23:09.060000 --> 0:23:16.120000 same error. I was getting the same error because even though the actual 0:23:16.120000 --> 0:23:19.400000 template and deployment of template is what we call a dampenant and that 0:23:19.400000 --> 0:23:23.720000 you can redeploy it and it will be fine, because of the way that extensions 0:23:23.720000 --> 0:23:28.060000 work, that extension was still there and it just kept trying to rerun 0:23:28.060000 --> 0:23:30.260000 the same extension that was already set up incorrectly. 0:23:30.260000 --> 0:23:33.900000 So I just went and I deployed it after this fix, I deployed it somewhere 0:23:33.900000 --> 0:23:37.220000 else. And so now there's a slightly different name to the resource group 0:23:37.220000 --> 0:23:39.360000 and to the actual virtual machine scale set. 0:23:39.360000 --> 0:23:43.320000 But that was the only thing that changed from when I walked through it 0:23:43.320000 --> 0:23:44.840000 initially and now. 0:23:44.840000 --> 0:23:46.140000 But I think that's worthwhile. 0:23:46.140000 --> 0:23:47.440000 I have to make sure you get that right. 0:23:47.440000 --> 0:23:51.340000 Also with that redeployability of templates when things don't go right, 0:23:51.340000 --> 0:23:54.000000 this is one of those little cases where it's not exactly the case. 0:23:54.000000 --> 0:23:56.780000 What I could have done was I could have actually gone into the virtual 0:23:56.780000 --> 0:24:02.260000 machine scale set and deleted that failed extension and then redeployed 0:24:02.260000 --> 0:24:03.680000 it would have been fine. 0:24:03.680000 --> 0:24:06.780000 But that actually would have taken longer than just redeploying the whole 0:24:06.780000 --> 0:24:08.460000 thing. So that's what I did. 0:24:08.460000 --> 0:24:10.880000 And it has now deployed properly. 0:24:10.880000 --> 0:24:15.660000 So what I want to do is take you over to the resource group that this 0:24:15.660000 --> 0:24:17.040000 all deployed into. 0:24:17.040000 --> 0:24:22.460000 So here's my resource group and I've got some, really the majority of 0:24:22.460000 --> 0:24:24.440000 what you see here are the storage accounts. 0:24:24.440000 --> 0:24:27.320000 Now I will tell you, by and large, these storage accounts are not actually 0:24:27.320000 --> 0:24:34.040000 necessary because I made this a managed disk system. 0:24:34.040000 --> 0:24:38.360000 But one of these holds the diagnostic data that's used for auto scale. 0:24:38.360000 --> 0:24:40.520000 So I just let it run as is, right? 0:24:40.520000 --> 0:24:44.440000 But I could have actually eliminated that had one storage account, one 0:24:44.440000 --> 0:24:47.900000 virtual machine scale set, load balancer, public IP address and virtual 0:24:47.900000 --> 0:24:52.960000 network. And I'm going to take a look at my virtual machine scale set. 0:24:52.960000 --> 0:24:57.280000 And there's generally not a lot that you're going to do with this. 0:24:57.280000 --> 0:25:00.320000 Right now I've got one instance running. 0:25:00.320000 --> 0:25:04.220000 Easy enough. Now I could go into the instance. 0:25:04.220000 --> 0:25:06.980000 You actually can get some instance information. 0:25:06.980000 --> 0:25:11.600000 So there is some drill down capability, including connecting to it via 0:25:11.600000 --> 0:25:13.980000 serial console using the bastion. 0:25:13.980000 --> 0:25:17.700000 If you have that set up or going in with boot diagnostics. 0:25:17.700000 --> 0:25:19.440000 But I don't want to do any of that again. 0:25:19.440000 --> 0:25:23.840000 I want to kind of stay away from my instance management. 0:25:23.840000 --> 0:25:25.400000 I can go to my scaling. 0:25:25.400000 --> 0:25:27.980000 This is where I set up my auto scale rule. 0:25:27.980000 --> 0:25:31.420000 Right? You can see it's got a scale up when it's over 80, scale down over 0:25:31.420000 --> 0:25:38.820000 60. And if I go to run history, it actually auto scaled down, which is 0:25:38.820000 --> 0:25:41.320000 kind of interesting because it was just deployed. 0:25:41.320000 --> 0:25:44.960000 But it auto scaled down because my setting for the virtual machine scale 0:25:44.960000 --> 0:25:47.420000 set was to have two instances. 0:25:47.420000 --> 0:25:51.360000 But the auto scale actually sets up a default of one instance. 0:25:51.360000 --> 0:25:53.360000 So I did that intentionally. 0:25:53.360000 --> 0:25:54.720000 I'm not going to go through scaling this. 0:25:54.720000 --> 0:25:57.440000 But you can see where that auto scale does kick in. 0:25:57.440000 --> 0:26:00.440000 It does override other settings, which is pretty cool. 0:26:00.440000 --> 0:26:05.360000 And other things that you can set up, I can actually add data disks. 0:26:05.360000 --> 0:26:07.940000 And that's kind of interesting. 0:26:07.940000 --> 0:26:13.780000 Just some settings in terms of your computer name prefix, administrator, 0:26:13.780000 --> 0:26:18.900000 et cetera. And you can change the size and just a number of other things 0:26:18.900000 --> 0:26:21.380000 you can do. But we do have this thing deployed. 0:26:21.380000 --> 0:26:25.180000 Now, I did also, since I kind of had to take break anyways and fix that, 0:26:25.180000 --> 0:26:29.100000 I did modify the load balancer. 0:26:29.100000 --> 0:26:31.900000 So the load balancer came in with an inbound NAT rule. 0:26:31.900000 --> 0:26:33.880000 I am going to show you the NAT rule. 0:26:33.880000 --> 0:26:40.160000 This sets up so that incoming NAT is going to go over 50,000. 0:26:40.160000 --> 0:26:41.300000 We'll go to the first instance. 0:26:41.300000 --> 0:26:45.020000 If I change the incoming IP to 50,000 in one, it would go to the second 0:26:45.020000 --> 0:26:48.880000 instance. Now, how does that actually work? 0:26:48.880000 --> 0:26:50.660000 It's actually pretty cool. 0:26:50.660000 --> 0:26:53.300000 I'm going to pull over. 0:26:53.300000 --> 0:26:55.140000 I'm in Windows 10. 0:26:55.140000 --> 0:26:57.160000 And one of the nice things with Windows 10 now is it actually has a built 0:26:57.160000 --> 0:27:01.220000 -in SSH client. And I can go to SSH. 0:27:01.220000 --> 0:27:07.180000 And then student is the name of the admin account that I gave in there. 0:27:07.180000 --> 0:27:12.280000 And then this is actually the DNS name that I associated with the load 0:27:12.280000 --> 0:27:16.260000 balancer. And I'm going to say that I'm going to connect over 40,000. 0:27:16.260000 --> 0:27:20.200000 And when I do that, it's going to ask me for the password that I used 0:27:20.200000 --> 0:27:24.080000 that's going to be the same password on all of the machines. 0:27:24.080000 --> 0:27:26.780000 And I am now into one of the instances. 0:27:26.780000 --> 0:27:28.700000 In fact, I'm into the only instance. 0:27:28.700000 --> 0:27:30.160000 Now, I can do things, for example. 0:27:30.160000 --> 0:27:32.700000 I could go, should be here. 0:27:32.700000 --> 0:27:35.280000 P.S. Ox, I'm going to grep web. 0:27:35.280000 --> 0:27:36.380000 That's my web server. 0:27:36.380000 --> 0:27:39.060000 I can see that the web server is running. 0:27:39.060000 --> 0:27:40.260000 And that's that first line. 0:27:40.260000 --> 0:27:42.600000 If you're not a Linux person, it doesn't really matter. 0:27:42.600000 --> 0:27:43.980000 So that means that cool. 0:27:43.980000 --> 0:27:45.700000 It is actually running that. 0:27:45.700000 --> 0:27:53.900000 It is scalable. And if I go to my public IP address, and if I grab the 0:27:53.900000 --> 0:27:56.480000 DNS name, I could also use the IP address. 0:27:56.480000 --> 0:27:58.780000 But since I gave it a DNS name. 0:27:58.780000 --> 0:28:05.440000 And if I come over here and run this, it should come up with a little 0:28:05.440000 --> 0:28:07.900000 bit. There's a moment or two. 0:28:07.900000 --> 0:28:11.020000 I know it did when I ran this previously. 0:28:11.020000 --> 0:28:15.700000 It's an extremely not well defined web app. 0:28:15.700000 --> 0:28:19.220000 And so sometimes it gets a little bit confused. 0:28:19.220000 --> 0:28:24.120000 So what I'm going to do here is pretend like it just ran. 0:28:24.120000 --> 0:28:27.380000 That I ran, it's the same URL. 0:28:27.380000 --> 0:28:32.200000 And what you see there is actually the instance name that it's running 0:28:32.200000 --> 0:28:36.620000 on. And as I get new instances, of course, those numbers are going to 0:28:36.620000 --> 0:28:39.760000 grow. Now, I want to show you something else. 0:28:39.760000 --> 0:28:40.460000 Hey, there you go. 0:28:40.460000 --> 0:28:42.160000 It took a while, but it did come up. 0:28:42.160000 --> 0:28:45.100000 I want to show you something else with virtual machine scale sets because 0:28:45.100000 --> 0:28:46.900000 I didn't really talk about the limits. 0:28:46.900000 --> 0:28:53.780000 So I'm going to go azure, VMSS limits. 0:28:53.780000 --> 0:28:58.500000 And I'm actually going to go ahead and go to the azure subscription limits. 0:28:58.500000 --> 0:29:00.960000 First, we'll pop that one up. 0:29:00.960000 --> 0:29:04.360000 And I'm also going to pop up the scale set overview. 0:29:04.360000 --> 0:29:11.260000 I'll go here because I don't think this one has really great info on the 0:29:11.260000 --> 0:29:13.780000 virtual machine scale set if I recall. 0:29:13.780000 --> 0:29:16.860000 All right. Well, there we go. 0:29:16.860000 --> 0:29:17.780000 It does, in fact. 0:29:17.780000 --> 0:29:20.780000 Maximum number of VMs in a scale set. 0:29:20.780000 --> 0:29:26.540000 You can have up to 1,000 VMs per scale set. 0:29:26.540000 --> 0:29:30.040000 Maximum number of VMs based on a custom image, but you can only go up 0:29:30.040000 --> 0:29:34.280000 to 600 if you're using a custom image. 0:29:34.280000 --> 0:29:38.840000 Now, you can also have up to 2,000 scale sets in a region. 0:29:38.840000 --> 0:29:43.100000 So if you were to combine this with some load balancing, then you're talking 0:29:43.100000 --> 0:29:48.300000 about conceptually up to 2 million instances that could be running a workload 0:29:48.300000 --> 0:29:50.840000 in a region through scale sets. 0:29:50.840000 --> 0:29:53.680000 So you are talking about something that has the potential for massive 0:29:53.680000 --> 0:29:58.100000 scale. I did want to show you that there is a difference in the number 0:29:58.100000 --> 0:30:03.660000 of instances that you have, whether you're using a marketplace image or 0:30:03.660000 --> 0:30:07.780000 a custom image. And so this would suggest that a marketplace image would 0:30:07.780000 --> 0:30:09.120000 be the better solution. 0:30:09.120000 --> 0:30:14.180000 However, keep in mind when you use a marketplace image, you're also going 0:30:14.180000 --> 0:30:18.480000 to have to inject whatever that configuration is through some extension. 0:30:18.480000 --> 0:30:21.380000 And that's going to be added time on scale operations. 0:30:21.380000 --> 0:30:26.700000 And in general, keep in mind that when you auto scale, that's not an instance. 0:30:26.700000 --> 0:30:30.400000 It's going to provision a new underlying virtual machine. 0:30:30.400000 --> 0:30:31.660000 It's going to configure it. 0:30:31.660000 --> 0:30:33.320000 And then it's going to become available. 0:30:33.320000 --> 0:30:37.620000 So understand that auto scale with a virtual machine scale set is not 0:30:37.620000 --> 0:30:39.780000 an instance. It's not an instant. 0:30:39.780000 --> 0:30:44.440000 You want to optimize the load time for your virtual machine so that your 0:30:44.440000 --> 0:30:47.020000 scale set can be as responsive as possible. 0:30:47.020000 --> 0:30:51.700000 But in any case, that's really the concept of virtual machine scale sets. 0:30:51.700000 --> 0:30:55.060000 You've seen what they are, how they work, what their components are, and 0:30:55.060000 --> 0:30:57.980000 an example of a virtual machine scale set in action.