You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This tutorial walks you through the creation of a [graphical runbook](automation-runbook-types.md#graphical-runbooks) in Azure Automation. Start with a simple runbook that you can test and publish, while learning how to track the status of the runbook job. Then modify the runbook to actually manage Azure resources, in this case starting an Azure virtual machine. Complete the tutorial to make the runbook more robust by adding runbook parameters and conditional links.
19
+
This tutorial walks you through the creation of a [graphical runbook](../automation-runbook-types.md#graphical-runbooks) in Azure Automation. Start with a simple runbook that you can test and publish, while learning how to track the status of the runbook job. Then modify the runbook to actually manage Azure resources, in this case starting an Azure virtual machine. Complete the tutorial to make the runbook more robust by adding runbook parameters and conditional links.
20
20
21
21
>[!NOTE]
22
-
>This article has been updated to use the new Azure PowerShell Az module. You can still use the AzureRM module, which will continue to receive bug fixes until at least December 2020. To learn more about the new Az module and AzureRM compatibility, see [Introducing the new Azure PowerShell Az module](https://docs.microsoft.com/powershell/azure/new-azureps-module-az?view=azps-3.5.0). For Az module installation instructions on your Hybrid Runbook Worker, see [Install the Azure PowerShell Module](https://docs.microsoft.com/powershell/azure/install-az-ps?view=azps-3.5.0). For your Automation account, you can update your modules to the latest version using [How to update Azure PowerShell modules in Azure Automation](automation-update-azure-modules.md).
22
+
>This article has been updated to use the new Azure PowerShell Az module. You can still use the AzureRM module, which will continue to receive bug fixes until at least December 2020. To learn more about the new Az module and AzureRM compatibility, see [Introducing the new Azure PowerShell Az module](https://docs.microsoft.com/powershell/azure/new-azureps-module-az?view=azps-3.5.0). For Az module installation instructions on your Hybrid Runbook Worker, see [Install the Azure PowerShell Module](https://docs.microsoft.com/powershell/azure/install-az-ps?view=azps-3.5.0). For your Automation account, you can update your modules to the latest version using [How to update Azure PowerShell modules in Azure Automation](../automation-update-azure-modules.md).
23
23
24
24
## Prerequisites
25
25
26
26
To complete this tutorial, you need the following:
27
27
28
28
* Azure subscription. If you don't have one yet, you can [activate your MSDN subscriber benefits](https://azure.microsoft.com/pricing/member-offers/msdn-benefits-details/) or sign up for a [free account](https://azure.microsoft.com/free/?WT.mc_id=A261C142F).
29
-
*[Automation account](automation-offering-get-started.md) to hold the runbook and authenticate to Azure resources. This account must have permission to start and stop the virtual machine.
29
+
*[Automation account](../automation-offering-get-started.md) to hold the runbook and authenticate to Azure resources. This account must have permission to start and stop the virtual machine.
30
30
* An Azure virtual machine. Since you stop and start this machine, it shouldn't be a production VM.
31
31
32
32
## Step 1 - Create runbook
@@ -43,15 +43,15 @@ Start by creating a simple runbook that outputs the text `Hello World`.
43
43
44
44
4. Give the runbook the name **MyFirstRunbook-Graphical**.
45
45
46
-
5. In this case, you're going to create a [graphical runbook](automation-graphical-authoring-intro.md). Select **Graphical** for **Runbook type**.<br> <br>
46
+
5. In this case, you're going to create a [graphical runbook](../automation-graphical-authoring-intro.md). Select **Graphical** for **Runbook type**.<br> <br>
47
47
48
48
6. Click **Create** to create the runbook and open the graphical editor.
49
49
50
50
## Step 2 - Add activities
51
51
52
52
The Library control on the left side of the editor allows you to select activities to add to your runbook. You're going to add a `Write-Output` cmdlet to output text from the runbook.
53
53
54
-
1. In the Library control, click in the search field and type `write-output`. Search results are shown in the following image. <br> 
54
+
1. In the Library control, click in the search field and type `write-output`. Search results are shown in the following image. <br> 
55
55
56
56
2. Scroll down to the bottom of the list. Right-click **Write-Output** and select **Add to canvas**. Alternatively, you can click the ellipsis (...) next to the cmdlet name and then select **Add to canvas**.
57
57
@@ -81,13 +81,13 @@ Before you publish the runbook to make it available in production, you should te
81
81
82
82
2. Click **Start** to start the test. This should be the only enabled option.
83
83
84
-
3. Note that a [runbook job](automation-runbook-execution.md) is created and its status is displayed in the pane.
84
+
3. Note that a [runbook job](../automation-runbook-execution.md) is created and its status is displayed in the pane.
85
85
86
86
The job status starts as `Queued`, indicating that the job is waiting for a runbook worker in the cloud to become available. The status changes to `Starting` when a worker claims the job. Finally, the status becomes `Running` when the runbook actually starts to run.
87
87
88
88
4. When the runbook job completes, the Test pane displays its output. In this case, you see `Hello World`.
@@ -159,15 +159,15 @@ Now that you have a variable to hold the subscription ID, you can configure the
159
159
160
160
6. Add `Connect-AzAccount` to the canvas.
161
161
162
-
7. Hover over `Get Run As Connection` until a circle appears on the bottom of the shape. Click the circle and drag the arrow to `Connect-AzAccount` to form a link. The runbook starts with `Get Run As Connection` and then runs `Connect-AzAccount`.<br> 
162
+
7. Hover over `Get Run As Connection` until a circle appears on the bottom of the shape. Click the circle and drag the arrow to `Connect-AzAccount` to form a link. The runbook starts with `Get Run As Connection` and then runs `Connect-AzAccount`.<br> 
163
163
164
164
8. On the canvas, select `Connect-AzAccount`. In the Configuration control pane, type **Login to Azure** in the **Label** field.
165
165
166
166
9. Click **Parameters**, and the Activity Parameter Configuration page appears.
167
167
168
168
10. The `Connect-AzAccount` cmdlet has multiple parameter sets, and you need to select one before providing parameter values. Click **Parameter Set** and then select **ServicePrincipalCertificateWithSubscriptionId**.
169
169
170
-
11. The parameters for this parameter set are displayed on the Activity Parameter Configuration page. Click **APPLICATIONID**.<br> 
170
+
11. The parameters for this parameter set are displayed on the Activity Parameter Configuration page. Click **APPLICATIONID**.<br> 
171
171
172
172
12. On the Parameter Value page, make the following settings and then click **OK**.
173
173
@@ -205,7 +205,7 @@ Now that you have a variable to hold the subscription ID, you can configure the
205
205
206
206
23. Hover over `Login to Azure` until a circle appears on the bottom of the shape. Click the circle and drag the arrow to `Specify Subscription Id`. Your runbook should look like the following at this point.
@@ -244,13 +244,13 @@ Your runbook currently starts the VM in the resource group that you specified fo
244
244
***Type** -- keep the string setting.
245
245
***Mandatory** -- change the value to **Yes**.
246
246
247
-
4. Create a second mandatory input parameter called `ResourceGroupName` and then click **OK** to close the Input and Output pane.<br> 
247
+
4. Create a second mandatory input parameter called `ResourceGroupName` and then click **OK** to close the Input and Output pane.<br> 
248
248
249
249
5. Select the `Start-AzVM` activity and then click **Parameters**.
250
250
251
251
6. Change the **Data source** field for **Name** to **Runbook input**. Then select **VMName**.
252
252
253
-
7. Change the **Data source** field for **ResourceGroupName** to **Runbook input** and then select **ResourceGroupName**.<br> 
253
+
7. Change the **Data source** field for **ResourceGroupName** to **Runbook input** and then select **ResourceGroupName**.<br> 
254
254
255
255
8. Save the runbook and open the Test pane. You can now provide values for the two input variables that you use in the test.
256
256
@@ -311,7 +311,7 @@ You can now modify the runbook so that it only attempts to start the VM if it is
311
311
312
312
16. Create a link from `Get Status` to `Start-AzVM`.
313
313
314
-

314
+

315
315
316
316
17. Select the link and, in the Configuration pane, change **Apply condition** to **Yes**. Note that the link becomes a dashed line, indicating that the target activity only runs if the condition resolves to true.
317
317
@@ -339,16 +339,16 @@ You can now modify the runbook so that it only attempts to start the VM if it is
339
339
340
340
29. For the **Condition expression** field, type `$ActivityOutput['Start-AzVM'].IsSuccessStatusCode -ne $true`. This `Write-Output` control now only runs if the VM is not successfully started. Your runbook should look like the following image.
341
341
342
-

342
+

343
343
344
344
30. Save the runbook and open the Test pane.
345
345
346
346
31. Start the runbook with the VM stopped, and the machine should start.
347
347
348
348
## Next steps
349
349
350
-
* To learn more about graphical authoring, see [Graphical authoring in Azure Automation](automation-graphical-authoring-intro.md).
351
-
* To get started with PowerShell runbooks, see [My first PowerShell runbook](automation-first-runbook-textual-powershell.md).
352
-
* To get started with PowerShell Workflow runbooks, see [My first PowerShell workflow runbook](automation-first-runbook-textual.md).
350
+
* To learn more about graphical authoring, see [Graphical authoring in Azure Automation](../automation-graphical-authoring-intro.md).
351
+
* To get started with PowerShell runbooks, see [My first PowerShell runbook](automation-tutorial-runbook-textual-powershell.md).
352
+
* To get started with PowerShell Workflow runbooks, see [My first PowerShell workflow runbook](automation-tutorial-runbook-textual.md).
353
353
* For a PowerShell cmdlet reference, see [Az.Automation](https://docs.microsoft.com/powershell/module/az.automation/?view=azps-3.7.0#automation
0 commit comments