Azure Automation, like other cloud automation services, reduces the manual effort associated with tedious, error-prone tasks, ranging from deploying a virtual server to weekly or monthly maintenance jobs.
The cloud automation service is centered around Azure runbooks -- lists of separate, discrete tasks that need to occur in a certain order to reach a desired outcome. There are several ways to access and use runbooks in the Azure Automation service, including:
- Azure portal: Build your automated processes inside the GUI. This option is simple and straightforward, but is limited as your code becomes more advanced.
- PowerShell: This is the default choice for many enterprises.
- Automation API: This enables you to programmatically control automated processes.
You can also choose to schedule runbooks, have them respond to alerts or call them from another runbook.
Choose what to automate
Building a runbook is fairly straightforward, but there are many ways to approach it. What you choose to automate will depend on your environment, your most repetitive tasks, your potential areas of risk and where you can streamline processes.
Since Azure is now a lot more than just VMs in the cloud, you can automate much more than VM deployment. For example, Azure runbooks can clean up temporary files or logs on a regular basis or truncate SQL databases when they hit a certain limit after backups.
One of the most useful, but less discussed, properties of Azure Automation is its ability to perform transactional processing. Admins can group tasks together, which enables them to handle failures more effectively and ensures the process resumes.
For example, an organization might run an overnight transactional process that has to import electronic data interchange (EDI) files -- or, in other words, customer orders -- into a billing and picking system. If the data file import fails, the system will stop and will not delete those EDI files until the problem is corrected. At the same time, the imported data will be rolled back to prevent any orders from entering the system in an inconsistent state.
To implement this transactional functionality, admins needs to treat their PowerShell scripts slightly differently. For example, they need to refactor the code behind whatever key transactional processes -- such as batch or import jobs -- they target and repeat it for every task that is part of the transaction.
Another popular application for Azure Automation is Desired State Configuration (DSC) for servers. DSC ensures that Azure virtual servers are configured against a baseline, ranging from file version or size to registry entries being of a certain value. This helps prevent configuration drift and ensures consistent configurations across servers.
Admins also have the ability to run Azure runbooks locally on premises, using a Hybrid Runbook Worker.
To experiment with runbooks, you can build one within the GUI. The GUI functionality can be found under the Automation blade in the Azure portal.
Get started with runbook scripts
There are a lot of useful scripts online that admins can use to build Azure runbooks. There's also the Azure Automation Runbook Gallery, which offers different runbooks for common scenarios, as well as examples to help you get started with the service. It's based off of contributions from the Azure community.
As with all new systems, you'll have to dive in and give Azure Auomation a try before you can fully grasp its range of capabilities.