For Azure IAAS enthusiasts, Microsoft has provided a platform to automate all the azure services using powershell. The language is tweaked and used as “powershell workflow”.
Why to Use
- Reducing Manual Effort and help in consistent testing
- Managing resources (deployment/VM’s etc)
How to Use
- Create a powershell workflow in azure web portal and execute it.
- Deployment and execution of tasks written in PowerShell.
Things to know!
Automation Account – A dedicated account to perform runbook design/execution/management.
Asset – Global resources used by runbooks to assist in common tasks and value specific operations
Windows PowerShell Workflow – Implementation of azure automation using PowerShell Workflows. Workflow is a group of individual steps performing an action.
Management Certificates – Authenticate azure resources for azure automation in an azure subscription.
Tips to remember!
- An automation account name is unique per region and per subscription. Multiple accounts are possible. Max 30 per subscription in different region.
Sample One: Creating a runbook to Connect Azure Subscription using Azure AD
Create Automation Account
1. Goto https://portal.azure.com
2. Click Browse and select Automation Accounts.
3. Click Add in the Automation accounts.
4. Fill details in Add Automation Account and click Create.
5. Automation Account is created.
6. In Automation Resources, Select Runbooks.
7. Click Add Runbook. Enter details and click create.
8. Runbook is created. Authoring status is New.
9. Click Edit in the Runbook details page.
10. Create an Azure AD User to the subscription and set it as a co-administrator. Add the user to the asset as credential type.
11.Edit the Runbook with the below code and Save the runbook.
12. Test the runbook by clicking Start in the Test Pane.
13. Test is passed.
14. Publish the runbook by clicking publish in the Runbook detail page.
15. You can schedule the run book based on the Recurrence/Date etc.