Why it matters
A firewall in a development or test network often costs as much as one in production, but nobody uses it at night or at weekends.How nOps finds it
nOps reads the last 14 complete days of pay-as-you-go Azure Firewall billing. A firewall counts as non-production when at least 90% of its cost carries a non-production environment tag, nOps environment or resource group name. It is flagged when it was deployed for at least 23.5 hours on at least 13 of the 14 days, including at least 3 of the 4 weekend days. The saving is its deployment cost over the last 7 days, scaled to a month, times 1 minus 60/168. Data processing charges are not counted. Firewalls mostly covered by commitments, and savings under $25 a month, are left out.Before you start
An Azure Automation account (or another scheduler) with permission to change the firewall, and agreement from the environment’s users on working hours.How to implement
- Agree the working hours with the teams that use the environment.
- Create two Azure Automation runbooks in PowerShell. To stop the firewall, get it with
Get-AzFirewall, call$azfw.Deallocate()and save it withSet-AzFirewall. To start it, call$azfw.Allocate($vnet, $publicIp)with its virtual network and public IP, thenSet-AzFirewall. - Schedule the stop runbook for the end of the working day and the start runbook for the start of it, on weekdays only.
- Check after a week that the firewall is deallocated outside working hours and that traffic flows when it starts again.
Risks and considerations
- While the firewall is deallocated, traffic routed through it stops. Anything that runs at night, such as builds or backups, fails unless it is moved to working hours.
- Starting a firewall takes several minutes, so schedule it to start before people need it.
- The firewall’s rules and public IP configuration are kept while it is deallocated. To roll back, remove the schedules.
FAQs
Why 60 hours a week?
Why 60 hours a week?
nOps assumes the firewall runs 12 hours a day on the 5 weekdays. If your teams need longer hours, the saving is smaller.