Deploy VMs Using Azure Resource Manager
In today’s Ask the Admin, I’ll show you how to deploy a new Azure VM running Windows Server 2012 R2 using Resource Manager in the preview portal.
If you have any experience deploying VMs in Microsoft Azure, you’ll probably have come across the concept of cloud services and resource groups (RGs). Azure Service Manager uses cloud services as hosting containers, but Azure Resource Manager (ARM) uses RGs instead, which can span multiple Azure regions and contain related VMs, websites, IP addresses, databases, virtual network interfaces (NICs) etc.
The key advantage of ARM over the classic Azure Service Manager model is that with a little help from JSON-based templates, see What is JSON and How Is It Used? on the Petri IT Knowledgebase for more information on JSON, applications can be deployed in the cloud in a single click across multiple regions.
As you’ll see in this demonstration, unlike the Azure Service Manager, in one operation ARM allows you to deploy a working cloud app along with all the necessary components, such as virtual networks, VMs, and public IP addresses. While the deployment in this article is relatively simple and doesn’t require you to download or create an ARM template, we’ll be looking at working with templates in more detail on Petri in the future, and the possibilities for automating the deployment of complex applications in the cloud are quite exciting.
Create a Virtual Machine Using ARM
Before you get started, you’ll need an Azure subscription, and if you don’t have one already, sign up here for a free trial. Once you’ve got an account set up, follow the instructions below:
- Sign in to the new preview portal
- Click + New in the top left of the portal.
- A panel will open with a list of resource categories. Click Compute at the top of the list.
- In the Compute panel, click Windows Server 2012 R2 Datacenter.
- In the Windows Server panel, click the Select a deployment model dropdown menu and select Resource Manager from the list, and then click Create.
- You’ll now be presented with four different stages for creating the new VM: Basics, Size, Settings, and Summary. Make sure that Basics is selected and enter a name for the new VM in the Name field.
- Continue by entering a username and password for the VMs local administrator account.
- If you have more than one Azure subscription associated with your Microsoft account, you can select the subscription to use.
Now we need to either select an existing resource group in which to place the new VM, or create a new RG. For the purposes of the demo, let’s create a new RG.
- Type a name for the new RG in the Resource group field. If the name is available for use, a green checkmark will appear to the right.
- Finally, select a region. I’m going to leave the default West US region selected.
- Click OK.
The portal will automatically move to the next section, which is Size, and present you with some recommended configuration options for Windows Server 2012 R2. In this demo, I’m going to ignore the recommendations to keep costs down and select a smaller VM size.
- On the Choose a size panel, click View all.
- Scroll down the list of available VM sizes, click A1 Basic and then click Select.
Azure’s Basic series of VM sizes are intended for development and testing purposes, and don’t offer the same performance and features as the Standard series.
- In Settings, switch the storage disk type to Standard, because A1 Basic VMs don’t support SSD disks.
- In this demo, I’m going to allow Azure to create a new storage account. If you have an existing account that you’d like to use, by all means you can select it by clicking Storage account.
- I’ll accept all the default settings for the network, allowing Azure to create a new virtual network, subnet, network security group and public IP address.
- Monitoring we’ll leave enabled, and as this is a standalone server, there’s no reason to add it to an availability set. For more information on availability sets, see Understanding Azure Availability Sets on Petri.
- Click OK to continue.
- Finally, review the information in the Summary panel about the new deployment and click OK.
A tile will be added to the preview portal dashboard showing the status of the new deployment. All we need to do now is sit back and wait while our new resources are deployed. Once the VM is ready, two new panes will open automatically showing technical details of the new VM, such as the public IP address and computer name, and another that allows you to access the VM’s settings.
To connect to the VM using Remote Desktop, all you need to do is click Connect on the virtual machine panel and an RDP file will be downloaded. If you want to deploy a second server to the same RG, Azure will use the existing virtual network and storage account, but you can always choose to create additional virtual networks and storage accounts if required.
Deleting Azure Resources
To remove the VM and all the associated resources from Azure, the quickest way is to delete the RG.
- In the left of the preview portal, click Resource Groups.
- In the Resource groups panel, scroll down the list of RGs and locate the one you’d like to delete.
- To the right of the RG, click the three dots and then click Delete in the context menu.
- A warning dialog will appear, and you’ll be asked to enter the name of the RG before you can hit Delete. Type the RG name and then click Delete, remembering that all the resources in the RG will be deleted, and that the operation is irreversible.
Deleting all the resources can take some time, but if you want to see the progress of the operation, click the notification (bell) icon in the top right of the preview portal, and the operation will appear in the dropdown menu. You can click on the delete operation to get more detailed information, or wait until a small green checkmark appears to the left of the operation, indicating that it’s completed.