During this demonstration, we will use the Microsoft Azure Cross-Platform (xPlat) CLI Tool to create Public IP Address and Network Interface resources in the Resource Group that we provisioned the Virtual Network into, in the previous demonstration. The Network Interface is a top-level resource in the Resource Group, and will be associated with the Virtual Network subnet. Similarly, the Public IP Address resource is a top-level resource that will be associated with the Network Interface, exposing it directly to the Internet. Later on, we will attach this Network Interface to the Azure Virtual Machine that we create; hence, it will be accessible both privately and publicly.
Now that we've created a virtual network and a subnet for our virtual machine, let's go ahead and create a public IP address and a network interface that we'll attach to the virtual machine.
So I'm going to call Azure network, and if we scroll back to the top, we'll see the help to create a public IP and a network interface. So if we call Azure network public IP, and then add help, we'll see that we have the few options to manage the public IP address. So let's go ahead and just call Azure network public IP create, and then look at the help for that.
As you can see, we specified the resource group that the public IP should belong to, so in this case, it's called Cloud Academy Vnet. The name of the public IP we'll call Cloud Academy Vnet. The domain name label, we'll use Cloud Academy Vnet. And then the location is going to be west US, where we created the virtual network, and then the allocation method, we'll use dynamic.
So now the Xplat CLI tool is going out and creating a public IP address resource inside of the Cloud Academy Vnet resource group. Once we've created that public IP address, we'll next create a network interface. So let's go ahead and call Azure network, and then scroll back up to our help for the network interface. So we've got network nick create. So let's go ahead and take it the...take a look at the help for that.
So you can see we've got a bunch of different options here. We can specify the resource group that the nick should belong to, a name for the nick, a location for the nick, and we also have many other options that we can specify, such as the subnet that it should belong to, the virtual network that contains the subnet that it should belong to. We can also associate it with a public IP address. We can assign network security groups, and much more.
So let's go ahead and specify Azure network nick create. The resource group is going to be Cloud Academy Vnet. The name of the network interface will be VM01. The location is going to be the same as we've used before, so it's going to be west US. The public IP name is going to be Cloud Academy Vnet. That's what we just created a moment ago. The subnet name will be CA Subnet. And the subnet vnet name will be Cloud Academy Vnet. So let's go ahead and create that network interface. And as you can see, we've received an error. It says the subnet with name CA Subnet was not found in the resource group Cloud Academy Vnet. So let's call Azure network vnet list, and then specify the resource group Cloud Academy Vnet.
So this is going to list out the virtual network. And as you can see, our subnet is actually called, our network name is actually called CA Vnet. So we had a little bit of a bug, because we actually specified Cloud Academy Vnet as the virtual network name instead of the proper name, which is CA Vnet. So now it's going to go out and create the network interface. It's going to find the CA subnet instead of CA Vnet. And then it'll go ahead and create the network interface.
Okay, so now you can see that we've created a network interface. So the next step to creating our virtual machine is to create a storage account to support the virtual machine, and then finally, we'll be able to create the virtual machine itself.
Trevor Sullivan is a Microsoft MVP for Windows PowerShell, and enjoys working with cloud and automation technologies. As a strong, vocal veteran of the Microsoft-centric IT field since 2004, Trevor has developed open source projects, provided significant amounts of product feedback, authored a large variety of training resources, and presented at IT functions including worldwide user groups and conferences.