For context, we have an Azure Virtual Machine that we use to test our app before pushing the changes to production. This VM automatically shutdown every evening to save some energy. Is there a way to make it start when trying to access its DNS name (******.cloudapp.azure.com)? It would be better than starting it at a fixed time every morning but if it is impossible or too complicated, is there a way to make it start at a specified time?
2
Answers
Starting the vm using events requires some changes in your architecture.
You can start a vm at fixed time using automation accounts. Look at this tutorial on Microsoft learn to accomplish your goal
https://learn.microsoft.com/en-us/azure/automation/automation-solution-vm-management-config
If you had a firewall in front off your VM you could log the HTTP 404 events, then trigger a function that started your VM.
But it is not trivial and the firewall would add extra cost (it may be more expensive than your VM)
So the best way is probably just to start the VM at a fixed time.
If you need the VM permanently you could look into Reserved instances to save costs. It could save you upto 80% https://azure.microsoft.com/en-us/pricing/reserved-vm-instances/