Connect a Microsoft Azure subscription
Manage the virtual machines in an Azure subscription here, next to your other servers: see them in one list, start, stop and reboot them, and create new ones. The portal signs in as an app registration (a service principal) that you create and give a role on the subscription. Connect each subscription as its own cloud account.
1. Create an app registration
Quick way, with the Azure CLI (in the Azure portal's Cloud Shell, for example):
az ad sp create-for-rbac --name cmp-portal --role Contributor --scopes /subscriptions/<subscription-id>
It prints appId (the application ID), password (the client secret) and tenant (the directory ID). Keep them for step 2.
Least privilege, in the Azure portal:
- Open Microsoft Entra ID › App registrations › New registration, name it e.g. "cmp-portal" and select Register.
- Copy the Application (client) ID and the Directory (tenant) ID from its overview.
- Open Certificates & secrets › New client secret, choose an expiry, and copy the secret's Value. Azure shows it only once; the Secret ID is not the secret.
- Open your subscription › Access control (IAM) › Add role assignment, and give the app:
- Virtual Machine Contributor and Network Contributor, to start, stop, create and delete VMs; or
- Reader, to only list them.
2. Connect it here
- Go to Cloud accounts › Connect account and choose Microsoft Azure.
- Enter an Account name, e.g. "Azure – production", then the Directory (tenant) ID, Application (client) ID, Client secret and Subscription ID (from Subscriptions in the Azure portal).
- Select Test and connect.
The subscription's VMs appear on the Instances page within a minute, and the list refreshes every few minutes.
What you can do
| Feature | Notes |
|---|---|
| Start, Shut down, Reboot, Power off | Shut down deallocates the VM: Azure stops charging for its compute (disks and static IPs are still charged). Power off cuts the power at once but keeps the VM allocated, so compute is still charged. Use Shut down to save money. |
| Details | Size, resource group, region, creation date, whether compute is still billed, and whether it is a Spot VM. |
| Create | Create VMs with Ubuntu 24.04, Ubuntu 22.04 or Debian 12 on B-series (burstable) or Dsv5 sizes. Azure bills them to your subscription at its own prices, which are not shown here: see the Azure pricing calculator. |
What a new VM gets
- A resource group cmp-portal-<region>, shared by the VMs you create in that region, with a virtual network and a network security group that only lets SSH (port 22) in. To open other ports (e.g. 80 and 443 for a website), add rules to the cmp-portal-ssh security group in the Azure portal.
- Its own static public IPv4 address, network interface and a 30 GB system disk (Standard SSD, or Premium SSD if you choose it).
- An admin user azureuser with your SSH keys, because Azure does not allow "root" as the admin user. The same keys also work for root, and the root password you choose is set on first boot.
Deleting the VM here also deletes its network interface, public IP and system disk. The shared resource group, network and security group stay; delete the resource group in the Azure portal once it is empty, if you like.
Usage graphs, backups, the console and rescue mode are not available for Azure yet: use the Azure portal.
If it fails
| Message | What to do |
|---|---|
| Azure refused the client secret | Copy the secret's Value, not its ID. If it is lost, create a new secret. |
| The client secret has expired | Create a new secret, then disconnect and connect the account again with it. |
| The app registration may not do this | Give the app Virtual Machine Contributor and Network Contributor on the subscription. |
| Azure could not find the subscription | Check the subscription ID, and that the app has a role on it. |
| The subscription has not registered … resource provider | In Subscriptions › Resource providers, register Microsoft.Compute and Microsoft.Network. |
| This size is not available in this region | Choose another size or region. New subscriptions can't use every size everywhere. |
| Azure quota: … | Your subscription's vCPU quota is used up. Request more under Subscriptions › Usage + quotas, or choose a smaller size. |
The client secret is encrypted when stored and never shown again. Actions are recorded in the audit log.