This folder contains scripts to install RStudio on Data Science Virtual Machine (DSVM). There are separate scripts RStudio Desktop (Open Source License) and RStudio Desktop Pro (Commercial License) on Ubuntu and Windows. These scripts can be run as Azure Custom Script Extensions to add RStudio to DSVM.
Azure Custom Script Extensions run scripts from Azure Storage. So, these scripts need to be uploaded to Azure Storage first. This only needs to be done once for a subscription and then the scripts can be used for multiple DSVMs.
- You can download the scripts from GitHub using the Code button on the main page and then selecting Download Zip.
- You can then upload the scripts to storage using https://portal.azure.com.
- On Storage account page, select or create a store account.
- Select Container and then select or add a container.
- Select Upload to upload the scripts
To add RStudio when creating a DSVM using https://portal.azure.com:
- Select the Advanced tab.
- Under Extensions click Select an extension to install.
- Select Custom Script for Linux and click Next.
- Click the Browse button by the Script files field and select the storage account and script file.
- In the Command field, enter "sh" followed by the name of the script file that you selected. This should be either
sh ubuntu-install-RStudio-pro.sh
orsh ubuntu-install-RStudio-opensource.sh
. - Click Create
To add RStudio when creating a DSVM using https://portal.azure.com:
- Select the Advanced tab.
- Under Extensions click Select an extension to install.
- Select Custom Script Extension and click Next.
- Click the Browse button by the Script file (Required) field and select the storage account and script file.
- Click Create
To add RStudio to an existing Ubuntu DSVM using https://portal.azure.com
- Open the Virtual Machine
- Select Extensions and Applications
- Click Add
- Select Custom Script for Linux and click Next.
- Click the Browse button by the Script files field and select the storage account and script file.
- In the Command field, enter "sh" followed by the name of the script file that you selected. This should be either
sh ubuntu-install-RStudio-pro.sh
orsh ubuntu-install-RStudio-opensource.sh
. - Click Create
To add RStudio to an existing Windows DSVM using https://portal.azure.com
- Open the Virtual Machine
- Select Extensions and Applications
- Click Add
- Select Custom Script Extension and click Next.
- Click the Browse button by the Script file (Required) field and select the storage account and script file.
- Click Create
Azure Custom Script Extensions can also be used in Azure Resource Manager (ARM) templates. The example ARM template, arm-ubuntu-dsvm-RStudio.json, creates a new Ubuntu DSVM and runs an Azure Custom Script Extension to add RStudio. Please upload the scripts to Azure Storage before using this ARM template. This is the section in the template adds the Azure Custom Script Extension:
{
"type": "Microsoft.Compute/virtualMachines/extensions",
"apiVersion": "2022-03-01",
"name": "[format('{0}/RStudio', variables('virtualMachineName'))]",
"location": "[resourceGroup().location]",
"dependsOn": [
"[resourceId('Microsoft.Compute/virtualMachines', variables('virtualMachineName'))]"
],
"tags": {
"displayName": "Add RStudio"
},
"properties": {
"publisher": "Microsoft.Azure.Extensions",
"type": "CustomScript",
"typeHandlerVersion": "2.1",
"autoUpgradeMinorVersion": true,
"settings": {
"skipDos2Unix": false,
"timestamp":123456789
},
"protectedSettings": {
"commandToExecute": "[format('sh {0}', variables('customCommand'))]",
"managedIdentity" : {},
"fileUris": [
"[format('https://{0}.blob.core.windows.net/{1}/{2}', variables('customCommandStorageAccountName'), variables('customCommandStorageContainerName'), variables('customCommand'))]"
]
}
}
The parameters are:
- customCommand - the script name, ubuntu-install-RStudio-pro.sh or ubuntu-install-RStudio-opensource.sh
- customCommandStorageAccountName - the name of the Azure Storage Account that contains the scripts
- customCommandStorageContainerName - the name of the Container that contains the scripts.
You can run this template with Azure Cli commands:
az login
read -p "Enter the name of the resource group to create:" resourceGroupName &&
read -p "Enter the Azure location (e.g., centralus):" location &&
read -p "Enter the authentication type (must be 'password' or 'sshPublicKey') :" authenticationType &&
read -p "Enter the login name for the administrator account (may not be 'admin'):" adminUsername &&
read -p "Enter administrator account secure string (value of password or ssh public key):" adminPasswordOrKey &&
read -p "Enter storage account name for the extension:" customCommandStorageAccountName &&
read -p "Enter storage container name for the extension:" customCommandStorageContainerName &&
read -p "Enter administrator account secure string (value of password or ssh public key):" adminPasswordOrKey &&
templateFile="arm-ubuntu-dsvm-RStudio.json" &&
az group create --name $resourceGroupName --location "$location" &&
az deployment group create --resource-group $resourceGroupName --template-uri $templateUri --parameters adminUsername=$adminUsername \
authenticationType=$authenticationType adminPasswordOrKey=$adminPasswordOrKey \
customCommandStorageAccountName=$customCommandStorageAccountName customCommandStorageContainerName=$customCommandStorageContainerName &&
echo "Press [ENTER] to continue ..." &&
read