Setting up an Azure Resource Manager virtual machine with RStudio

[This article was first published on Revolutions, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
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:

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”.

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/)

Rstudio-inbound-port
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
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.

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.

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)