Setup Visual Studio 2019 Development VM in Microsoft Azure Cloud
In the past the only option for writing code and building software using Visual Studio was to install it on your local machine. With technologies like Windows Hyper-V and VMWare things became less invasive by allowing you to develop software inside of a Virtual Machine (VM). With the cloud, things have become even easier. You can now easily, spin up a Virtual Machine in Microsoft Azure, use it for what ever you need, then shut it down or delete it when it’s no longer needed. This can be an extremely valuable tool for any software developer, and has been possible with Visual Studio 2017 for some time now. With the first public release of Visual Studio 2019, you can now run a Visual Studio 2019 VM in Microsoft Azure too!!
Developing in the Cloud
It can sound a little mysterious to develop for the cloud, in the cloud, but using a VM as your local development environment is pretty much the same thing . By using Virtual Machines as your development machines and environments it allows you to scale your local PC much further than it’s local hardware could ever scale. You can add more CPU power, more memory, more storage space and scale up / out as necessary, while still maintaining the ability to scale down / in as necessary to conserve cost as well. Plus, your local PC can be running any OS (Windows 10, macOS, Linux, or even iOS!)
The trick to using a Virtual Machine (VM) running Visual Studio for software development, is to have a Remote Desktop (RDP) Client application installed. Microsoft Remote Desktop (RDP) is a set of functionality and protocol that let’s you “remote in” to any Windows machine (either physical or virtual) and use it just like you were sitting at the machine directly. This let’s you use pretty much any computer remotely, and grants tons of power to any developer especially within the Microsoft Azure Cloud.
The steps to developing in the clouds are essentially as follows:
Have a Microsoft Remote Desktop client application installed on your local computer; no matter the operating system.
Windows comes with RDP built-in!
On macOS you can download Microsoft Remote Desktop from the App Store for Free!
There are also Open Source RDP Clients available for Linux too!
Setup 1 or more Virtual Machines (VMs) in the Cloud; such as one with Visual Studio 2019 installed!
Use the Microsoft Remote Desktop client on your local machine to connect to and use those VMs just like they are local!
The rest of this article will walk through everything you need to know to setup Visual Studio 2019 VMs in Microsoft Azure, and get building software not just for the cloud, but in the cloud as well!
Setup Visual Studio 2019 VM in Azure
The most obvious requirement to provisioning a Visual Studio virtual machine (VM) in Microsoft Azure is that you’ll need to have an Azure Subscription. After that you can simply go to the Azure Marketplace and provision a Windows VM with Visual Studio 2019 pre-installed and get coding!
Here’s a short guide to help you provision a new Visual Studio 2019 virtual machine in the Microsoft Azure cloud:
Navigate to the Azure Portal (http://portal.azure.com) and login
Click on the green +Create a resource button in the left hand navigation of the Azure Portal, then type Visual Studio 2019 into the Search the marketplace textbox, and press Enter.
On the Everything search results, click on the Visual Studio 2019 on Windows Server 2016 (x64) marketplace image.
On the image information blade, click the Create button to get started provisioning. Be sure to leave the Deployment Model dropdown to the default of Resource Manager.
On the Create virtual machine – Basics step, fill in the following values at minimum:
- Resource group: specify a Resource Group to provision the VM within
- Virtual Machine Name: specify a name for your VM
- Region: You may specify the Azure Region to provision in. Usually you’ll want to use the nearest Azure Region to you in order to minimize Internet latency when connecting to it.
- Size: Specify a VM instance size to configure the CPU Core count and RAM for your VM (I would recommend to use a VM instance size with at least 4 CPUs and 7 GB RAM, possibly more for better performance)
- Administrator Account: specify a Username and Password to configure for the Admin account on the VM
Click on the Networking tab and fill in the following values to open up Port 3389 for RDP access to the VM, then click Review + create:
- Public invoice ports: select “Allow selected ports”
- Select inbound ports: select the “RDP (3389)” option
On the Review + create step, click Create once validation has passed.
It’ll take a few minutes to complete the provisioning of your brand new Visual Studio 2019 VM. Go take a break, get some coffee, or post on Twitter how awesome Visual Studio + Azure is, then come back and get ready to “develop for the cloud, in the cloud“.
Congratulations! After following the previous steps, you will now have a Windows Server 2016 VM with Visual Studio 2019 pre-installed all ready for you to use to “develop for the cloud, in the cloud.” And, you no longer need to worry about any conflicts with existing software or running out of disk space on your local machine!
Connect with Remote Desktop
Once you have a Visual Studio VM provisioned in Microsoft Azure, the next step is to connect to it with Microsoft Remote Desktop so you can start using it and writing code. Microsoft Remote Desktop provides an easy way to remotely connect to a Windows computer (physical or VM) and use it just as if you were sitting down at the machine. It includes full display, keyboard and mouse support along with MANY other useful features.
To connect to an Azure VM with Remote Desktop, you first need to get the IP Address of the VM to connect to, then you’ll be able to connect using a Remote Desktop Client and the Admin username and password that was configured for the VM at creation.
The Azure Portal actually goes a step further and provides you an easy to use .rdp file for download. This enables you to click a button in the Azure Portal, then download and open the .rdp file that contains the necessary connection information for VM. When opening this file in the Remote Desktop Client, the only thing you need to fill in is the Admin username and password to connect.
To help you locate the IP Address of the VM, as well as download the .rdp file, you can follow the below steps:
Navigate to and login to the Azure Portal http://portal.azure.com
Once logged into the Azure Portal, you’ll need to locate the Virtual Machine you want to connect to. To do this, you can navigate to your VM by first finding the Resource Group its in by clicking on Resource groups in the left hand navigation, then click on the specific Resource Group.
On the Resource group blade, click on the Virtual Machine resource type in the list of resources within the Resource Group.
On the Virtual machine blade for your VM, you will find the Public IP address of the VM within the Essentials pane. Also, clicking on the Connect button will enable you to download a “.rdp” file that can be opened within the Microsoft Remote Desktop client.
Once downloaded, you can open the .rdp file in the Microsoft Remote Desktop, then connect to your new Visual Studio 2019 VM running in Microsoft Azure!
- On Windows you can use the Microsoft Remote Desktop Connection client.
- On macOS the best option is to use the Microsoft Remote Desktop application that can be installed through the macOS App Store.
Once connected to the VM with Remote Desktop, if you provisioned the Visual Studio image from the Azure Marketplace that’s running Windows Server 2016, you’ll need to change the IE Enhanced Security Configuration setting. To do this, you’ll need to wait for the Server Manager window to pop up, then click on Local Server.
Locate and click on the On text for IE Enhanced Security Configuration.
In the Internet Explorer Enhanced Security Configuration window, select Off under Administrators, then click OK.
Now you can open up Visual Studio 2019 in the VM and get coding!
Benefits of Development VMs
Most developers focus mostly on the Platform as a Service (PaaS) services in Microsoft Azure, such as: Web Apps, Blob Storage, SQL Database and Service Bus. However, many Developers may not be very familiar with the Virtual Machine (VM) capabilities of Azure that includes the ability to easily spin up a Windows VM with Visual Studio already installed.
There are a few VM images available in the Azure Marketplace that have Visual Studio pre-installed. These are great way to get started with creating a temporary, or even longer term use, Development VM much quicker than installing the Operating System and Tooling yourself. (hint: It takes awhile to install Visual Studio)
Before we get into the different Visual Studio VMs available in the Azure Marketplace, let’s first cover some of the biggest benefits of spinning up a pre-built, pre-configured Windows VM with Visual Studio pre-installed.
Zero Install Required – You can spin up a new Visual Studio development VM in a matter of minutes, and the best part is that you don’t have to install Windows or Visual Studio yourself.
Protected from Hardware Failure – Using an Azure VM for development, or any other work use, provides isolation against hardware failures locally that involve your laptop, desktop, or external storage.
Easily “Add” CPU / Memory Resources – Not only does an Azure VM allow you to essentially extend the capabilities of your laptop or desktop into the Cloud, but you can also resize the VM anytime to add or remove CPU Cores and Memory as needed.
Device Agnostic – Azure VM’s can be connected to with Remote Desktop from any Computer, such as Windows, Linux, macOS, or even tablets! This allows you to easily interchange which physical “computer” you use for your development.
As you can imagine there are many benefits and advantages to using a VM for development, and putting that VM in the Cloud, in Microsoft Azure, further enhances those benefits to new levels. The previous mentioned benefits are only a few of the most obvious benefits. I’m sure once you start embracing Azure VMs for development that you’ll realize additional benefits as well.