Deploy Clavister NetShield in Azure with the Azure CLI

Last modified on 25 Nov, 2026. Revision 5


Overview

At the end you have one NetShield in Azure with a public IP. You manage it with SSH, only from your own IP address. It does not forward any traffic yet. It runs in demo mode until you install the license in step 12.

The work in short:

  • Convert the cOS Stream image to a VHD file and upload it to Azure (steps 2 to 4).
  • Make a snapshot (a copy of a disk) from the file. The snapshot is the template for your NetShield VMs (step 5).
  • Choose the number of vCPU, make a disk from the snapshot and start NetShield from it as a virtual machine, a VM (steps 6 and 7).
  • Set up the network and SSH access in the Azure Serial Console (steps 8 and 9).
  • Open the network security group after the basic setup, so NetShield can be reached (step 10).
  • Log in with SSH and set your final password (step 11).
  • Register the license in MyClavister and install it (step 12).

Time: about 15 minutes when the tools are installed.

Cost: from step 7, Azure charges per hour for the VM, and for its disk and public IP. The snapshot costs a little. See the Azure pricing calculator for the prices in your region. The section Remove everything at the end deletes it all.

The example uses the Azure region swedencentral (Sweden Central), the cOS Stream image for x86_64, and a VM with 8 vCPU and 16 GB memory. Step 6 explains how to choose the number of vCPU.

Requirements

The commands are for a Linux or macOS terminal. On Windows, run wsl --install in PowerShell as administrator, restart the computer and open Ubuntu from the Start menu. Install all tools below inside Ubuntu with the Linux instructions, and run all commands there. Your Windows Downloads folder is /mnt/c/Users/<your Windows user>/Downloads in Ubuntu.

  • An Azure subscription where you have the role Owner or Contributor. If you created the subscription yourself, you are Owner.
  • Azure CLI version 2.60 or later, installed as described in How to install the Azure CLI. Check the version with az version.
  • qemu-img to convert the image:
    • Debian or Ubuntu: sudo apt install qemu-utils
    • RHEL or Fedora: sudo dnf install qemu-img
    • macOS: brew install qemu
  • The cOS Stream image for KVM from MyClavister. Step 3 converts it for Azure. If the download is a zip file, unpack it. The image file name ends with virtual-x64-generic.qcow2.
  • openssl, curl and an SSH client with scp. Most Linux and macOS systems have them. If not, install them like qemu-img, for example sudo apt install openssl curl openssh-client.
  • About 2 GB of free disk space.
  • A MyClavister account, for the image download and for the license in step 12, and the license number of your NetShield license. You get the license number from your reseller.

How to use the commands

  • The Azure CLI is the az command in your own terminal. Do not use Cloud Shell in the Azure portal, because the image file is on your computer.
  • Copy each command block as a whole. A line that ends with a backslash (\) continues on the next line. If a block has a value that you must change, paste it into a text editor first, change it, and then copy it to the terminal.
  • You type NetShield commands only in the NetShield CLI: on the serial console in step 9, after ssh in steps 11 and 12, and in If your own IP changes. The NetShield prompt is System:/>. All other commands run in your own terminal.
  • A line like RG=... saves a value in a shell variable. Later commands use it as $RG. Variables only exist in the terminal window where you set them, so use the same window for all steps. If you close it, see If you closed the terminal at the end.
  • Check a variable with echo, for example echo $RG. If it shows nothing, the value is not set. Run the command before it again and check its output before you go on.
  • If a command shows an error, fix it before you go on.
  • On a phone, swipe a command block sideways to see the end of long lines.

How to set this up

Steps 1 to 5 prepare the snapshot. You do them one time. Steps 6 to 12 start and set up one NetShield.

Step 1 - Log in to Azure

az login

Your browser opens. Log in the same way as to the Azure portal, then go back to the terminal. The CLI lists your subscriptions. Type the number of the subscription to use, or press Enter to keep the one marked with *.

If no browser opens, for example in WSL, use this command instead:

az login --use-device-code

It shows a URL and a code. Open the URL in a browser, type the code and log in.

Check the login:

az account show --query "{subscription:name, user:user.name}" --output table

You see the name of the subscription and your user name.

To use another subscription, run az account set --subscription "<subscription name>".

Step 2 - Set variables

Go to the folder with the image file, for example cd /mnt/c/Users/<your Windows user>/Downloads in WSL. Show the exact file name with ls *.qcow2.

In the block below, replace the IMAGE value with your file name, without .qcow2. Then run it.

LOCATION=swedencentral
RG=clavister-ns
IMAGE=clavister-cos-stream-4.10.02.10-virtual-x64-generic
STORAGE=clavister$(openssl rand -hex 4)
echo $LOCATION $RG $IMAGE $STORAGE

The last line shows all four values. What the lines do:

  • LOCATION is the Azure region. To see the names of all regions, run az account list-locations --output table.
  • RG is the name of the resource group. A resource group is a folder in Azure that holds everything this guide creates. At the end you can delete it all in one step.
  • IMAGE saves the image name, so later commands can use $IMAGE.
  • STORAGE is the name of the storage account for the upload, for example clavister3f9a1c2e. $(...) runs a command and uses its output. Here it adds 8 random characters, because the name must be unique in all of Azure.

Step 3 - Convert the image to VHD

Azure uses disk images in the VHD format, with a fixed size. vpc is the name that qemu-img uses for VHD.

qemu-img convert -f qcow2 -O vpc -o subformat=fixed,force_size $IMAGE.qcow2 $IMAGE.vhd

The command prints nothing when it works. Check the new file with ls -lh $IMAGE.vhd. It is about 1 GB. If qemu-img says that it cannot open the file, the IMAGE value or the folder is wrong. See step 2.

Step 4 - Upload the image

A storage account is file storage in Azure, and a container is a folder in it. A disk file must be uploaded as a page blob (--type page).

az group create --name $RG --location $LOCATION --output none
az storage account create --resource-group $RG --name $STORAGE \
  --location $LOCATION --sku Standard_LRS --allow-blob-public-access false --output none
KEY=$(az storage account keys list --resource-group $RG --account-name $STORAGE \
  --query "[0].value" --output tsv)
az storage container create --account-name $STORAGE --account-key $KEY \
  --name vhds --output none
az storage blob upload --account-name $STORAGE --account-key $KEY --container-name vhds \
  --name $IMAGE.vhd --file $IMAGE.vhd --type page --output none

The storage account takes about 30 seconds. The upload takes from a few seconds to a few minutes, depending on your internet speed. It shows the progress and ends with Finished. If a line shows an error, fix it and run the block again from that line. KEY is the access key of the storage account. It works like a password, so do not share it.

Step 5 - Create the snapshot

The snapshot is the template that you make a disk from for each NetShield. Azure has two VM types: Generation 1 VMs start with BIOS, and Generation 2 VMs start with UEFI. This image needs Generation 1, so the command uses --hyper-v-generation V1.

STORAGE_ID=$(az storage account show --resource-group $RG --name $STORAGE \
  --query id --output tsv)
az snapshot create --resource-group $RG --name $IMAGE \
  --source https://$STORAGE.blob.core.windows.net/vhds/$IMAGE.vhd \
  --source-storage-account-id $STORAGE_ID --hyper-v-generation V1 \
  --sku Standard_LRS --query provisioningState --output tsv

You should see Succeeded.

The snapshot is a separate copy, so the storage account is not needed any more. Delete it, so it does not cost money:

az storage account delete --resource-group $RG --name $STORAGE --yes

Step 6 - Choose the number of vCPU

NetShield needs at least 2 vCPU. On 2 vCPU, management and traffic share both vCPU, and both show the role Data plane.

With more vCPU, NetShield sets up the vCPU by itself at each start. It first gives vCPU to its fixed roles: the control plane (management, routing, logging), a scheduler, the data plane and the I/O threads that move packets to and from the network interface. These fixed roles use 5 vCPU on 8 vCPU, and 6 vCPU on 16 vCPU. Every vCPU above that becomes a worker that handles traffic, and more workers give more throughput. You see the roles in step 11.

This is how NetShield uses the vCPU on the Fsv2 VM sizes, a family of Azure VM sizes made for compute work. They have 2 GB memory per vCPU:

VM sizevCPUFixed rolesWorkers for traffic
Standard_F2s_v22SharedShared
Standard_F8s_v2853
Standard_F16s_v216610

Use 2 vCPU for small setups and tests. For more traffic, use 8 vCPU or more. Larger sizes add more workers in the same way. All sizes in the table support Generation 1 VMs. You can change the size later, see Good to know.

Set the VM size you chose:

TYPE=Standard_F8s_v2

Azure limits how many vCPU you can use per region and per VM size family. Check your limits before step 7:

az vm list-usage --location $LOCATION --output table

Look at the rows Total Regional vCPUs and Standard FSv2 Family vCPUs. In both rows, Limit minus CurrentValue must be at least the number of vCPU you chose, for example 8. If not, see Raise the vCPU quota in Good to know.

Step 7 - Start NetShield

az disk create --resource-group $RG --name clavister-ns-disk --source $IMAGE \
  --sku StandardSSD_LRS --output none
PUBLIC_IP=$(az vm create --resource-group $RG --name clavister-ns \
  --attach-os-disk clavister-ns-disk --os-type linux --size $TYPE \
  --public-ip-sku Standard --nsg-rule NONE --accelerated-networking false \
  --query publicIpAddress --output tsv)
az vm boot-diagnostics enable --resource-group $RG --name clavister-ns
echo $PUBLIC_IP

az vm create shows a message about Azure Trusted Launch. No action is needed. Trusted Launch is for Generation 2 VMs, and this guide uses Generation 1.

The last line shows the public IP of NetShield. Write it down. From now on Azure charges per hour for the VM. If az vm create answers that the quota is too low, raise the quota (see Good to know), then run the block again from the PUBLIC_IP= line. The disk is already there.

What the commands do:

  • az disk create makes the disk of NetShield from the snapshot of step 5. The snapshot has the same name as the image, so --source $IMAGE means the snapshot.
  • --attach-os-disk starts the VM from the disk as it is. Azure does not try to set up a user or a password in it.
  • --os-type linux: Azure needs an OS type, and linux is right for cOS Stream.
  • az vm create also makes a virtual network, a network interface and a public IP for the VM.
  • --nsg-rule NONE creates a network security group (NSG) called clavister-nsNSG without any rules. An NSG is the Azure packet filter in front of the VM. Without rules, it blocks all traffic from the internet.
  • --accelerated-networking false gives the VM the standard Azure network interface, which NetShield uses.
  • boot-diagnostics enable turns on the serial console for the VM.

The first start takes about 2 minutes.

Step 8 - Open the serial console

NetShield starts without network settings. So the first setup uses the Azure Serial Console, which works like a console cable to NetShield. The NSG stays closed until step 10, after you have set the password and limited management access.

First find your own public IP address and write it down. You type it in step 9.

curl https://ipv4.icanhazip.com

You can also open the same address in a browser.

Add the serial console to the Azure CLI (only needed one time):

az extension add --name serial-console

The Azure CLI says that serial-console is a preview extension, and installs it. No action is needed.

After the next command, this terminal window shows the NetShield console. You leave it at the end of step 9.

az serial-console connect --resource-group $RG --name clavister-ns

When the connection is open, press Enter. The line Connected to the serial port of the VM can scroll past with the output from the start. If you see nothing, wait one minute and press Enter again.

The NetShield console opens the CLI directly, without a login. Access to the serial console is controlled by the rights in your Azure account. You see the CLI prompt System:/>. Before it, the console can show lines from the start. They are normal for a new NetShield in Azure:

  • a note that NetShield runs in demo mode until you install a license (step 12)
  • a note that 1 new ethernet device was added and that you should run activate and commit. Step 9 does this.
  • a note that the boot loader configuration should be updated. You do not need to run the command in the note. The restart at the end of step 9 does this.

Step 9 - Set up the network and SSH access

Type these commands in the NetShield CLI (System:/>). Type or paste one line at a time. A set or add command that works shows a short confirmation, for example Modified RemoteMgmtSSH/RemoteMgmtSSH. If you see an error, check the spelling and type the line again.

Get the IP address from Azure with DHCP, and add a default route through the Azure gateway. DHCP fills in if1_gw by itself. if1 is the network interface of NetShield in Azure.

set EthernetInterface if1 DHCPEnabled=Yes
cc RoutingTable main
add Route Interface=if1 Network=all-nets-ip4 Gateway=if1_gw
cc

cc RoutingTable main opens the main routing table, and the prompt changes to System:/RoutingTable/main>. cc alone goes back to System:/>.

Set a temporary admin password. Replace YourTemporaryPassword with a strong password. Do not use double quotes in the password. You set your final password over SSH in step 11, because Azure keeps what you type on the serial console in the boot diagnostics log of the VM.

cc LocalUserDatabase AdminUsers
set User admin Password="YourTemporaryPassword"
cc

Turn on SSH management, only from your own public IP from step 8. Replace 203.0.113.10 with your own IP. RemoteMgmtSSH is there two times on purpose: the first is the object type, the second is its name.

add Address IPAddress mgmt_admin Address=203.0.113.10
set RemoteManagement RemoteMgmtSSH RemoteMgmtSSH -enable
set RemoteManagement RemoteMgmtSSH RemoteMgmtSSH SourceInterface=if1 SourceNetwork=mgmt_admin

You can also use a network, for example Address=203.0.113.0/24.

Save the changes with activate. Wait until the console shows this text:

Run the "commit" command to keep the new configuration.

Then type commit within 30 seconds. Without commit, NetShield goes back to the previous configuration by itself, which protects you if a change breaks your connection. If the 30 seconds pass without commit, type activate and commit again.

activate can show two lines that start with Config warning. Both are normal on a new NetShield in Azure: one says that there is no license yet (demo mode), and one is about all-multicast mode on if1, which Azure networks do not use. No action is needed.

The first setup needs one restart, so that the boot loader configuration is updated. Type shutdown. This restarts NetShield. The VM keeps running. NetShield is back after about 1 minute and the serial console stays connected. Press Enter to see the prompt again.

Check that DHCP works with ifstat if1. IP Address must be the private IP of the VM, usually 10.0.0.4, and DHCP state must be BOUND. If it is not BOUND yet, wait one minute and run ifstat if1 again.

Leave the console:

  • Press Ctrl+]. A small menu appears.
  • Press q. Do not press r, because it restarts the VM. You are back in your own terminal.
  • If Ctrl+] does not work on your keyboard, close the terminal window and open a new one, see If you closed the terminal.

Step 10 - Open the network security group

Do this only after step 9. Now it is safe: NetShield has your temporary password and accepts SSH only from your IP. NetShield does the filtering, so the NSG lets all traffic in and you keep only one set of rules.

Type this in your own terminal:

az network nsg rule create --resource-group $RG --nsg-name clavister-nsNSG \
  --name allow-all-netshield-filters --priority 100 --direction Inbound --access Allow \
  --protocol "*" --source-address-prefixes "*" --destination-port-ranges "*" \
  --query provisioningState --output tsv

You should see Succeeded.

Step 11 - Log in with SSH

From the computer with the IP you allowed in step 9:

ssh admin@$PUBLIC_IP

Answer yes if SSH asks about the host key, and log in as admin with the temporary password from step 9.

If SSH does not connect, check that your own IP is still the same (step 8), that you typed commit in step 9, and that step 10 showed Succeeded.

Now set your final password. Azure keeps the console output, with the temporary password, in the boot diagnostics log of the VM. What you type over SSH is not kept there.

cc LocalUserDatabase AdminUsers
set User admin Password="YourFinalPassword"
cc

Save it with activate, wait for the commit text, and type commit, as in step 9. The SSH connection stays open.

To see how NetShield uses the vCPU, type system -cpuinfo -verbose. The Role column shows each vCPU: control plane, scheduler, data plane, I/O or worker. On Standard_F8s_v2 you see 3 vCPU with the role Worker.

Type exit to leave the NetShield CLI.

NetShield does not forward any traffic until you add IP rules. This guide does not cover that. See the cOS Stream Administration Guide.

Step 12 - Install a license

Without a license, NetShield runs in demo mode for 2 hours after each start. After that, only management access works, so you can still log in and install the license.

The license is bound to the MAC address of if1. Azure keeps the MAC address when you stop, start or resize the VM.

Get the MAC address. If you are not logged in, log in with SSH as in step 11, now with your final password. Type ifstat if1 in the NetShield CLI. Write down the value after MAC, for example 70:a8:a5:51:7a:55. Then type exit.

Register the license in MyClavister, with the same account as for the image download:

  • Select Register License, then NetShield.
  • Select the product type Virtual Model, and enter the license number and the MAC address of if1.
  • After the registration, select Licenses, then License List, and select the new license.
  • Select Download and save the license file in the same folder as the image file (step 2). Check the file name in your terminal with ls *.lic.

Upload the license file to NetShield. Type this in your own terminal, not in the NetShield CLI. Use your own file name instead of netshield.lic, and keep the colon at the end. Without it, scp makes a copy on your own computer and nothing goes to NetShield.

scp -O netshield.lic admin@$PUBLIC_IP:

When scp asks for the password, type your final password from step 11. When the copy works, scp shows the file name and 100%. The option -O makes scp use the classic SCP protocol, which NetShield uses. Without -O, newer scp versions stop with subsystem request failed on channel 0. Leave out -O only if your scp says that it does not know the option.

Then log in with SSH again, with your final password, and activate the license, with your own file name:

license activate netshield.lic

Check the license with license. It should show your new license, with the MAC address of if1.

For more information, see Register a License and Bind It in the Virtual cOS Stream Getting Started Guide.

Good to know

The commands below use the variables from the steps above. In a new terminal, set them first, see If you closed the terminal.

The public IP stays the same. The public IP from step 7 is static. It stays when you stop and start the VM, until you delete it.

Change the number of vCPU later. Check the quota first, as in step 6. Stop the VM, change the size and start it again. NetShield splits the new vCPU by itself at the start. The public IP, the private IP and the MAC address stay the same, so the license still fits.

az vm deallocate --resource-group $RG --name clavister-ns
az vm resize --resource-group $RG --name clavister-ns --size Standard_F16s_v2 --output none
az vm start --resource-group $RG --name clavister-ns

deallocate stops the VM, and Azure does not charge for the VM while it is stopped. The disk and the public IP still cost a little.

If your own IP changes. NetShield accepts SSH only from the IP you set in step 9. Open the serial console as in step 8 and type the lines below, with your new IP. After activate, wait for the commit text before you type commit, as in step 9.

set Address IPAddress mgmt_admin Address=203.0.113.20
activate
commit

Raise the vCPU quota. A new subscription can have a low vCPU limit per region and per VM size family. In the Azure portal, search for Quotas, select Compute, and request a higher limit for Total Regional vCPUs and Standard FSv2 Family vCPUs in your region. Check your limits with az vm list-usage --location $LOCATION --output table.

Start one more NetShield. Run step 7 again from the same snapshot, with other names for the disk and the VM, for example clavister-ns2-disk and clavister-ns2, also in the boot-diagnostics line. $PUBLIC_IP then holds the IP of the new VM. Use the new VM name also in steps 8 and 10. The NSG then gets the name clavister-ns2NSG. Each NetShield needs its own license, bound to its own MAC address.

Route traffic for other servers. To route other servers in Azure through NetShield, you need more than this guide covers, for example a second network interface and Azure route tables. One of the steps is to turn on IP forwarding on the network interface of NetShield:

az network nic update --resource-group $RG --name clavister-nsVMNic --ip-forwarding true

If you closed the terminal

The variables are gone in a new terminal. Go back to the folder with the image file with cd, and set the variables again. Use your own image name, region and VM size.

LOCATION=swedencentral
RG=clavister-ns
IMAGE=clavister-cos-stream-4.10.02.10-virtual-x64-generic
TYPE=Standard_F8s_v2
PUBLIC_IP=$(az vm show --show-details --resource-group $RG --name clavister-ns \
  --query publicIps --output tsv)
echo $PUBLIC_IP

Before step 7 there is no VM yet, so the PUBLIC_IP line shows a “not found” message. You can ignore it.

If you closed the terminal before step 4, run step 2 again instead. If you closed it between step 4 and step 5, also set the storage account variables again:

STORAGE=$(az storage account list --resource-group $RG --query "[0].name" --output tsv)
KEY=$(az storage account keys list --resource-group $RG --account-name $STORAGE \
  --query "[0].value" --output tsv)

Remove everything

This deletes NetShield and everything else in the resource group: the VM, its disk, the public IP, the network, the NSG and the snapshot. It cannot be undone. In a new terminal, first set the variables, see If you closed the terminal.

The license stays registered in MyClavister to the MAC address of this VM. A new VM gets a new MAC address, so it needs a license that is registered to its own MAC address.

az group delete --name $RG --yes

This takes 2 to 5 minutes. A progress indicator shows while it runs. Do not stop it. The command prints nothing when it is done.

Azure also creates a resource group called NetworkWatcherRG in some subscriptions. It is shared by all networks in the subscription and costs nothing. Leave it.

On your computer you can delete the .qcow2 and .vhd image files and the license file.

Deploy Clavister NetShield in Proxmox VE
27 Mar, 2025 stream proxmox
Deploy Clavister NetWall in Proxmox VE
28 Oct, 2025 core proxmox kvm