What is Azure Automation, and what are the reasons for implementing it
Azure Automation is a cloud-based service you can implement for cloud-only resources or hybrid clouds. Azure Automation provides many features that make our automation more secure and manageable.
Out of the box, you will get the following features:
- Shared Resources – you can remove the sensitive parts from your scripts and move them to different containers
o Credentials
o Connections
o Certificates
o Variables - Job Statistics – visualized overview of job executions, etc
- RBAC – You can delegate different permission for different parties in your organization
- Schedules– you can schedule your scripts
- Runbooks – all the scripts that you can run on Azure only or in your datacenters
o These can be PowerShell or Python scripts - Hybrid-Worker – you can extend the Azure Automation service to your data centers or other clouds. Hybrid-Worker is just a virtual machine that you can deploy.
- Azure Log Analytics Integration – send all logs to Log Analytics and create different dashboards or alerts.
This post will show you how to configure the Azure Automation Visual Studio Code extension.
Automate Your Cloud Workloads with Azure Automation
Simplify your cloud operations and increase efficiency with Azure Automation. Let us show you how to automate your repetitive tasks, reduce errors, and save time and resources.
Call to Action
Requirements for VS Code Extension
- Azure Automation Account
- Permission to manage Azure Automation Account
- Azure AD Application for Visual Studio Code
- Permission to create Azure AD Applications
- Visual Studio Code
Azure AD Application Configuration
- Open Azure Portal – portal.azure.com
- Select Azure Active Directory and choose App Registrations.
- Select + New Application Registration.
- Fill out the details:
a. Name: Azure Automation Runbook Manager
b. Supported Account Types: Accounts in this organizational directory only - Click Register.
- Copy the Application ID to Notepad.
- Click Certificates & secrets and choose Client Secrets.
- Click +New Client Secret
- Fill out the Key description and duration and click Add.
- Copy key value to Notepad.
- Close the Azure AD Application configuration panels and return to the main Azure AD configuration panel.
- Select Properties and copy the Directory ID to Notepad.
Visual Studio Code configuration
- Install Visual Studio Code
a. https://code.visualstudio.com/download - Open Visual Studio Code
- Select Extensions and search for Azure Automation
- Click Install
- After the installation, click Manage and choose Extension Settings
- On the Extension Settings page, configure the following values
a. Automation Account: Azure Automation Account name
b. Client ID: Azure AD Application ID
c. Client Secret: Azure AD Application Keys value
d. Resource Group: Azure Automation Resource Group Name
e. Subscription ID: Your Azure subscription where you have the Azure Automation Account.
f. Tenant ID: Azure AD Tenant ID - Close the settings panel
Azure Automation Account Configuration
- Open Azure Portal – portal.azure.com
- Choose your Azure Automation Account
- Select Access Control (IAM)
- Choose +Add and select +Add Role Assignment
- On the Add Role Assignment page, choose Automation Contributor
- Click Next
- Select +Select Members
- Search the service principal that you created previously
- Click Select
- Click Review + assign
Testing
- In VS Code, select Automation Explorer
- Click the + Sign and fill out the Runbook name
- Select the language PowerShell or Python
- Select the Runtime Version
- Write your script and Publish 😊
Available Extension Commands
- Create Credential Asset
- Create New Runbook
- Create Variable Asset
- Insert Credential Asset
- Insert Variable Asset
- Open Runbook from Azure
- Publish
- Run
- Save Draft
- Update Personal Information