Run MATLAB from Microsoft Azure Marketplace
This topic describes how to use the Azure® Marketplace to quickly deploy and run MATLAB® in Azure. The elasticity of the cloud infrastructure combined with MATLAB enables you to leverage greater computing resources and keep your calculations close to your data.
Anyone with a valid MATLAB license and an Azure account can run MATLAB on the cloud. This is called MATLAB (BYOL) because you "Bring Your Own License."
To complete these instructions, you need:
By default, the MATLAB (BYOL) offering in Azure Marketplace uses online licensing. The following table summarizes which licenses support running MATLAB on the cloud using online licensing.
|License Type||Cloud Availability|
Individual (a license that only you use that is in your name; not a Home or Student license)
Your license is already configured for MATLAB on the cloud.
Campus-Wide License (a license that you use that belongs to your academic institution)
Your license is already configured for MATLAB on the cloud.
Home and Student (that only you use and is in your name)
These license types are not eligible to use MATLAB on the cloud. However, you can use MATLAB Online.
All other license types, including Concurrent and Network Named User
Contact your license administrator.*
The license administrator might need to make some changes to the license to enable running MATLAB on the cloud.
Administrators: For more information on this process, see Administer Network Licenses.
*Not sure who the license administrator is? Sign in to your MathWorks Account, click the license you are using, then click the tab marked “Contact Administrators”.
To use a license that is managed via a network license manager, you can specify the port and hostname or IP address of the network license manager when you create the cloud resources in Azure. You can either specify the location of an existing license manager, or deploy a new license manager in the cloud. You must make sure that the license manager can communicate with your cloud resources. To deploy a Network Manager in Azure using an Azure Marketplace software plan developed by MathWorks®, follow the steps at Run Network License Manager from Microsoft Azure Marketplace.
Deploy MATLAB Resources in Azure
Configure and Deploy Template from Marketplace
Use the following steps to configure and deploy MATLAB (BYOL) resources in a resource group.
Navigate to https://portal.azure.com and login to your Azure account.
From the Portal, click Create a Resource.
Search for “matlab” in the marketplace and click on the MATLAB (BYOL) offering.
Click Create on the offering page to begin setup.
The setup process uses a Resource Manager template to help you configure the virtual machine and networking settings. To make setup easy, many of the fields come prepopulated with acceptable values. The following table describes how to set the various options in each menu of the template. Click Next at the end of each step to proceed to the next menu.
Menu Option Description
Select an Azure subscription to use.
You can select an existing resource group from the drop-down menu, or click Create New to create a new resource group. If you select an existing resource group, then it must not have any currently deployed resources.
Select a region from the drop-down list.
Virtual Machine Settings
Virtual Machine name
Select a name for the VM resource. The default name is
Virtual Machine size
Select the VM size. The default size (D3 v2) is sufficient for most purposes and safely satisfies the minimum requirements for MATLAB, but you can select a different size if necessary. Note that the size of the VM you choose affects your costs.
Choose the admin password for the user "ubuntu". This password is required when logging into your instance using remote desktop protocol. Your password must have at least 12 characters and meet the Azure password requirements. For information on the password requirements, see What are the password requirements when creating a VM?.
Retype your chosen password.
Select the range of IP addresses that are authorized to connect to the VM. This is the public IP address for your computer which can be found by searching for "What is my IP address" on the web. This field uses CIDR notation of the form: 100.100.100.100/20. The mask determines the number of IP addresses to include.
Network License Manager port@server
If you are using a Network Licensing Manager, enter the port and hostname or IP address. Make sure that the network license manager can communicate with your Azure resources. To deploy a network license manager in Azure, see Run Network License Manager from Microsoft Azure Marketplace.
The Virtual network field is prepopulated with a new virtual network resource named
You can configure the name, address space, or subnets of the new virtual network resource by clicking Create new.
You can select an existing virtual network resource in the drop-down menu. If you choose to use an existing resource, then the template does not create any new virtual network resources.
The Subnet field is prepopulated with a new subnet named
subnet-1and an associated subnet address.
You can select a different subnet of the selected virtual network in the drop-down menu.
If you selected an existing virtual network rather than creating a new one, then you can click Manage subnet configuration to configure the subnets for the network.
Public IP Address for the VM
The Public IP Address for the VM field is prepopulated with a new Public IP resource named
matlab-desktop-ip. The resource uses a basic SKU and dynamic assignment.
You can configure the name, SKU, and assignment protocol by clicking Create new.
You can select an existing Public IP resource in the drop-down menu. If you choose to use an existing resource, then the template does not create any new Public IP resources.
DNS Prefix for the Public IP Address
The DNS Prefix for the Public IP Address field is prepopulated with an acceptable DNS prefix, but you can edit it if necessary. The selected DNS name is used to connect to the VM with Remote Desktop.
If you edit the DNS prefix, then note that it must be globally unique in Azure.
Review and Create
When you advance to the Review and Create menu, Azure automatically runs some final validation checks on the information entered on previous screens. If Azure finds any errors, then you need to fix them before proceeding.
Once you are satisfied with the values you have entered, click Create to finalize setup and begin deploying the selected resources, or Download a template for automation to get a copy of the completed template.
Connect to VM and Run MATLAB
Once you have successfully configured and deployed the MATLAB (BYOL) resources, use the following steps to connect to the virtual machine you set up. You can either create a prepopulated Remote Desktop file, or run Remote Desktop and manually fill out the DNS name.
From the Azure Portal, navigate to the resource group with the resources you deployed.
matlab-desktopvirtual machine resource to view its details. (If you renamed the virtual machine resource, then select the resource corresponding to that name.)
Click the Connect button to see a list of connection options, and then select RDP from the drop-down menu.
On the Connect with RDP screen, the IP address and Port number fields are prepopulated. Click Download RDP file to download a Remote Desktop file that automatically connects to the virtual machine.
Run the RDP file you downloaded to connect to the virtual machine, accepting any intermediate dialogs.
Once Remote Desktop Connection connects to the VM, sign in to the virtual machine using the username and password that you previously configured in Virtual Machine Settings. (See Configure and Deploy Template from Marketplace for more information.)
You are now at the desktop of the Linux® VM. Double click the MATLAB icon to launch MATLAB.
Launching MATLAB for the first time in this setting can take several minutes.
After you launch MATLAB, you are prompted to login to your MathWorks account and select a MATLAB license to use.
To manually connect to the virtual machine with Remote Desktop, you need the full DNS name of the machine. The
matlab-desktop-ipresources both list the full DNS name. Open one of those resources and copy the DNS name.
Open the Remote Desktop Connection software.
To populate the Computer field, paste the DNS name that you copied.
Click Connect to proceed.
Follow steps 6–8 in Prepopulated Connection to sign in to the VM and launch MATLAB.
Delete MATLAB Resources from Azure
You can remove the resource group and all associated resources when you are done with them to help save on costs.
Login to the Azure Portal.
Select the resource group containing the MATLAB (BYOL) resources you deployed.
Select the Delete resource group icon to delete all resources deployed in the group.
You will be prompted to confirm the deletion.
The deletion is final, and files do not persist between deployments. (See File Persistence in Azure for more information.) You need to create the resources to make them available again.
File Persistence in Azure
As you use MATLAB in Azure, all your files and changes are stored locally on the virtual machine. The files persist until you terminate the virtual machine or delete the resource group. However, stopping or shutting down the instance does not destroy the data on the virtual machine, so it is safe to shutdown the instance when you are not using it.
If you use MATLAB Drive™ to store your files on the cloud, you can install the MATLAB Drive Connector on the virtual machine to gain access to your files. See Install MATLAB Drive Connector for instructions to install the Connector on Linux.
Architecture and Resources for MATLAB on Azure
Deploying MATLAB in Azure creates several resources in your resource group. The deployment sets up a single Azure virtual machine (VM) running Linux and MATLAB, a network interface with a public IP address to connect to the VM, a network security group that controls network traffic, and a virtual network for communication between resources. The following table summarizes the resources that are created.
|Resource Name||Default Resource Name in Azure||Description|
|Virtual machine||The VM instance with pre-installed desktop MATLAB. The name you choose for this virtual machine resource acts as the root of the names for the Public IP address and Disk resources.|
|Public IP address||Public IP address to connect to the VM running MATLAB. If you select an existing Public IP resource, then the template does not create this resource.|
|Disk||The disk attached to the VM.|
|Network interface||Enables the VM to communicate with the internet, Azure, and on-premises resources.|
|Network security group||Allows or denies traffic to and from sources and destinations.|
|Virtual network||Enables resources to communicate with each other. If you select an existing virtual network resource, then the template does not create this resource.|
The architecture of these resources is summarized in the following diagram.
A preconfigured Ubuntu® VM is provided to make deployment easy. The VM contains the following software:
MATLAB, Simulink®, toolboxes, and support for GPUs.
The license used to run MATLAB determines which products and toolboxes are available for you to use. However, all products are installed on the VM, so the
vercommand returns a list of all products. To add new products to your license, see Products and Services.
Add-Ons: Deep Learning Toolbox™ Model for AlexNet Network, Deep Learning Toolbox Model for GoogLeNet Network, and Deep Learning Toolbox Model for ResNet-50 Network.
Marketplace vs. Reference Architecture
The Azure Marketplace offering only runs the latest release of MATLAB. If you need to run older releases of MATLAB, or customize the templates and automation scripts more extensively, then you can use the Reference Architecture for Microsoft Azure instead.
If you encounter an unexpected problem, search MATLAB Answers for solutions first. Most likely, other people have run into the same problem and resolved it already.
If the problem persists, or there are not any relevant posts on MATLAB Answers for the issue, contact Technical Support.