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-orchestrator-migration.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -130,7 +130,7 @@ For example, a runbook may use a variable to populate a particular value in an a
130
130
131
131
### Input parameters
132
132
133
-
Runbooks in Orchestrator accept input parameters with the **Initialize Data** activity. If the runbook being converted includes this activity, then an [input parameter](automation-graphical-authoring-intro.md#runbook-input-and-output) in the Azure Automation runbook is created for each parameter in the activity. A [Workflow Script control](automation-graphical-authoring-intro.md#activities) activity is created in the converted runbook that retrieves and returns each parameter. Any activities in the runbook that use an input parameter refer to the output from this activity.
133
+
Runbooks in Orchestrator accept input parameters with the `Initialize Data` activity. If the runbook being converted includes this activity, then an [input parameter](automation-graphical-authoring-intro.md#runbook-input-and-output) in the Azure Automation runbook is created for each parameter in the activity. A [Workflow Script control](automation-graphical-authoring-intro.md#activities) activity is created in the converted runbook that retrieves and returns each parameter. Any activities in the runbook that use an input parameter refer to the output from this activity.
134
134
135
135
The reason that this strategy is used is to best mirror the functionality in the Orchestrator runbook. Activities in new graphical runbooks should refer directly to input parameters using a Runbook input data source.
Copy file name to clipboardExpand all lines: articles/automation/automation-powershell-workflow.md
+19-15Lines changed: 19 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,9 +14,12 @@ A workflow is a sequence of programmed, connected steps that perform long-runnin
14
14
15
15
For complete details on the topics in this article, see [Getting Started with Windows PowerShell Workflow](https://technet.microsoft.com/library/jj134242.aspx).
16
16
17
+
>[!NOTE]
18
+
>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).
19
+
17
20
## Basic structure of a workflow
18
21
19
-
The first step to converting a PowerShell script to a PowerShell workflow is enclosing it with the **Workflow** keyword. A workflow starts with the **Workflow** keyword followed by the body of the script enclosed in braces. The name of the workflow follows the **Workflow** keyword as shown in the following syntax:
22
+
The first step to converting a PowerShell script to a PowerShell workflow is enclosing it with the `Workflow` keyword. A workflow starts with the `Workflow` keyword followed by the body of the script enclosed in braces. The name of the workflow follows the `Workflow` keyword as shown in the following syntax:
20
23
21
24
```powershell
22
25
Workflow Test-Workflow
@@ -27,7 +30,7 @@ Workflow Test-Workflow
27
30
28
31
The name of the workflow must match the name of the Automation runbook. If the runbook is being imported, then the filename must match the workflow name and must end in *.ps1*.
29
32
30
-
To add parameters to the workflow, use the **Param** keyword just as you would to a script.
33
+
To add parameters to the workflow, use the `Param` keyword just as you would in a script.
31
34
32
35
## Code changes
33
36
@@ -93,7 +96,7 @@ Workflow Stop-MyService
93
96
94
97
## InlineScript
95
98
96
-
The**InlineScript** activity is useful when you need to run one or more commands as traditional PowerShell script instead of PowerShell workflow. While commands in a workflow are sent to Windows Workflow Foundation for processing, commands in an InlineScript block are processed by Windows PowerShell.
99
+
The`InlineScript` activity is useful when you need to run one or more commands as traditional PowerShell script instead of PowerShell workflow. While commands in a workflow are sent to Windows Workflow Foundation for processing, commands in an InlineScript block are processed by Windows PowerShell.
97
100
98
101
InlineScript uses the following syntax shown below.
99
102
@@ -148,7 +151,7 @@ For more information on using InlineScript, see [Running Windows PowerShell Comm
148
151
149
152
One advantage of Windows PowerShell Workflows is the ability to perform a set of commands in parallel instead of sequentially as with a typical script.
150
153
151
-
You can use the **Parallel** keyword to create a script block with multiple commands that run concurrently. This uses the following syntax shown below. In this case, Activity1 and Activity2 starts at the same time. Activity3 starts only after both Activity1 and Activity2 have completed.
154
+
You can use the `Parallel` keyword to create a script block with multiple commands that run concurrently. This uses the following syntax shown below. In this case, Activity1 and Activity2 starts at the same time. Activity3 starts only after both Activity1 and Activity2 have completed.
152
155
153
156
```powershell
154
157
Parallel
@@ -183,7 +186,7 @@ Workflow Copy-Files
183
186
}
184
187
```
185
188
186
-
You can use the **ForEach -Parallel** construct to process commands for each item in a collection concurrently. The items in the collection are processed in parallel while the commands in the script block run sequentially. This uses the following syntax shown below. In this case, Activity1 starts at the same time for all items in the collection. For each item, Activity2 starts after Activity1 is complete. Activity3 starts only after both Activity1 and Activity2 have completed for all items. We use the `ThrottleLimit` parameter to limit the parallelism. Too high of a `ThrottleLimit` can cause problems. The ideal value for the `ThrottleLimit` parameter depends on many factors in your environment. You should try start with a low value and try different increasing values until you find one that works for your specific circumstance.
189
+
You can use the `ForEach -Parallel` construct to process commands for each item in a collection concurrently. The items in the collection are processed in parallel while the commands in the script block run sequentially. This uses the following syntax shown below. In this case, Activity1 starts at the same time for all items in the collection. For each item, Activity2 starts after Activity1 is complete. Activity3 starts only after both Activity1 and Activity2 have completed for all items. We use the `ThrottleLimit` parameter to limit the parallelism. Too high of a `ThrottleLimit` can cause problems. The ideal value for the `ThrottleLimit` parameter depends on many factors in your environment. You should try start with a low value and try different increasing values until you find one that works for your specific circumstance.
187
190
188
191
```powershell
189
192
ForEach -Parallel -ThrottleLimit 10 ($<item> in $<collection>)
@@ -216,7 +219,7 @@ Workflow Copy-Files
216
219
217
220
## Checkpoints
218
221
219
-
A *checkpoint* is a snapshot of the current state of the workflow that includes the current value for variables and any output generated to that point. If a workflow ends in error or is suspended, then the next time it is run it will start from its last checkpoint instead of the start of the workflow. You can set a checkpoint in a workflow with the **Checkpoint-Workflow** activity. Azure Automation has a feature called [fair share](automation-runbook-execution.md#fair-share), where any runbook that runs for 3 hours is unloaded to allow other runbooks to run. Eventually, the unloaded runbook will be reloaded, and when it is, it will resume execution from the last checkpoint taken in the runbook. In order to guarantee that the runbook will eventually complete, you must add checkpoints at intervals that run for less than 3 hours. If during each run a new checkpoint is added, and if the runbook gets evicted after 3 hours due to an error, then the runbook will be resumed indefinitely.
222
+
A *checkpoint* is a snapshot of the current state of the workflow that includes the current value for variables and any output generated to that point. If a workflow ends in error or is suspended, then the next time it is run it will start from its last checkpoint instead of the start of the workflow. You can set a checkpoint in a workflow with the `Checkpoint-Workflow` activity. Azure Automation has a feature called [fair share](automation-runbook-execution.md#fair-share), where any runbook that runs for 3 hours is unloaded to allow other runbooks to run. Eventually, the unloaded runbook will be reloaded, and when it is, it will resume execution from the last checkpoint taken in the runbook. In order to guarantee that the runbook will eventually complete, you must add checkpoints at intervals that run for less than 3 hours. If during each run a new checkpoint is added, and if the runbook gets evicted after 3 hours due to an error, then the runbook will be resumed indefinitely.
220
223
221
224
In the following sample code, an exception occurs after Activity2 causing the workflow to end. When the workflow is run again, it starts by running Activity2 since this was just after the last checkpoint set.
222
225
@@ -248,36 +251,37 @@ Workflow Copy-Files
248
251
}
249
252
```
250
253
251
-
Because username credentials are not persisted after you call the [Suspend-Workflow](https://technet.microsoft.com/library/jj733586.aspx) activity or after the last checkpoint, you need to set the credentials to null and then retrieve them again from the asset store after **Suspend-Workflow** or checkpoint is called. Otherwise, you may receive the following error message: *The workflow job cannot be resumed, either because persistence data could not be saved completely, or saved persistence data has been corrupted. You must restart the workflow.*
254
+
Because username credentials are not persisted after you call the [Suspend-Workflow](https://technet.microsoft.com/library/jj733586.aspx) activity or after the last checkpoint, you need to set the credentials to null and then retrieve them again from the asset store after `Suspend-Workflow` or checkpoint is called. Otherwise, you may receive the following error message: `The workflow job cannot be resumed, either because persistence data could not be saved completely, or saved persistence data has been corrupted. You must restart the workflow.`
252
255
253
256
The following same code demonstrates how to handle this in your PowerShell Workflow runbooks.
> **Add-AzureRmAccount** is now an alias for **Connect-AzureRMAccount**. When searching your library items, if you do not see **Connect-AzureRMAccount**, you can use **Add-AzureRmAccount**, or you can update your modules in your Automation Account.
282
+
> [!NOTE]
283
+
> For non-graphical PowerShell runbooks, `Add-AzAccount` and `Add-AzureRMAccount` are aliases for [Connect-AzAccount](https://docs.microsoft.com/powershell/module/az.accounts/connect-azaccount?view=azps-3.5.0). 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.
284
+
281
285
282
286
This is not required if you are authenticating using a Run As account configured with a service principal.
0 commit comments