How do I deploy R code & models as a web service on a ML Ubuntu server deployed on Azure cloud, accessible from the Internet?

Renato Vitolo 1 Reputation point
2020-10-15T09:35:39.597+00:00

Hi,

I would like to build a simple model in R and deploy it on a Machine Learning Server instance (Linux Ubuntu 16.04) that I created in Azure.
This web service should be accessible from the Internet, through REST API calls.

I tried to use the approach described here: https://learn.microsoft.com/en-us/machine-learning-server/operationalize/quickstart-publish-r-web-service

The problem is that I cannot login from R into the ML Server instance, namely, the following command fails:

remoteLogin("http://myhost.switzerlandnorth.cloudapp.azure.com:12800", username = "myusername", password = "mypassword")  

On the other hand, I can log into the ML Server instance from the command line, through ssh: the following command

ssh  myusername:12800@myhost.switzerlandnorth.cloudapp.azure.com  

opens a terminal on the ML Server machine (the terminal greeting is "Welcome to the Linux Data Science Virtual Machine on Azure!").

What I am trying to achieve is explained in this figure:

https://learn.microsoft.com/en-us/machine-learning-server/operationalize/configure-machine-learning-server-one-box

In that picture, I would want the "one-box configuration" to run entirely on the Microsoft Cloud (not on my laptop, or on other servers).
And I would like to access the R models from a front-end app (deployed elsewhere) through authenticated REST API calls to the "one-box".
This is how I provisioned my Linux Data Science VM on Azure:

https://azuremarketplace.microsoft.com/en-us/marketplace/apps/deploy-r.operationalization?tab=overview

This is the kind of R script that I'd like to use to deploy my R models on that DSVM:
https://learn.microsoft.com/en-us/machine-learning-server/operationalize/quickstart-publish-r-web-service

This is what I'm trying to do:
https://learn.microsoft.com/en-us/machine-learning-server/r-reference/mrsdeploy/mrsdeploy-package

But all examples I could find for the remoteLogin() function use a localhost server, not a remote server on the Microsoft Azure Cloud, see e.g.

remoteLogin("https://localhost:1280", session=TRUE, diff=TRUE, commandline=TRUE)  

See e.g. https://blog.revolutionanalytics.com/2017/03/running-your-r-code-azure.html

I searched the Q&A forum, but could only find threads that are vaguely related to my issue, such as:

https://social.msdn.microsoft.com/Forums/en-US/b5cc5cff-ad46-4772-8d01-793dd067e4a6/pass-web-service-input-to-r-script?forum=MachineLearning
https://social.msdn.microsoft.com/Forums/en-US/b47b0dcf-d92d-4bdf-9a19-f8ba0f5a29cc/r-web-service-input?forum=MachineLearning
https://social.msdn.microsoft.com/Forums/en-US/598b0e20-5f12-47a2-8d8a-81dbff83ef6d/how-to-consume-machine-learning-webservice-using-r?forum=MachineLearning

Also see here for related threads:
https://medium.com/@RonakTalreja/deploying-apis-the-microsoft-way-ffde1fdd027a
https://learn.microsoft.com/en-us/previous-versions/machine-learning-server/install/operationalize-r-server-one-box-config

Azure Machine Learning
Azure Machine Learning
An Azure machine learning service for building and deploying models.
2,575 questions
Azure Data Science Virtual Machines
Azure Data Science Virtual Machines
Azure Virtual Machine images that are pre-installed, configured, and tested with several commonly used tools for data analytics, machine learning, and artificial intelligence training.
67 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. romungi-MSFT 42,286 Reputation points Microsoft Employee
    2020-10-15T15:04:31.877+00:00

    @Renato Vitolo Azure Machine learning designer's execute R script allows you to run your R models on Azure ML with various compute sizes that are based on the latest generation of Azure VMs. Along with the other data processing modules of Azure ML designer you can create pipelines that can be deployed as CD/CI model & web services can be deployed using a single click which also provides the ability to control access

    Machine Learning server can be still used but there are no active updates that could hamper future upgrades. You can try this ARM template deployment for ubuntu which deploys the following architecture & could cost more than designer's module architecture.