You can deploy the CloudRay Agent on Azure Virtual Machines using two main approaches:

The CloudRay Agent enables secure, real-time server management and metric collection without requiring SSH access to your virtual machine.

TIP

Make sure you have a CloudRay account and locate your REG_CODE in your project dashboard.

Option 1: New Azure VM (via User Data)

Use cloud-init to automatically install and register the CloudRay Agent when provisioning a new virtual machine.

  1. In the Azure Portal, begin creating a new Virtual Machine.
  2. Under the Advanced tab, find the Custom data section.
Azure VM Custom Data cloud-init field
  1. Paste the following cloud-init compatible shell script (replace <REG_CODE>):
#!/bin/bash
curl -sSfL https://cloudray.io/install.sh | sudo bash
sudo cloudray-agent install-service --reg-code <REG_CODE>

The installation script is safe to run multiple times. It checks for existing Agent and upgrades them if a newer version is available.

  1. Complete the rest of the VM creation steps and deploy the instance.

Option 2: Existing Azure VMs

If you already have a running virtual machine, you can install the Agent manually using SSH or Azure Bastion.

  1. Connect to your VM via SSH or Azure Bastion
  2. Run the following commands:
curl -sSfL https://cloudray.io/install.sh | sudo bash
sudo cloudray-agent install-service --reg-code <REG_CODE>
  1. Head to your CloudRay dashboard, go to Machines, and verify that your Azure VM is listed as connected.

Alternative: Connect via SSH

If you’re unable to install the CloudRay Agent directly on your server, you can still connect and manage your server via SSH. CloudRay supports executing scripts over a standard SSH connection.

Keep in mind that some advanced functionalities—such as real-time monitoring and task syncing—are only available when the Agent is installed.

To learn more about managing machines using SSH, see the Managing Server SSH Keys documentation.