🚀 DAY 4 OF LAUNCH WEEK:Introducing Socket Scanning for OpenVSX Extensions.Learn more
Socket
Book a DemoInstallSign in
Socket

@todesktop/az-vm

Package Overview
Dependencies
Maintainers
3
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@todesktop/az-vm

Quick and easy Azure VM creation CLI tool supporting Windows and Linux VMs

latest
Source
npmnpm
Version
1.0.0
Version published
Maintainers
3
Created
Source

@todesktop/az-vm

Quick and easy Azure VM creation CLI tool supporting Windows and Linux VMs.

Features

  • 🚀 Quick VM Creation - Create VMs with a single command
  • 🖥️ Multi-OS Support - Windows 11/10, Ubuntu, Debian, CentOS, and more
  • 🔐 Secure Passwords - Auto-generates secure passwords meeting Azure requirements
  • 📍 Smart Defaults - Sensible defaults for all parameters
  • 🌍 Global Regions - Support for all Azure regions
  • 💰 Cost Conscious - Includes commands to stop/delete VMs when not in use

Prerequisites

  • Azure CLI installed
  • Azure account with active subscription
  • Logged in to Azure CLI (az login)

Installation

You don't need to install this tool! Use it directly with npx:

npx @todesktop/az-vm

Or install globally if you prefer:

npm install -g @todesktop/az-vm

Usage

Quick Start

Create a Windows 11 VM with all defaults:

# Using npx (no installation required)
npx @todesktop/az-vm

# Using global install
az-vm

Create an Ubuntu VM:

# Using npx
npx @todesktop/az-vm --image=ubuntu

# Using global install
az-vm --image=ubuntu

Examples

# Windows 10 in UK South
npx @todesktop/az-vm --image=windows-10 --location=uksouth
# or with global install: az-vm --image=windows-10 --location=uksouth

# Ubuntu with custom name
npx @todesktop/az-vm --image=ubuntu --name=my-dev-server
# or with global install: az-vm --image=ubuntu --name=my-dev-server

# Windows Server 2022 with larger size
npx @todesktop/az-vm --image=windows-server-2022 --size=Standard_D4s_v3

# Custom image URN
npx @todesktop/az-vm --image=Canonical:0001-com-ubuntu-server-jammy:22_04-lts:latest

Available Options

OptionDescriptionDefault
--locationAzure regionnortheurope
--nameVM nameAuto-generated
--sizeVM sizeStandard_D2s_v3
--imageOS image preset or URNwindows-11
--resourceGroupResource group nameAuto-generated
--usernameAdmin usernameazureuser
--passwordAdmin passwordAuto-generated
--helpShow help-

Image Presets

PresetDescription
windows-11Windows 11 Pro (default)
windows-10Windows 10 Pro
windows-server-2022Windows Server 2022 Datacenter
windows-server-2019Windows Server 2019 Datacenter
ubuntuUbuntu 22.04 LTS
ubuntu-20Ubuntu 20.04 LTS
debianDebian 11
centosCentOS 7.9
rhelRed Hat Enterprise Linux 8
suseSUSE Linux Enterprise Server 15

VM Sizes

SizevCPUsRAMDescription
Standard_D2s_v328 GBDefault, general purpose
Standard_D4s_v3416 GBBetter performance
Standard_D8s_v3832 GBHigh performance
Standard_B2s24 GBBurstable, cost-effective
Standard_B2ms28 GBBurstable with more RAM

Common Locations

LocationDescription
northeuropeIreland (default)
uksouthUK South
westeuropeNetherlands
eastusVirginia
westusCalifornia

Connecting to Your VM

Windows VMs

Windows VMs come with Remote Desktop (RDP) enabled out of the box. Simply:

1. Open Microsoft Remote Desktop (built into Windows, available for Mac/iOS/Android)
2. Enter the provided IP address
3. Username: .\azureuser
4. Use the generated password

No additional setup required!

Linux VMs

Linux VMs are created as servers without a GUI by default. Connect via SSH:

ssh azureuser@<ip-address>

Setting up GUI Access (Optional)

Unlike Windows VMs, Linux VMs require additional setup for remote desktop access. Here are your options:

For Ubuntu/Debian:

  • Install desktop environment and VNC server:
# Update packages
sudo apt update

# Install lightweight desktop environment (XFCE) and VNC
sudo apt install xfce4 xfce4-goodies tightvncserver -y
  • Configure VNC:
# Start VNC server to create config files
vncserver

# You'll be prompted to create a VNC password (max 8 characters)
# Kill the server after initial setup
vncserver -kill :1

# Backup and edit the startup script
mv ~/.vnc/xstartup ~/.vnc/xstartup.bak
nano ~/.vnc/xstartup
  • Add this content to ~/.vnc/xstartup:
#!/bin/bash
xrdb $HOME/.Xresources
startxfce4 &
  • Make it executable and start VNC:
chmod +x ~/.vnc/xstartup
vncserver -geometry 1920x1080 -depth 24
  • Open VNC port in Azure (5901):
az vm open-port --resource-group <resource-group> --name <vm-name> --port 5901
  • Connect from your local machine:
  • Download a VNC client (RealVNC, TightVNC, or TigerVNC)
  • Connect to: <vm-ip>:5901
  • Use the VNC password you created

For better performance, use X2Go instead:

# Install X2Go server
sudo apt-add-repository ppa:x2go/stable
sudo apt update
sudo apt install x2goserver x2goserver-xsession -y

Then use X2Go Client on your local machine to connect.

xRDP allows you to use Windows Remote Desktop to connect to Linux:

# Install xRDP and desktop environment
sudo apt update
sudo apt install ubuntu-desktop xrdp -y

# Configure xRDP to use port 3389
sudo systemctl enable xrdp
sudo systemctl restart xrdp

# For better performance with xRDP
echo "exec startxfce4" > ~/.xsession

Then connect using Windows Remote Desktop client to port 3389.

Managing Your VM

Stop VM (save costs)

az vm stop --resource-group <resource-group> --name <vm-name>

Start VM

az vm start --resource-group <resource-group> --name <vm-name>

Delete Everything

az group delete --name <resource-group> --yes

Tips

  • 🕐 First connection to Windows VMs may take 2-3 minutes while Windows initializes
  • 💸 Always stop or delete VMs when not in use to avoid charges
  • 🔑 Save the generated password - it's only shown once
  • 🌐 Choose a location close to you for better performance
  • 🖥️ For Linux GUI access: xRDP works best with Windows clients, VNC with Mac/Linux
  • 🚀 Use lightweight desktop environments (XFCE) for better remote desktop performance

License

MIT © ToDesktop

Contributing

Issues and PRs welcome at github.com/todesktop/az-vm

Keywords

azure

FAQs

Package last updated on 07 Jul 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts