Three Power Automate workflows to cut costs
The ease of spinning up virtual machines (VMs) and databases often leads to "cloud sprawl"—unmanaged resources left running indefinitely. With cloud budgets frequently exceeded by an average of 17%, tackling underused or over-provisioned resources is essential for financial discipline.
Strategic automation, such as powering down non-production environments outside business hours (08:00 to 18:00), can reduce non-production cloud spend by as much as 40%. Microsoft Power Automate provides a practical way to identify and eliminate this waste.
1. Automated Shutdown for Development VMs
Development and test environments are often the largest contributors to cloud waste. VMs are created for short-term projects but frequently stay active long after the work is finished.
- The Workflow: Create a daily flow that queries Azure for all VMs tagged as "Environment: Dev."
- The Logic: If CPU utilisation has been below 5% for over 72 hours, the flow triggers a shutdown command. This stops the billing for idle time while keeping the data intact, allowing developers to restart the machine when needed.
2. Reporting Orphaned Storage Disks
When a VM is deleted, its associated storage disks are often left behind as "orphaned" resources, incurring monthly charges.
- The Workflow: Set a weekly schedule to list all unattached managed disks in your subscription.
- The Logic: The flow generates an email report for the IT or finance team, detailing disk names, sizes, and estimated costs. This provides an actionable "clean-up" list to ensure you aren't paying for storage that isn't connected to any active service.
3. Terminating Expired Temporary Resources
Temporary projects, such as data analysis or file transfers, require resources with a finite lifespan.
- The Workflow: Integrate a "Deletion Date" tag into your deployment process.
- The Logic: A daily flow checks for resources where the current date matches or exceeds the tagged deletion date. The flow then automatically deletes the resource, ensuring temporary items do not become permanent expenses due to human oversight.
Safety Controls and Best Practice
Automations that delete or stop resources require careful implementation. Before going live, consider these safeguards:
- Report-Only Mode: Initially, configure your flows to send an email alert rather than executing a deletion. This allows you to validate the logic and spot any errors.
- Approval Gates: For high-risk actions—such as deleting high-capacity storage disks—add a manual approval step within Power Automate.
By shifting from reactive management to proactive automation, you ensure your organisation only pays for the cloud resources it actively utilises.