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
Copy file name to clipboardExpand all lines: articles/automation/automation-first-runbook-textual.md
+19-19Lines changed: 19 additions & 19 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -30,23 +30,23 @@ To complete this tutorial, you need:
30
30
31
31
## Step 1 - Create new runbook
32
32
33
-
Start by creating a simple runbook that outputs the text "Hello World".
33
+
Start by creating a simple runbook that outputs the text **Hello World**.
34
34
35
35
1. In the Azure portal, open your Automation account.
36
36
37
37
The Automation account page gives you a quick view of the resources in this account. You should already have some assets. Most of those assets are the modules automatically included in a new Automation account. You should also have the Credential asset associated with your subscription.
38
38
39
39
1. Select **Runbooks** under **Process Automation** to open the list of runbooks.
40
-
1. Create a new runbook by selecting **+ Create a runbook**.
41
-
1. Give the runbook the name "MyFirstRunbook-Workflow".
40
+
1. Create a new runbook by selecting **Create a runbook**.
41
+
1. Give the runbook the name **MyFirstRunbook-Workflow**.
42
42
1. In this case, you're going to create a [PowerShell Workflow runbook](automation-runbook-types.md#powershell-workflow-runbooks). So select **Powershell Workflow** for **Runbook type**.
43
43
1. Click **Create** to create the runbook and open the textual editor.
44
44
45
45
## Step 2 - Add code to the runbook
46
46
47
-
You can either type code directly into the runbook, or you can select cmdlets, runbooks, and assets from the Library control and add them to the runbook with any related parameters. For this walkthrough, type code directly into the runbook.
47
+
You can either type code directly into the runbook, or you can select cmdlets, runbooks, and assets from the Library control and add them to the runbook with any related parameters. For this tutorial, you type code directly into the runbook.
48
48
49
-
1. Your runbook is currently empty with only the required **workflow** keyword, the name of the runbook, and the braces that encase the entire workflow.
49
+
1. Your runbook is currently empty with only the required **Workflow** keyword, the name of the runbook, and the braces that encase the entire workflow.
50
50
51
51
```powershell-interactive
52
52
Workflow MyFirstRunbook-Workflow
@@ -73,9 +73,9 @@ Before you publish the runbook to make it available in production, you should te
73
73
1. Click **Start** to start the test, with testing the only enabled option.
74
74
1. Note that a [runbook job](automation-runbook-execution.md) is created and its status is displayed in the pane.
75
75
76
-
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.
76
+
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.
77
77
78
-
1. When the runbook job completes, the Test pane displays its output. In this case, you see "Hello World".
78
+
1. When the runbook job completes, the Test pane displays its output. In this case, you see **Hello World**.
@@ -86,8 +86,8 @@ Before you publish the runbook to make it available in production, you should te
86
86
The runbook that you've created is still in Draft mode. You must publish it before you can run it in production. When you publish a runbook, you overwrite the existing Published version with the Draft version. In this case, you don't have a Published version yet because you just created the runbook.
87
87
88
88
1. Click **Publish** to publish the runbook and then **Yes** when prompted.
89
-
1. Scroll left to view the runbook in the **Runbooks**pane and note that the **Authoring Status**value is set to Published.
90
-
1. Scroll back to the right to view the pane for MyFirstRunbook-Workflow.
89
+
1. Scroll left to view the runbook in the **Runbooks**page and note that the **Authoring Status**field is set to **Published**.
90
+
1. Scroll back to the right to view the page for **MyFirstRunbook-Workflow**.
91
91
92
92
The options across the top allow you to start the runbook now, schedule a future start time, or create a [webhook](automation-webhooks.md) so that the runbook can be started through an HTTP call.
93
93
@@ -101,18 +101,18 @@ The runbook that you've created is still in Draft mode. You must publish it befo
1. Click **All Logs** to open the Streams pane for the runbook job. you should only see "Hello World" in the output stream. Note that the Streams pane can show other streams for a runbook job, such as verbose and error streams, if the runbook writes to them.
110
+
1. Click **All Logs** to open the Streams pane for the runbook job. You should only see **Hello World** in the output stream. Note that the Streams pane can show other streams for a runbook job, such as verbose and error streams, if the runbook writes to them.
1. Close the Streams pane and the Job pane to return to the MyFirstRunbook page.
115
-
1. Click **Jobs** under **Resources** to open the Jobs page for this runbook. This page lists all the jobs created by your runbook. You should only see one job listed, since you have only run the job once.
114
+
1. Close the Streams pane and the Job pane to return to the **MyFirstRunbook** page.
115
+
1. Click **Jobs** under **Resources** to open the Jobs page for this runbook. This page lists all the jobs created by your runbook. You should only see one job listed, since you have run the job only once.
@@ -125,10 +125,10 @@ You've tested and published your runbook, but so far it doesn't do anything usef
125
125
>[!NOTE]
126
126
>For PowerShell runbooks, **Add-AzAccount** and **Add-AzureRMAccount** are aliases for **Connect-AzAccount**. You can use these cmdlets or you can [update your modules](automation-update-azure-modules.md) in your Automation account to the latest versions. You might need to update your modules even if you have just created a new Automation account.
127
127
128
-
1. Navigate to the MyFirstRunbook-Workflow page and open the textual editor by clicking **Edit**.
129
-
2. Delete the **Write-Output** line.
128
+
1. Navigate to the **MyFirstRunbook-Workflow** page and open the textual editor by clicking **Edit**.
129
+
2. Delete the `Write-Output` line.
130
130
3. Position the cursor on a blank line between the braces.
131
-
4. Type or copy and paste the following code that handles the authentication with your Automation Run As account.
131
+
4. Type or copy and paste the following code, which handles the authentication with your Automation Run As account.
132
132
133
133
```powershell-interactive
134
134
# Ensures you do not inherit an AzContext in your runbook
@@ -148,7 +148,7 @@ You've tested and published your runbook, but so far it doesn't do anything usef
148
148
149
149
## Step 6 - Add code to start a virtual machine
150
150
151
-
Now that your runbook is authenticating to your Azure subscription, you can manage resources. Let's add a command to start a virtual machine. You can pick any VM in your Azure subscription, and for now you're hardcoding that name in the runbook. If you're managing resources across multiple subscriptions, you need to use the *AzContext* parameter with the [Get-AzContext](/powershell/module/az.accounts/get-azcontext) cmdlet.
151
+
Now that your runbook is authenticating to the Azure subscription, you can manage resources. Let's add a command to start a virtual machine. You can pick any VM in your Azure subscription, and for now you're hardcoding that name in the runbook. If you're managing resources across multiple subscriptions, you need to use the *AzContext* parameter with the [Get-AzContext](/powershell/module/az.accounts/get-azcontext) cmdlet.
152
152
153
153
1. Provide the name and resource group name of the VM to start by entering a call to the [Start-AzVM](https://docs.microsoft.com/powershell/module/Az.Compute/Start-AzVM?view=azps-3.5.0
154
154
) cmdlet as shown below.
@@ -173,7 +173,7 @@ Now that your runbook is authenticating to your Azure subscription, you can mana
173
173
174
174
## Step 7 - Add an input parameter to the runbook
175
175
176
-
Your runbook currently starts the VM that you have hardcoded in the runbook. It will be more useful if you can specify the VM when the runbook is started. Add input parameters to the runbook to provide that functionality.
176
+
Your runbook currently starts the VM that you have hardcoded in the runbook. It will be more useful if you can specify the VM when the runbook is started. Let's add input parameters to the runbook to provide that functionality.
177
177
178
178
1. Add values for *VMName* and *ResourceGroupName* to the runbook, and use the associated variables with the **Start-AzVM** cmdlet as shown below.
179
179
@@ -207,7 +207,7 @@ Your runbook currently starts the VM that you have hardcoded in the runbook. It
207
207
## Next steps
208
208
209
209
* For more information on PowerShell, including language reference and learning modules, refer to the [PowerShell Docs](https://docs.microsoft.com/powershell/scripting/overview).
210
-
* To get started with graphical runbooks, see [My first graphical runbook](automation-first-runbook-graphical.md).
210
+
* To get started with Graphical runbooks, see [My first graphical runbook](automation-first-runbook-graphical.md).
211
211
* To get started with PowerShell runbooks, see [My first PowerShell runbook](automation-first-runbook-textual-powershell.md).
212
212
* To learn more about runbook types and their advantages and limitations, see [Azure Automation runbook types](automation-runbook-types.md).
213
213
* For more information on PowerShell script support features, see [Native PowerShell script support in Azure Automation](https://azure.microsoft.com/blog/announcing-powershell-script-support-azure-automation-2/).
0 commit comments