Setting up an Azure Resource Manager virtual machine with RStudio

December 2, 2015

(This article was first published on Revolutions, and kindly contributed to R-bloggers)

by Andrie de Vries

I am preparing for a demonstration of functionality of R at a conference next week. For maximum impact, I wanted to use a fast virtual machine in Azure. It is actually very easy to build a fresh machine (cloud or otherwise) that contains R as well as RStudio server.  In essence, all you have to do is:

If you were to build this on a virtual machine manager, e.g. VMWare or VirtualBox, this would be all you have to do.

However, in the cloud, you may want to have additional security. This is why Azure virtual machines blocks any incoming traffic, unless you explicitly open the required ports.

In the "classic" Azure virtual machines, this process is well-documented.  The process is to create an "endpoint" that opens a specific port. For example, see this video with step-by-step instructions.

However, for the more modern new "Resource manager" virtual machines the process is different.

But first we have to answer the question "what is a resource manager virtual machine"?  Well, this is answered concisely in the  "Azure Resource Manager overview". Among the many benefits are that you have more flexibility and power to build groups of machines, and you can also create your machines using scriptable templates.

Back to my problem: I knew I had a resource manager VM (rather than the classic VM). But the term "endpoint" only applies to the classic machines.

The equivalent in the resource manager is to create an "inbound security rule".


An inbound security rule for RStudio

Since RStudio server uses port 8787, you need to open the port 8787 in the destination range. (This 8787 is the number after the colon in the URL to get to your instance of RStudio, e.g. http://:8787/)


Detailed setup of the security rule

Although it seems complex, you can visualise the security components in the resource group as a simple hierarchy that consists of:

  • virtual machine
    • –> network interface
      • –> network security group
        • –> inbound security rule.

Hierarchy of resource manager components

In this post I described how to create an inbound security rule to expose RStudio in your Azure virtual machine.

Although it can seem daunting, the process is actually surprisingly easy, once you know what to do! Good luck in building your own machine!

To leave a comment for the author, please follow the link and comment on their blog: Revolutions. offers daily e-mail updates about R news and tutorials on topics such as: Data science, Big Data, R jobs, visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...

If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.


Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)