Skip to main content
Set up an Azure Linux VM with the Azure CLI, apply Network Security Group (NSG) hardening, configure Azure Bastion for SSH access, and install OpenClaw.

What you will do

  • Create Azure networking (VNet, subnets, NSG) and compute resources with the Azure CLI
  • Apply NSG rules so VM SSH is allowed only from Azure Bastion
  • Use Azure Bastion for SSH access (no public IP on the VM)
  • Install OpenClaw with the installer script
  • Verify the gateway

What you need

  • An Azure subscription with permission to create compute and network resources
  • Azure CLI installed (see Azure CLI install steps)
  • An SSH key pair (this guide covers generating one if needed)
  • About 20-30 minutes

Configure deployment

1

Sign in to Azure CLI

The ssh extension is required for Azure Bastion native SSH tunneling.
2

Register required resource providers (one time)

Verify registration; wait until both show Registered.
3

Set deployment variables

Adjust names and CIDR ranges to fit your environment. The Bastion subnet must be at least /26.
4

Select an SSH key

Use your existing public key if you have one:
Otherwise, generate one:
5

Select VM size and OS disk size

  • Start smaller for light usage and scale up later.
  • Use more vCPU/RAM/disk for heavier automation, more channels, or larger model/tool workloads.
  • If a size is unavailable in your region or subscription quota, pick the closest available SKU.
List VM sizes available in your target region:
Check your current vCPU and disk usage/quota:

Deploy Azure resources

1

Create the resource group

2

Create the network security group

Create the NSG and add rules so only the Bastion subnet can SSH into the VM.
Rules evaluate by priority, lowest number first: Bastion traffic is allowed at 100, then all other SSH is blocked at 110 and 120.
3

Create the virtual network and subnets

Create the VNet with the VM subnet (NSG attached), then add the Bastion subnet.
4

Create the VM

The VM gets no public IP. SSH access goes exclusively through Azure Bastion.
--public-ip-address "" prevents a public IP from being assigned. --nsg "" skips a per-NIC NSG since the subnet-level NSG already handles security.To pin a specific Ubuntu image version instead of latest, list available versions first:
5

Create Azure Bastion

Azure Bastion gives managed SSH access without exposing a public IP on the VM. The Standard SKU with tunneling enabled is required for CLI-based az network bastion ssh.
Bastion provisioning typically takes 5-10 minutes, but can take up to 15-30 minutes in some regions.

Install OpenClaw

1

SSH into the VM through Azure Bastion

2

Install OpenClaw (in the VM shell)

The installer installs Node and dependencies if not already present, installs OpenClaw, and launches onboarding. See Install for details.
3

Verify the gateway

After onboarding completes:
If your organization already has GitHub Copilot licenses, you can choose the GitHub Copilot provider during onboarding instead of a separate model API key. See GitHub Copilot provider.

Cost considerations

Approximate monthly costs (verify current pricing in the Azure Pricing Calculator, since rates vary by region and change over time):
  • Azure Bastion Standard SKU: roughly $140/month
  • VM (Standard_B2as_v2): roughly $55/month
To reduce costs:
  • Deallocate the VM when not in use. This stops compute billing (disk charges remain). The gateway is unreachable while deallocated.
  • Delete Bastion when not needed and recreate it when you need SSH access again; it is the largest cost component and provisions in a few minutes.
  • Use the Basic Bastion SKU (roughly $38/month) if you only need Portal-based SSH and do not need CLI tunneling (az network bastion ssh).

Cleanup

Delete all resources created by this guide:
This removes the resource group and everything inside it (VM, VNet, NSG, Bastion, public IP).

Next steps