Hello!
These 2 simple Runbooks stops and starts virtual machines in Azure.
Turning off your resources at night is a pretty good way to save money, if your resources doesn’t need to be on at night that is.
The only thing you need to change in the script below is -ResourceGroupName & -Name
If you have any further questions, feel free to comment down below 🙂
Need help creating your Runbook?
Runbooks
Complete Runbooks that you can copy/paste
Start:
## Connect to Azure via your RunAsAccount $Conn = Get-AutomationConnection -Name AzureRunAsConnection Connect-AzureRmAccount -ServicePrincipal -Tenant $Conn.TenantID -ApplicationId $Conn.ApplicationID -CertificateThumbprint $Conn.CertificateThumbprint | Out-Null ## To be executed Start-AzureRmVM -ResourceGroupName "ServerGroup" -Name "Server01"
Stop:
## Connect to Azure via your RunAsAccount $Conn = Get-AutomationConnection -Name AzureRunAsConnection Connect-AzureRmAccount -ServicePrincipal -Tenant $Conn.TenantID -ApplicationId $Conn.ApplicationID -CertificateThumbprint $Conn.CertificateThumbprint | Out-Null ## To be executed Stop-AzureRmVM -ResourceGroupName "ServerGroup" -Name "Server01"