To deploy this reference architecture, you must have the following permissions that allow you to create and assign Azure® roles in your subscription:
Microsoft.Authorization/roleDefinitions/write
Microsoft.Authorization/roleAssignments/write
To check if you have these permissions for your Azure subscription, follow the steps mentioned in Check access for a user to Azure resources.
If you do not have these permissions, you can obtain them in two ways:
-
The built-in Azure role User Access Administrator contains the above-mentioned permissions. Administrators or Owners of the subscription can directly assign you this role in addition to your existing role. To assign roles using the Azure portal, see Assign Azure roles.
-
The Azure account administrator or Owner can also create a custom role containing these permissions and attach it along with your existing role. To create custom roles using the Azure portal, see Create Custom roles.
To get a list of Owners in your subscription, see List Owners of a Subscription.
Click the Deploy to Azure button below to deploy the cloud resources on Azure. This will open the Azure Portal in your web browser.
Create Virtual Network | Use Existing Virtual Network |
---|---|
Use this option to deploy the resources in a new virtual network |
Use this option to deploy the resources in an existing virtual network |
VM Platform: Ubuntu 22.04
MATLAB® Release: R2022b
To deploy a custom machine image, see Deploy Your Own Machine Image.
Clicking the Deploy to Azure button opens the "Custom deployment" page in your browser. You can configure the parameters on this page. It is easier to complete the steps if you position these instructions and the Azure Portal window side by side. Create a new resource group by clicking Create New. Alternatively, you can select an existing resource group, but this can cause conflicts if resources are already deployed in it.
- Specify and check the defaults for these resource parameters:
Parameter label | Description |
---|---|
Vm Size | The Azure instance type to use for the VM. For a list of instance types, see Sizes for virtual machines in Azure. |
Client IP Addresses | The IP address range that can be used to access the VM. This must be a valid IP CIDR range of the form x.x.x.x/x. Use the value <your_public_ip_address>/32 to restrict access to only your computer. |
Admin Username | Admin username for the VM running MATLAB. To avoid any deployment errors, check the list of disallowed values for adminUsername. |
Admin Password | Choose the password for the admin username. This password is required when logging in remotely to the instance. For the deployment to succeed, your password must meet Azure's password requirements. |
Virtual Network Resource ID | The Resource ID of an existing virtual network to deploy your VM into. You can find this under the Properties of your virtual network. Specify this parameter only when deploying with the Existing Virtual Network option. |
Subnet Name | The name of an existing subnet within your virtual network to deploy your VM into. Specify this parameter only when deploying with the Existing Virtual Network option. |
Auto Shutdown | Select the duration after which the VM should be automatically shut down post launch. |
Access Protocol | Access protocol to connect to this VM. Selecting 'NICE DCV' will enable NICE DCV using a 30-days demo license (unless a production license is provided). You can access the desktop on a browser using the NICE DCV connection URL in the Outputs section of the deployment page once the resource group is successfully deployed. By using NICE DCV, you agree to the terms and conditions outlined in NICE DCV End User License Agreement. If you select 'RDP', NICE DCV will not be enabled, and you can connect to this VM using a RDP connection. |
NICE DCV License Server | If you have selected NICE DCV as the remote access protocol and have a production license, use this optional parameter to specify the NICE DCV license server's port and hostname (or IP address) in the form of port@hostname. This field must be left blank if you have opted to use RDP or want to use NICE DCV with a demo license. |
MATLAB License Server | Optional License Manager for MATLAB, specified as a string in the form port@hostname. If you do not provide this string, MATLAB uses online licensing. If you provide this string, ensure that the license manager is accessible from the specified virtual network and subnets. For more information, see Network License Manager for MATLAB on Microsoft Azure. |
Optional User Command | Provide an optional inline shell command to run on machine launch. For example, to set an environment variable CLOUD=AZURE, use this command excluding the angle brackets: <echo -e "export CLOUD=AZURE" | sudo tee -a /etc/profile.d/setenvvar.sh && source /etc/profile>. To run an external script, use this command excluding the angle brackets: <wget -O /tmp/my-script.sh "https://example.com/script.sh" && bash /tmp/my-script.sh>. Find the logs at '/var/log/mathworks/startup.log'. |
NOTE: If you are using network license manager, the port and hostname of the network license manager must be reachable from the MATLAB VMs. It is therefore recommended that you deploy into a subnet within the same virtual network as the network license manager.
-
Click the Review + create button.
-
Review the Azure Marketplace terms and conditions and click the Create button.
Note: Complete these steps only after your resource group has been successfully created.
-
In the Azure Portal, on the navigation panel on the left, click Resource groups. This will display all your resource groups.
-
Select the resource group you created for this deployment from the list. This will display the Azure blade of the selected resource group with its own navigation panel on the left.
-
Select the resource labeled matlab-publicIP. This resource contains the public IP address to the virtual machine that is running MATLAB.
-
Copy the IP address from the IP address field.
-
If you chose not to enable NICE DCV during deployment, launch any remote desktop client, paste the IP address in the appropriate field, and connect. For example, on the Windows Remote Desktop Client, paste the IP address in the Computer field and click Connect.
-
If you enabled NICE DCV during deployment, you can access the virtual machine's desktop via the url
https://<public-ip-of-vm>:8443
. Note: While using NICE DCV, the desktop cannot be accessed using remote desktop clients other than the NICE DCV client. -
In the login screen, use the username and password you specified while configuring cloud resources in Step 2.
Double-click the MATLAB icon on the virtual machine desktop to start MATLAB. The first time you start MATLAB, you need to enter your MathWorks® Account credentials to license MATLAB. For other ways to license MATLAB, see MATLAB Licensing in the Cloud.
Note: It may take up to a minute for MATLAB to start the first time.
For details of the scripts which form the basis of the MathWorks Linux VHD build process, see Build Your Own Machine Image. You can use these scripts to build your own custom Linux machine image for running MATLAB on Azure. You can then deploy this custom image with the following MathWorks infrastructure as code (IaC) templates.
To launch a custom image, the following fields are required by these templates.
Argument Name | Description |
---|---|
Custom VHD |
URL of custom VHD. This is the artifact_id listed in the manifest.json . |
Custom VHD Storage Account |
Storage account that contains the custom VHD. This is the storage account that was specified in the Packer build using the STORAGE_ACCOUNT parameter. |
Custom VHD Resource Group |
Resource group that contains the custom VHD. This is the resource group that was specified in the Packer build using the RESOURCE_GROUP_NAME parameter. |
If you wish to switch from NICE DCV to xRDP, run the following command using Azure CLI or Azure Cloud Shell:
az vm run-command invoke --command-id RunShellScript --resource-group <RESOURCE_GROUP_NAME> --name <VM_NAME> --script "/usr/local/bin/swap-desktop-solution.sh rdp"
To switch from xRDP to NICE DCV, run:
az vm run-command invoke --command-id RunShellScript --resource-group <RESOURCE_GROUP_NAME> --name <VM_NAME> --script "/usr/local/bin/swap-desktop-solution.sh dcv"
Here, <RESOURCE_GROUP_NAME>
denotes the name of the resource group created in Step 2 and <VM_NAME>
is the name of the VM running MATLAB (for example - matlab-vm
).
If you want to configure the NICE DCV server running on the matlab-vm
to use a production license, follow these instructions:
-
If you have a production license file, copy it to the
matlab-vm
under the path/usr/share/dcv/license
. -
Navigate to
/etc/dcv/
, and open thedcv.conf
with a text editor. -
Locate the
license-file
parameter in the[license]
section, and enter the full path to the license file copied in step 1. -
If you have an RLM (Reprise License Manager) server instead of a license file, modify the value of the
license-file
parameter to point to the port and hostname of the server in the formatport@hostname
. -
Once you modify the
dcv.conf
file, restart the NICE DCV server and apply the changes using:sudo systemctl restart dcvserver
.
For more information about licensing NICE DCV, see Installing a production license.
You can remove the Resource Group and all associated resources when you are done with them. Note that you cannot recover resources once they are deleted.
- Login to the Azure Portal.
- Select the resource group containing your resources.
- Select the Delete resource group icon to destroy all resources deployed in this group.
- You will be prompted to enter the name of the resource group to confirm the deletion.
If your resource group fails to deploy, check the Deployments section of the Resource Group. It will indicate which resource deployments failed and allow you to navigate to the causing error message.
Copyright 2018-2024 The MathWorks, Inc.