> ## Documentation Index
> Fetch the complete documentation index at: https://help.nops.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Schedule Non-Production Azure VMs

> Stop non-production Azure VMs outside working hours instead of running them around the clock.

Development, test and staging VMs are rarely used at night or at weekends, but many run 24 hours a day. nOps finds non-production VMs that run every day, including weekends, and estimates the saving from deallocating them outside a working week of 12 hours a day, 5 days a week.

| | |
| - | - |
| **Cloud** | Microsoft Azure |
| **Category** | Compute |
| **Service** | Virtual Machines |
| **Action** | Modify |
| **Effort** | Low |
| **Restart needed** | Yes |
| **Can be rolled back** | Yes |
| **Analysis window** | Last 14 days |
| **Source** | nOps |

## Why it matters

Running only during working hours cuts a VM's compute hours by almost two thirds.

## How nOps finds it

nOps reads the last 14 days of Azure VM billing. A VM is flagged when it was billed for a full day (23.5 to 24.5 hours) on at least 13 of the 14 days, including at least 3 of the 4 weekend days, and at least 90% of its cost is non-production. Non-production comes from the VM's environment tag, then the environment nOps assigns, then the resource group name. The saving is the 7-day pay-as-you-go compute cost, scaled to a month, times (1 minus 60/168), assuming the VM runs 60 hours a week. Scale sets, Databricks VMs, AKS nodes (unless tagged non-production), VMs mostly covered by reservations, and savings under \$25 a month are left out.

## Before you start

Confirm with the owner when the VM is needed, and permission to start and stop it (or to set up automation).

## How to implement

1. Agree working hours with the people who use the VM.
2. For a simple nightly stop, open the VM in the Azure portal, go to **Auto-shutdown**, and set a time. This stops the VM but does not start it again.
3. To stop and start on a schedule, use the **Start/Stop VMs v2** solution or an Azure Automation runbook that runs `az vm deallocate` and `az vm start`.
4. Tag the VM with its schedule so others know why it is off.

## Risks and considerations

* Managed disks keep billing while the VM is deallocated, so the saving covers compute only.
* A VM with a dynamic public IP gets a new address each time it starts.
* Anything that runs overnight (backups, batch jobs, patching) needs to move into the working window.
* To roll back, remove the schedule.

## FAQs

> [accordion] How does nOps decide a VM is non-production?
>
> From its environment tag first, then the environment nOps assigns, then words like dev, test or staging in the resource group name. At least 90% of its cost must be non-production.

> [accordion] Why are scale sets left out?
>
> Azure bills scale sets per instance, so daily billing cannot show that a scale set runs around the clock. Use a scheduled autoscale profile for them.

## Related

* [Use Azure Dev/Test Pricing for Non-Production Windows VMs](https://help.nops.io/inform/supported-recommendations/use-azure-dev-test-pricing-for-non-production-windows-vms)
* [Deallocate Non-Production Azure Firewalls Off-Hours](https://help.nops.io/inform/supported-recommendations/deallocate-non-production-azure-firewalls-off-hours)
* [Shut Down Underutilized Azure Virtual Machine](https://help.nops.io/inform/supported-recommendations/shut-down-underutilized-azure-virtual-machine)
* [Supported recommendations](https://help.nops.io/inform/supported-recommendations.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.