In this Course, you will learn about Microsoft Azure, one of the main cloud service vendors.
Now we're going to dive into using Azure. Suppose you have a server application that you want to migrate to the cloud. As I mentioned earlier, the most straightforward way to do this is to move the application to a virtual machine on Azure.
There are many ways to interact with Azure, the Azure portal runs in a browser, so you don't need to install anything to use it. Alternatively, you can install the CLI, which stands for command-line interface, or Azure PowerShell or the SDK, which stands for Software Development Kit.
If you want to use a command-based interface, and you have a lot of experience with PowerShell, then that's probably your best bet. Otherwise, use the CLI, which is easier to learn than PowerShell. It's actually possible to use the CLI and PowerShell from inside the browser too without having to install anything on your desktop. I'll show you how to do that in the next lesson.
The SDK is what you need to use if you're going to add code in your applications to interact with Azure.
It's even possible to interact with Azure from a mobile device by using the Azure mobile app. You can even use the CLI and PowerShell from the mobile app.
The easiest way to get started, though, is to use the Azure portal. So if you're following along on your own account, go to portal.azure.com. There are a few different ways to get to the place where you can create a VM. In this search box, you can start typing virtual machine and you'll see it come up at the top of the search results.
Another way is to go into the menu on the left and select virtual machines. It takes you to the same place. Once you're here, you can click Add.
The first thing it wants to know is what subscription to put this VM in. It always sets this to your default subscription, so you can usually just leave it that way. But I should explain what a subscription is.
When you sign up for an Azure account, Microsoft creates both a billing account and a subscription. It's easy to get the two mixed up because they're both involved in billing. A billing account is an agreement you or your organization sign to use Microsoft services. A subscription is actually just a collection of Azure resources. But all of the resources in a subscription are on the same monthly bill, so it's also a unit of billing.
So why do you need to have both a billing account and a subscription? Well, you might want to have multiple subscriptions in your billing account. Since each subscription generates a separate invoice, it can be useful to have a separate subscription for each department in your organization. Also, since the resources in different subscriptions are isolated from each other, you might want to have multiple subscriptions for security or compliance reasons.
Okay, so we'll leave the subscription with the default. Next, it's asking for the resource group. Like a subscription, a resource group is a collection of resources, but a subscription can have multiple resource groups so it's a way of further grouping the resources within a subscription.
There are a variety of ways to divide resources into resource groups. But the best practice is to group related resources together, such as a VM and its associated storage account. Generally speaking, the resources in a group should be created and deleted at the same time, which makes sense if they're components that work together to provide a solution.
All right, so let's create a new resource group to hold this VM. I'll call it example-RG. Now we need to give the VM a name. I'll call it example-VM. Next we need to decide which region the VM should run in.
Microsoft has data centers on every continent except Antarctica. Each of these dots is a region, and each region contains multiple Azure data centers. You usually want to choose a region that's closest to where your users are located. I'll choose West US 2. Notice that it has a diamond in it. That's because it has availability zones. I'll explain what those are in a minute.
You need to set an availability option if you want to make sure your application will still be available, even if Azure experiences an outage that affects this VM. The first option is "Availability zone", which is what I just showed you on the map. A region that supports availability zones has at least three data centers, each of which is called a zone. If you put VMs in multiple zones, then a data center outage won't take down your application, because your VMs and other zones will still be running.
It added another field called "Availability zone". We can choose 1, 2, or 3. It doesn't really matter which one we choose for this VM, but if we were to create a second VM, we'd need to put it in a different availability zone. I'll choose "1".
Next, we need to choose a VM image. This is a copy of the disk that will be used for the VM. The choices are different versions of Linux and Windows, such as Ubuntu, Red Hat, and Windows Server. This is only a small subset of the images that are available. You can click on this link to see more. For example, suppose you want an image that includes not only Windows Server but also SQL Server, click on Databases and then type "sql server". Surprisingly, there are images of SQL Server on Linux first. I'll add windows to the search to narrow it down. There we go. There are lots of SQL Server image options. For this example, we'll just go back and pick one of the basic options though. I'll pick the Ubuntu server option.
If you use an Azure spot instance for this VM, then the cost will be dramatically lower, but the VM might be shut down with only 30 seconds' notice. So you should only use this option for non-critical workloads.
There are lots of options for the size of the VM. At the top of the list, there's a size with only one virtual CPU, half a gig of memory, and four gigs of temporary storage. You can see that the cost per month is very low. Some of these other options are much bigger, but so is the cost. Since we're not actually going to use this VM, I'll choose the cheapest option.
Here, we need to create the administrator account. In most cases, you should use an SSH public key for authenticating to the VM. But to keep it simple for this demo, I'll use a password. You can name your administrator account almost anything.
The inbound port rules let you open up the VM to access from the internet. If this VM will be acting as a web server, then you'll want to open up ports 80 and 443. There's also an option to open up the SSH port so you can log into the VM remotely. The problem with opening up the SSH port here is that it will allow access from all internet addresses, which is dangerous. There are other more secure ways to give yourself access to the VM. So you shouldn't select this unless you're just doing some testing. I'm going to set this to "None".
That's it for the basic settings, but there are a few more settings we should have a look at. We'll click this button to go to the disks tab. The operating system disk is set to premium SSD by default. That option has the highest performance, but it's much more expensive than the other two. I'll set it to Standard SSD. You can also add data disks if you want.
And now let's have a look at the networking options. By default, it creates a virtual network, a subnet inside that virtual network, and a public IP address. If we already had another virtual network, we could put it in there instead if we wanted to.
Okay, that takes care of the compute, storage, and networking options for this VM. So let's create it. First, click "Review + Create". It says that our settings have passed validation testing. Then it summarizes all of our settings. Now click the Create button.
It'll take a little while to create, so I'll fast forward. All right, it's done. We can click on "Go to resource" to have a look at the VM.
Here it shows the details of this VM, such as its status, and its public IP address. Up here it has some controls that let you stop and restart the VM or even delete it. If we had set up SSH authentication, then we could connect to it from here too. In the menu on the left, there are all kinds of options for things like activity logs, security, backups, and monitoring.
That's it for this demo, you should have a pretty good idea of how to create resources in the portal now, because the process is fairly similar, regardless of what kind of Azure resources you're creating. If you're following along on your own Azure account, you might want to look around and see what you can do with your new VM.
When you're done, make sure you delete the VM so you don't incur any ongoing charges. The best way to delete everything associated with the VM, including the public IP address, etc., is to delete its resource group. Select Resource groups in this menu, and then click on "example-rg". Here's a list of all the resources associated with the VM. Now click "Delete resource group". Then type the name of the resource group. Then click the Delete button.
Now if you're ready to see how to work with Azure using the command-line interface, then please go to the next video.
A world-leading tech and digital skills organization, we help many of the world’s leading companies to build their tech and digital capabilities via our range of world-class training courses, reskilling bootcamps, work-based learning programs, and apprenticeships. We also create bespoke solutions, blending elements to meet specific client needs.