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/learn/automation-tutorial-runbook-textual.md
+61-56Lines changed: 61 additions & 56 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -111,29 +111,30 @@ Start by creating a simple [PowerShell Workflow runbook](../automation-runbook-t
111
111
112
112
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.
113
113
114
-
Your runbook is currently empty with only the required `Workflow` keyword, the name of the runbook, and the braces that encase the entire workflow.
114
+
Your runbook is currently empty with only the required `workflow` keyword, the name of the runbook, and the braces that encase the entire workflow.
115
115
116
116
```powershell
117
-
Workflow MyFirstRunbook-Workflow
117
+
workflow MyFirstRunbook-Workflow
118
118
{
119
119
}
120
120
```
121
121
122
122
1. You can use the `Parallel` keyword to create a script block with multiple commands that will run concurrently. Enter the following code *between* the braces:
123
123
124
124
```powershell
125
-
Parallel {
126
-
Write-Output "Parallel"
127
-
Get-Date
128
-
Start-Sleep -s 3
129
-
Get-Date
130
-
}
131
-
132
-
Write-Output " `r`n"
133
-
Write-Output "Non-Parallel"
134
-
Get-Date
135
-
Start-Sleep -s 3
136
-
Get-Date
125
+
parallel
126
+
{
127
+
Write-Output "Parallel"
128
+
Get-Date
129
+
Start-Sleep -Seconds 3
130
+
Get-Date
131
+
}
132
+
133
+
Write-Output " `r`n"
134
+
Write-Output "Non-Parallel"
135
+
Get-Date
136
+
Start-Sleep -Seconds 3
137
+
Get-Date
137
138
```
138
139
139
140
1. Save the runbook by selecting **Save**.
@@ -189,16 +190,16 @@ You've tested and published your runbook, but so far it doesn't do anything usef
189
190
```powershell
190
191
workflow MyFirstRunbook-Workflow
191
192
{
192
-
$resourceGroup = "resourceGroupName"
193
-
194
-
# Ensures you do not inherit an AzContext in your runbook
195
-
Disable-AzContextAutosave -Scope Process
196
-
197
-
# Connect to Azure with system-assigned managed identity
Write-Output "`r`n Action not allowed. Please enter 'stop' or 'start'."
300
+
}
301
+
}
297
302
```
298
303
299
304
1. If you want the runbook to execute with the system-assigned managed identity, leave the code as-is. If you prefer to use a user-assigned managed identity, then:
0 commit comments