1 00:00:00,740 --> 00:00:04,340 In this demonstration, let's work with Hyper‑V VHD files. 2 00:00:04,340 --> 00:00:06,720 And we're right in medias res. 3 00:00:06,720 --> 00:00:08,620 In other words, we're right in the middle of things. 4 00:00:08,620 --> 00:00:11,550 On my server here, I'm in Hyper‑V. 5 00:00:11,550 --> 00:00:16,040 I'm looking at the settings for the server1 VM on my ARC2 host. 6 00:00:16,040 --> 00:00:19,820 This is the server and VM we've been working with historically. 7 00:00:19,820 --> 00:00:23,440 And in the previous module we worked with checkpoints, 8 00:00:23,440 --> 00:00:27,370 and I wanted to take you into the VM settings to inspect the hard drive and 9 00:00:27,370 --> 00:00:32,270 particularly notice that the path ends in an avhdx extension. 10 00:00:32,270 --> 00:00:36,050 That's an indication that we're working on a checkpoint 11 00:00:36,050 --> 00:00:38,270 disk rather than the parent disk, 12 00:00:38,270 --> 00:00:42,520 and it's not going to allow us to edit to do things like resize the disk, 13 00:00:42,520 --> 00:00:44,540 change its orientation, etc. 14 00:00:44,540 --> 00:00:46,410 because checkpoints exist. 15 00:00:46,410 --> 00:00:50,840 So what I'm actually going to do is temporarily disabled checkpoints, 16 00:00:50,840 --> 00:00:53,270 and let me come back to Hyper‑V Manager, 17 00:00:53,270 --> 00:00:56,800 and let me delete the checkpoint subtree for this machine. 18 00:00:56,800 --> 00:00:59,410 And notice it says Merge in Progress. 19 00:00:59,410 --> 00:01:03,310 So now we should find if we go back to VMConnect here and open up 20 00:01:03,310 --> 00:01:06,240 Settings and come down to the Hard Drive again, 21 00:01:06,240 --> 00:01:08,460 we're using the VHDX file. 22 00:01:08,460 --> 00:01:11,900 In fact, I need this path for the other stuff we're going to do. 23 00:01:11,900 --> 00:01:16,970 Let's assume that we're going to migrate this machine up into Azure as an image, 24 00:01:16,970 --> 00:01:18,850 as an operating system image. 25 00:01:18,850 --> 00:01:21,450 Now, normally, hopefully you know this, but if not, 26 00:01:21,450 --> 00:01:24,780 but normally the last thing you do before you create an OS 27 00:01:24,780 --> 00:01:27,360 image is that you generalize the environment. 28 00:01:27,360 --> 00:01:29,780 In other words, you remove the hostname, 29 00:01:29,780 --> 00:01:32,460 IP address, security IDs, 30 00:01:32,460 --> 00:01:37,100 anything that you don't want to duplicate because the idea with an OS image, 31 00:01:37,100 --> 00:01:41,760 we may create a number of running VM instances off the single image. 32 00:01:41,760 --> 00:01:45,240 So we would open up, or what I would do is open up Run, 33 00:01:45,240 --> 00:01:48,070 type sysprep, and go to the Windows, C, Windows, 34 00:01:48,070 --> 00:01:50,450 System32, Sysprep directory, 35 00:01:50,450 --> 00:01:53,900 and I would choose Enter System Out‑of‑Box Experience, 36 00:01:53,900 --> 00:01:58,290 Generalize, and then at Shutdown we're going to shut down the machine. 37 00:01:58,290 --> 00:02:01,590 I'm not actually going to do that on server1 because I want to 38 00:02:01,590 --> 00:02:04,780 continue to use this VM through the rest of the training, 39 00:02:04,780 --> 00:02:09,060 but let's assume that that's what I've done because our goal ultimately is 40 00:02:09,060 --> 00:02:13,890 to have images hosted in our Azure subscription to build new VMs that look 41 00:02:13,890 --> 00:02:16,610 initially exactly like our server1 right here, 42 00:02:16,610 --> 00:02:16,810 okay? 43 00:02:16,810 --> 00:02:20,830 Now I can tell you that when I created this disk, 44 00:02:20,830 --> 00:02:24,940 it's a generation 2 dynamically expanding disk, 45 00:02:24,940 --> 00:02:28,030 and we can do generation 2 disks in Azure, 46 00:02:28,030 --> 00:02:32,500 but we have to make a fixed size, and we also need it to be VHD, 47 00:02:32,500 --> 00:02:33,650 not VHDX. 48 00:02:33,650 --> 00:02:36,870 So, you know what I'm going to do, bring out Visual Studio Code, 49 00:02:36,870 --> 00:02:42,130 and I have my trusty admin VM PowerShell script that's in the exercise files, 50 00:02:42,130 --> 00:02:46,000 and here we can see on line 7 we can make use of the 51 00:02:46,000 --> 00:02:51,280 Convert‑VHD command to accept that VHDX as its input, 52 00:02:51,280 --> 00:02:53,750 and then we specify a destination path. 53 00:02:53,750 --> 00:02:58,020 Let me make a directory called vm‑upload, 54 00:02:58,020 --> 00:03:01,620 and then we can change the destination path to c:\vm‑upload. 55 00:03:01,620 --> 00:03:06,240 And notice that I'm changing the VHDType here to Fixed. 56 00:03:06,240 --> 00:03:07,910 That's really important to do. 57 00:03:07,910 --> 00:03:10,170 So let me right‑click Run Selection. 58 00:03:10,170 --> 00:03:13,850 Whoops, it expected a full path, not just a directory path. 59 00:03:13,850 --> 00:03:17,240 Reading that red error output from PowerShell is a 60 00:03:17,240 --> 00:03:19,740 highly educational experience for sure. 61 00:03:19,740 --> 00:03:20,470 So there you go. 62 00:03:20,470 --> 00:03:22,990 So I'm going to just do C:\vm‑upload\server1.vhd, 63 00:03:22,990 --> 00:03:26,900 so let me right‑click and run that selection. 64 00:03:26,900 --> 00:03:31,110 Ah, okay, we can see over here there's not enough space on the disk. 65 00:03:31,110 --> 00:03:32,450 All right, well you see the idea. 66 00:03:32,450 --> 00:03:36,240 Can't do anything about that right now, so let's just continue. 67 00:03:36,240 --> 00:03:39,860 Let's assume that that conversion process finished. 68 00:03:39,860 --> 00:03:40,380 Really, 69 00:03:40,380 --> 00:03:44,590 all we would have at the end of the process is a server1 VHD 70 00:03:44,590 --> 00:03:46,760 file that's in the vm‑upload directory, okay? 71 00:03:46,760 --> 00:03:52,390 And at that point we would have a generation 2 VHD that's fixed size, 72 00:03:52,390 --> 00:03:54,430 and therefore, it's ready for upload to Azure. 73 00:03:54,430 --> 00:03:56,960 Now how do you upload your VHDs? 74 00:03:56,960 --> 00:03:58,310 There's so many different ways, 75 00:03:58,310 --> 00:04:01,940 but I wanted to show you a couple just in case there's any references 76 00:04:01,940 --> 00:04:04,610 on the exam that might go to that level of depth. 77 00:04:04,610 --> 00:04:10,030 One would be for you to install the AzCopy executable This is an EXE on Windows, 78 00:04:10,030 --> 00:04:15,390 it's available as just an executable file on macOS and Linux as well, 79 00:04:15,390 --> 00:04:19,230 and it's a command‑line utility where you can do blob copies, 80 00:04:19,230 --> 00:04:22,910 binary large object copies, to Azure, from Azure, 81 00:04:22,910 --> 00:04:24,120 between Azure locations. 82 00:04:24,120 --> 00:04:27,240 And once you install AzCopy on your machine, 83 00:04:27,240 --> 00:04:31,220 I give you some notes in the exercise files so you can learn all of the steps, 84 00:04:31,220 --> 00:04:34,410 you have to authenticate to Azure in one way or the other. 85 00:04:34,410 --> 00:04:36,800 One way would be to interactively sign in. 86 00:04:36,800 --> 00:04:38,790 You can use AzCopy interactively. 87 00:04:38,790 --> 00:04:42,210 Another would be in your storage account in Azure, 88 00:04:42,210 --> 00:04:45,780 create what's called a SAS token, or a SAS URI, 89 00:04:45,780 --> 00:04:49,050 and this is going to give you time‑limited access 90 00:04:49,050 --> 00:04:52,980 into your Azure storage account, and that's what I have in this example. 91 00:04:52,980 --> 00:05:00,430 So we would do an AzCopy copy, and we would do C:\vm‑upload\server1.vhd. 92 00:05:00,430 --> 00:05:04,170 Then we would need to get a SAS token from our storage account. 93 00:05:04,170 --> 00:05:05,760 I'll show you how to do that in just a moment. 94 00:05:05,760 --> 00:05:08,280 And then we have to specify the blob‑type. 95 00:05:08,280 --> 00:05:11,210 There's a few types of blobs that you have in Azure. 96 00:05:11,210 --> 00:05:14,670 PageBlob is what you need to remember for VHDs. 97 00:05:14,670 --> 00:05:17,980 The blob type that's used with regular file data is 98 00:05:17,980 --> 00:05:20,580 normally called a block blob, okay? 99 00:05:20,580 --> 00:05:22,670 So AzCopy is one way to go. 100 00:05:22,670 --> 00:05:26,530 Another way to go, if you just want to use a desktop application, 101 00:05:26,530 --> 00:05:29,240 is to use Microsoft Azure Storage Explorer. 102 00:05:29,240 --> 00:05:32,660 This is a free cross‑platform desktop application, 103 00:05:32,660 --> 00:05:34,470 runs on Windows, Mac, and Linux. 104 00:05:34,470 --> 00:05:39,440 Let's go over to, let's go to the user menu and sign into our subscription. 105 00:05:39,440 --> 00:05:43,830 I'll sign in at the Subscription level into the Azure public cloud, 106 00:05:43,830 --> 00:05:47,610 and then depending upon my role‑based access control 107 00:05:47,610 --> 00:05:50,910 authorization in that subscription, I can then choose, 108 00:05:50,910 --> 00:05:52,640 first of all, which subscriptions. 109 00:05:52,640 --> 00:05:55,310 I'll just choose my Sponsorship subscription. 110 00:05:55,310 --> 00:05:57,060 Then I'll click Open Explorer, 111 00:05:57,060 --> 00:06:01,960 and momentarily Azure will enumerate the storage accounts that I have access to. 112 00:06:01,960 --> 00:06:02,790 And there's other stuff. 113 00:06:02,790 --> 00:06:07,050 Notice that you can directly get access to Azure VM disk storage. 114 00:06:07,050 --> 00:06:08,840 I don't want to focus on that now though. 115 00:06:08,840 --> 00:06:13,140 I want to focus on let's say in my timstorage001 116 00:06:13,140 --> 00:06:15,730 storage account I have my blob service, 117 00:06:15,730 --> 00:06:21,460 and the blob service is just a non‑hierarchical collection of files or objects. 118 00:06:21,460 --> 00:06:23,030 You create a container here. 119 00:06:23,030 --> 00:06:24,810 In fact, let me click Load more. 120 00:06:24,810 --> 00:06:27,960 I've got a container called vhd in here already. 121 00:06:27,960 --> 00:06:32,350 And let's say I want to be able to upload that vhd from my local 122 00:06:32,350 --> 00:06:36,380 system server1.vhd up into my storage account. 123 00:06:36,380 --> 00:06:39,540 What I can do is right‑click the vhd container, 124 00:06:39,540 --> 00:06:42,160 and I can get a shared access signature, 125 00:06:42,160 --> 00:06:45,610 which, like I said, is going to give time‑limited access. 126 00:06:45,610 --> 00:06:50,640 In this case it's defaulting to 24 hours, but in this case I would do Read. 127 00:06:50,640 --> 00:06:52,820 I would want to add additional permissions. 128 00:06:52,820 --> 00:06:56,250 I'm not sure exactly what I need here, so I'm just going to do Read, 129 00:06:56,250 --> 00:06:57,300 add, Create, Write, 130 00:06:57,300 --> 00:07:02,580 and then you authenticate that HTTPS URL with one of the two API 131 00:07:02,580 --> 00:07:05,070 keys that you get in your Azure storage account. 132 00:07:05,070 --> 00:07:07,730 It doesn't matter whether you choose one or two. 133 00:07:07,730 --> 00:07:11,070 Now the hazard with shared access signatures is that anybody 134 00:07:11,070 --> 00:07:15,190 who has that URL can use it if you're within that time period 135 00:07:15,190 --> 00:07:17,140 because it's a portable unit. 136 00:07:17,140 --> 00:07:19,410 So if I go back here into PowerShell, 137 00:07:19,410 --> 00:07:22,650 what I'd want to do is paste in that SAS token here, 138 00:07:22,650 --> 00:07:25,830 and so now this would instruct AzCopy to take my 139 00:07:25,830 --> 00:07:29,360 server1.vhd and put it into that container, 140 00:07:29,360 --> 00:07:35,240 the VHD container, authenticating to Azure using the rest of the token here. 141 00:07:35,240 --> 00:07:36,400 So that's one way to go. 142 00:07:36,400 --> 00:07:40,570 Another way is to do the upload directly from within Storage Explorer. 143 00:07:40,570 --> 00:07:42,460 You saw right here there's an Upload. 144 00:07:42,460 --> 00:07:46,730 We could just do an Upload Files to bring the file over that way. 145 00:07:46,730 --> 00:07:48,790 And something that I think is pretty cool, 146 00:07:48,790 --> 00:07:50,920 at least worthy of letting you know about, 147 00:07:50,920 --> 00:07:54,230 if we go to Edit, Settings, and we come down to Transfers, 148 00:07:54,230 --> 00:07:57,600 notice that AzCopy is built right into Storage Explorer. 149 00:07:57,600 --> 00:08:00,240 You might think, well, what's so good about AzCopy? 150 00:08:00,240 --> 00:08:05,040 Well, AzCopy is a great control over file transfers to, 151 00:08:05,040 --> 00:08:05,370 from, 152 00:08:05,370 --> 00:08:08,000 and within Azure because you can do things like maximum 153 00:08:08,000 --> 00:08:11,200 transfer rate to make sure that if you're uploading to Azure 154 00:08:11,200 --> 00:08:12,860 you don't chew up all of your bandwidth. 155 00:08:12,860 --> 00:08:16,810 You can do concurrency both in the network and at the file levels. 156 00:08:16,810 --> 00:08:18,170 You can do buffers. 157 00:08:18,170 --> 00:08:19,250 Very importantly, 158 00:08:19,250 --> 00:08:22,460 you can calculate MD5 hashes to make sure that your 159 00:08:22,460 --> 00:08:26,520 uploads and downloads have integrity, that is that they're valid. 160 00:08:26,520 --> 00:08:29,620 So AzCopy is a pretty cool tool for you to be aware of. 161 00:08:29,620 --> 00:08:34,090 To finish this demo, what you'd want to do next after you upload the VHD, 162 00:08:34,090 --> 00:08:36,280 there's actually two things left, 163 00:08:36,280 --> 00:08:39,420 and these can be done in the Azure portal in our Azure subscription. 164 00:08:39,420 --> 00:08:41,370 We'll want to create an image. 165 00:08:41,370 --> 00:08:45,440 So we can search for image in the Azure portal and go to Images. 166 00:08:45,440 --> 00:08:46,340 Then we can Create. 167 00:08:46,340 --> 00:08:50,280 You create the image in your subscription in your resource group. 168 00:08:50,280 --> 00:08:54,470 I'm going to call this server2019 in the East US. 169 00:08:54,470 --> 00:08:55,650 It's a Windows. 170 00:08:55,650 --> 00:08:57,670 I believe it's a gen 2 image. 171 00:08:57,670 --> 00:09:02,100 I'm not doing this particular demo on server1 because, 172 00:09:02,100 --> 00:09:04,340 as you saw, I haven't uploaded it yet. 173 00:09:04,340 --> 00:09:07,870 I'm going to grab the, let me bring my Storage Explorer back, 174 00:09:07,870 --> 00:09:09,640 and we'll go back to vhd. 175 00:09:09,640 --> 00:09:13,960 I'm going to try this with the server2019.vhd that I 176 00:09:13,960 --> 00:09:18,110 have here in my storage account, and here's where we can grab that file, 177 00:09:18,110 --> 00:09:19,240 right here, Storage blob. 178 00:09:19,240 --> 00:09:25,500 We can Browse, go into timstorage001, scroll down to the very bottom into vhd, 179 00:09:25,500 --> 00:09:27,240 and we'll grab server2019.vhd. 180 00:09:27,240 --> 00:09:29,940 Click Select. 181 00:09:29,940 --> 00:09:33,400 You can choose whether it's solid state or mechanical storage. 182 00:09:33,400 --> 00:09:37,280 Encryption. We can add data disks. We've got our taxonomic tags. 183 00:09:37,280 --> 00:09:39,360 And then that's all there is to it. 184 00:09:39,360 --> 00:09:43,770 Now there's a lot more to images in Azure. This image is just going 185 00:09:43,770 --> 00:09:47,440 to be a region and subscription‑specific image. 186 00:09:47,440 --> 00:09:50,730 You can create what's called a shared image gallery in your Azure 187 00:09:50,730 --> 00:09:54,920 subscription to replicate images across multiple Azure regions. 188 00:09:54,920 --> 00:10:00,190 This is helpful for businesses whose points of presence do span georegions 189 00:10:00,190 --> 00:10:04,120 and you want nice high‑speed access to those custom images. 190 00:10:04,120 --> 00:10:04,550 All right, 191 00:10:04,550 --> 00:10:07,540 the deployment is complete, so the very last step 192 00:10:07,540 --> 00:10:09,940 would be to create a virtual machine. 193 00:10:09,940 --> 00:10:12,940 So let's browse to the Virtual machines blade, and 194 00:10:12,940 --> 00:10:15,210 we'll do a Create, Virtual machine. 195 00:10:15,210 --> 00:10:19,430 I'll place this in my az800‑rg resource group and call it 196 00:10:19,430 --> 00:10:23,400 server2019 East US. Right here, this is what we're looking 197 00:10:23,400 --> 00:10:26,260 for, Image. We'll go to See all images. 198 00:10:26,260 --> 00:10:31,280 This brings us to the Azure Marketplace, but notice over here we have My Items, 199 00:10:31,280 --> 00:10:35,440 My Images, and then there's server2019. So we would simply 200 00:10:35,440 --> 00:10:38,560 select that image and then continue. Notice that we can 201 00:10:38,560 --> 00:10:40,320 choose our sizes down here. 202 00:10:40,320 --> 00:10:44,570 And if we click See all sizes, that'll bring us into this VM size 203 00:10:44,570 --> 00:10:47,840 selector that allows us to model what we're looking for. 204 00:10:47,840 --> 00:10:49,250 Now let me hit Add filter. 205 00:10:49,250 --> 00:10:52,040 I'm going to investigate something out of curiosity. 206 00:10:52,040 --> 00:10:52,380 No, 207 00:10:52,380 --> 00:10:57,330 I was hoping there would be a filter to show only VMs that support gen 208 00:10:57,330 --> 00:11:02,180 2 or only VMs that support nested virtualization, but that doesn't look 209 00:11:02,180 --> 00:11:08,000 like to be an option in the filter, but you can always hit the dots for that kind of thing anyway.