Setting up an Azure Resource Manager virtual machine with RStudio
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
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:
- Stand up a minimal machine with your desired operating system (I selected CentOS 6)
- Download and install R from CRAN (although I installed Revolution R Enterprise)
- Download and install RStudio Server
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”.
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://
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.
- –> network security group
- –> network interface
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!
R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.