title | description | services | ms.date | ms.topic | ms.subservice | ms.custom |
---|---|---|---|---|---|---|
Azure Quickstart - Create an Azure Automation runbook | Microsoft Docs |
This article helps you get started creating an Azure Automation runbook. |
automation |
02/05/2019 |
quickstart |
process-automation |
mvc |
Azure Automation runbooks can be created through Azure. This method provides a browser-based user interface for creating Automation runbooks. In this quickstart you walk through creating, editing, testing, and publishing an Automation PowerShell runbook.
If you don't have an Azure subscription, create a free Azure account before you begin.
Sign in to Azure at https://portal.azure.com.
First, create a runbook. The sample runbook created in this quickstart outputs Hello World
by default.
-
Open your Automation account.
-
Click Runbooks under Process Automation. The list of runbooks is displayed.
-
Click Create a runbook at the top of the list.
-
Enter
Hello-World
for the runbook name in the Name field, and select PowerShell for the Runbook type field. -
Click Create. The runbook is created and the Edit PowerShell Runbook page opens.
:::image type="content" source="./media/automation-quickstart-create-runbook/automation-edit-runbook-empty.png" alt-text="Screenshot of the Edit PowerShell Runbook page.":::
-
Type or copy and paste the following code into the edit pane. It creates an optional input parameter called
Name
with a default value ofWorld
, and outputs a string that uses this input value:param ( [Parameter(Mandatory=$false)] [String] $Name = "World" ) "Hello $Name!"
-
Click Save to save a draft copy of the runbook.
:::image type="content" source="./media/automation-quickstart-create-runbook/automation-edit-runbook.png" alt-text="Screenshot of the Edit PowerShell Runbook page with a code example in the right window.":::
Once the runbook is created, you must test the runbook to validate that it works.
-
Click Test pane to open the Test pane.
-
Enter a value for Name, and click Start. The test job starts and the job status and output display.
:::image type="content" source="./media/automation-quickstart-create-runbook/automation-test-runbook.png" alt-text="Screenshot of the Test pane with an example value in the name field.":::
-
Close the Test pane by clicking the X in the upper right corner. Select OK in the popup that appears.
-
In the Edit PowerShell Runbook page, click Publish to publish the runbook as the official version of the runbook in the account.
:::image type="content" source="./media/automation-quickstart-create-runbook/automation-hello-world-runbook-job.png" alt-text="Screenshot of the Edit PowerShell Runbook page showing the Publish button selected.":::
Once the runbook is published, the overview page is shown.
-
In the runbook overview page, click Start to open the Start Runbook configuration page for this runbook.
:::image type="content" source="./media/automation-quickstart-create-runbook/automation-hello-world-runbook-start.png" alt-text="Screenshot of the Start Runbook configuration page.":::
-
Leave Name blank, so that the default value is used, and click OK. The runbook job is submitted, and the Job page appears.
:::image type="content" source="./media/automation-quickstart-create-runbook/automation-job-page.png" alt-text="Screenshot of Job page showing the Output button selected.":::
-
When the job status is
Running
orCompleted
, click Output to open the Output pane and view the runbook output.:::image type="content" source="./media/automation-quickstart-create-runbook/automation-hello-world-runbook-job-output.png" alt-text="Screenshot of the Output pane showing the runbook output.":::
When no longer needed, delete the runbook. To do so, select the runbook in the runbook list, and click Delete.
In this quickstart, you’ve created, edited, tested, and published a runbook and started a runbook job. To learn more about Automation runbooks, continue to the article on the different runbook types that you can create and use in Automation.
[!div class="nextstepaction"] Azure Automation runbook types