Manage VM Operations: Disk Encryption, Update Management, Backup, Run Command, Monitoring Agents and Troubleshooting
Encryption
| Option | Notes |
|---|---|
| Server-side encryption (SSE) | Default for managed disks with platform-managed keys |
| Customer-managed keys | Use a Disk Encryption Set linked to Key Vault |
| Encryption at host | Encrypts temp disk and caches |
| Azure Disk Encryption (ADE) | BitLocker or dm-crypt inside the VM with keys in Key Vault |
bash
az keyvault create -g rg-vm -n kv-vm-482 --enabled-for-disk-encryption true
az vm encryption enable -g rg-vm -n win01 --disk-encryption-keyvault kv-vm-482
az vm encryption show -g rg-vm -n win01
Patching with Azure Update Manager
- Checks missing updates and installs them on a schedule with maintenance windows
- Works for Azure VMs and Arc-enabled servers
- Use periodic assessment and schedules assigned to VMs by tag or subscription
Backup and Snapshots
bash
# Quick snapshot of the OS disk
OSDISK=$(az vm show -g rg-vm -n web01 --query storageProfile.osDisk.managedDisk.id -o tsv)
az snapshot create -g rg-vm -n web01-snap --source $OSDISK
# Azure Backup (vault and policy)
az backup vault create -g rg-vm -n rsv-vm --location centralindia
az backup protection enable-for-vm -g rg-vm -v rsv-vm --vm web01 --policy-name DefaultPolicy
- Snapshot is a point-in-time copy of one disk, good before risky changes
- Azure Backup gives scheduled, application-consistent, policy-driven backups with restore options
Run Command and Consoles
bash
az vm run-command invoke -g rg-vm -n web01 --command-id RunShellScript --scripts "df -h; systemctl status nginx"
- Run command runs scripts without network access to the VM
- Boot diagnostics shows screenshots and serial logs. Serial console gives an emergency terminal
- Reset password / reset SSH key from the VM's Help section
Monitoring and Cost
- Install Azure Monitor Agent with a data collection rule. Turn on VM insights for performance and dependency maps
- Auto-shutdown schedules save money for dev VMs
- Set alerts on CPU, memory and disk
Troubleshooting Cheatsheet
| Problem | Check |
|---|---|
| Cannot connect | NSG rules, public IP, VM running, OS firewall, try Bastion or redeploy |
| VM will not start | Boot diagnostics, quota limits, disk errors, size availability |
| Slow VM | CPU, memory and disk metrics, disk IOPS limits, size limits |
| Disk full | Expand the disk and filesystem |
| Lost admin password | Reset password from the portal |
Practice
- Enable backup on a VM and run a backup now
- Schedule an update assessment
- Use Run command to check disk usage
- Set auto-shutdown at 20:00
Conclusion
Protect VMs with encryption, patch them with Update Manager, back them up with snapshots and Azure Backup and use Run command, diagnostics and monitoring to troubleshoot quickly.
Quick Summary: encryption; patching; backup; run command; monitoring; troubleshooting.

