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:

  1. Have a Microsoft Remote Desktop client application installed on your local computer; no matter the operating system.
    1. Windows comes with RDP built-in!
    2. On macOS you can download Microsoft Remote Desktop from the App Store for Free!
    3. There are also Open Source RDP Clients available for Linux too!
  2. Setup 1 or more Virtual Machines (VMs) in the Cloud; such as one with Visual Studio 2019 installed!
  3. 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:

  1. Navigate to the Azure Portal (http://portal.azure.com) and login
  2. 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 textbook, and press Enter.
  3. On the Everything search results, click on the Visual Studio 2019 on Windows Server 2016 (x64) marketplace image.
  4. 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.
  5. 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
  6. 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:
    1. Public invoice ports: select “Allow selected ports”
    2. Select inbound ports: select the “RDP (3389)” option
  7. On the Review + create step, click Create once validation has passed.
  8. 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:

  1. Navigate to and login to the Azure Portal (http://portal.azure.com)
  2. 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.
  3. On the Resource group blade, click on the Virtual Machine resource type in the list of resources within the Resource Group.
  4. 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.
  5. 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.
      msremotedesktopconnectionapp
    • On macOS the best option is to use the Microsoft Remote Desktop application that can be installed through the macOS App Store.
      macos-microsoftremotedesktop-appstore
  6. 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.
    winserver-servermanager-localserver
  7. Locate and click on the On text for IE Enhanced Security Configuration.
    winserver-servermanager-ieenhancedsecurityconfig-on
  8. In the Internet Explorer Enhanced Security Configuration window, select Off under Administrators, then click OK.
    winserver-servermanager-ieenhancedsecurityconfig-dialog
  9. 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.

  1. 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.
  2. 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.
  3. 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.
  4. 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.

GET MORE STUFF LIKE THIS

Subscribe to the Build Azure Weekly newsletter to receive similar updates about Microsoft Azure and related topics!


We respect your privacy and take protecting it seriously. We do not sell our email list, and you can unsubscribe at any time.

Posted by Chris Pietschmann

Chris is a Microsoft MVP and has nearly 20 years of experience building enterprise systems both in the cloud and on-premises. He is also a Certified Microsoft Azure Solutions Architect (both MCSD and MCSE), a Microsoft Certified Trainer, and self proclaimed Cloud Advocate. He has a passion for technology and sharing what he learns with others to help enable them to learn faster and be more productive.

3 Comments

  1. […] Setup Visual Studio 2019 Development VM in Microsoft Azure Cloud (Chris Pietschmann) […]

    Reply

  2. Just wanted to point out, most of the Azure VMs that can handle VS need to have at least 8GB of RAM. That’s going to cost anywhere from $150+ on up per month (the config you have is over $200). AWS desktops (they have a service that is structured for desktop RDP usage) with similar configurations are in the $70 per month range. Would be nice if Azure had a similar offering.

    Reply

    1. Chris Pietschmann December 10, 2018 at 11:41 am

      It really depends what you’re doing for the amount of RAM you’ll need. Also, it’s significantly cheaper if you Stop / Deallocate the VM when you’re not using it. There’s no need to run it 24/7 when you only need it 8/5 each week, or even possibly less.

      Reply

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.