In this post I am going to go through setting up an Azure automation account and creating a runbook to PowerShell.
Azure Automation allows for process automation, configuration management, update management and PowerShell script execution on both Azure / Office 365. I like using Azure Automation as it allows me to save credentials in Azure for running task opposed to having them called in my script which is less secure.
I am going to setup a runbook to power on and off my LAB servers so that they only run during the day.
To start using Azure Automation
Go to All services > Automation Accounts
Once in Automation Accounts we need to create a new account.
Give the Automation account a name, assign to a subscription, resource group and location. Leave create as yes and click crate.
Once the task has completed there will now be Automation account showing.
Next step is to create a runbook to run the PowerShell command. Click on the Automation account and go to process automation and click on runbooks.
Once in runbooks there will be some pre-configure runbooks that can be used as references.
To create a new runbook click Add a runbook
Once in the runbook give a name and select the runbook type in this case it will be PowerShell. Then click create.
Click on edit to modify the PowerShell script.
The connection commands is generic and is copied from AzureAutomationTutorialScript runbook.
I have added the command I want to run at the bottom. Once finished, the runbook needs to be saved and published.