As many others I use Microsoft Azure for more and more reasons. Most of my test and demo environments appear in the Microsoft cloud and will be used anytime from anywhere.
The big advantage is the pay-as-you-go strategy. I just need to pay for the resources I really use. My MSDN account gives me the abillity to spend 75$ every month in azure for free 🙂
But on the downside, 75$ are used up very fast and so I just wanted to run my mashines if I really need them.
If you shutdown the VM on the Azure Portal it will be shut down and be deallocated. This means the compute resources are not reserved anymore. The VM will just consume storage resources and therefor be much cheaper.
As a result I wrote a small and simple powershell script to shut down and wakeup my VMs. I do not need my environment over night and prefer saving the money.
As a requirement the Azure Powershell Module has to be installed. Hit the link below:
And here is the script that I actually use:
I created a shortcut on my desktop with following commandline:
“powershell.exe -executionpolicy bypass -file “[scriptpath]”
I can execute it if I start or finnish my working day.
There are many possible improvements for the script. Ist just a quick version for doing my manual business. However it could have more operations like “shutdown all vms” or a query for subscriptions (i just use one single subscription). Same goes for the error handling, which does not exist yet 😉
In conclusion, for me the script is doing well and helps a lot to save costs and time.