Q: What is Azure Automation?
A: Azure Automation is essentially System Center Orchestrator Service Management Automation (SMA) hosted in Azure. It allows the execution of PowerShell workflows directly in the Azure fabric, which is very powerful. PowerShell cmdlets are contained in modules; by default, the Azure module is available within Azure Automation—however, you can also upload additional modules, called runbooks, to make additional cmdlets available to your PowerShell workflows. Runbooks in Azure can be executed manually, or schedules can be defined to automatically run them at your desired times.
Why PowerShell workflows rather than just regular PowerShell? Consider a long-running PowerShell script that might perform numerous actions over many systems. If a problem occurred, the script execution might fail and would need to be restarted. In a regular PowerShell script, this would mean writing the script with the assumption that some of the actions might have already been performed—which means for every action in your script that isn't idempotent (meaning it can be performed multiple times without affecting the subject, after being performed once), you need to insert logic to check values, check whether the action has been performed, and so on. This is a huge amount of work. PowerShell workflows feature checkpoints that save the current state of any variables and the current point in the workflow to disk. If a problem occurs, the workflow can be resumed from the last checkpoint. Checkpoints are typically inserted in the workflow after any major action. Using PowerShell workflows with Azure Automation means that if any kind of interruption or failure occurs, the runbook can be resumed automatically from the last checkpoint.
Azure Automation features a fairly good scripting environment; however, I recommend that you use the PowerShell Integrated Scripting Environment (ISE) to create PowerShell workflows locally, then paste those workflows into the Azure Automation runbook editor. Remember that the goal of Azure Automation is to run PowerShell workflows without any interaction; therefore, you can't use any type of command that requires interaction or is based on formatted output.