Skip to content

Commit db95a63

Browse files
committed
Fixing link errors
1 parent 0065b93 commit db95a63

File tree

2 files changed

+20
-16
lines changed

2 files changed

+20
-16
lines changed

articles/automation/automation-orchestrator-migration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ For example, a runbook may use a variable to populate a particular value in an a
130130

131131
### Input parameters
132132

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.
134134

135135
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.
136136

articles/automation/automation-powershell-workflow.md

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,12 @@ A workflow is a sequence of programmed, connected steps that perform long-runnin
1414

1515
For complete details on the topics in this article, see [Getting Started with Windows PowerShell Workflow](https://technet.microsoft.com/library/jj134242.aspx).
1616

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+
1720
## Basic structure of a workflow
1821

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:
2023

2124
```powershell
2225
Workflow Test-Workflow
@@ -27,7 +30,7 @@ Workflow Test-Workflow
2730

2831
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*.
2932

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.
3134

3235
## Code changes
3336

@@ -93,7 +96,7 @@ Workflow Stop-MyService
9396

9497
## InlineScript
9598

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.
97100

98101
InlineScript uses the following syntax shown below.
99102

@@ -148,7 +151,7 @@ For more information on using InlineScript, see [Running Windows PowerShell Comm
148151

149152
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.
150153

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.
152155

153156
```powershell
154157
Parallel
@@ -183,7 +186,7 @@ Workflow Copy-Files
183186
}
184187
```
185188

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.
187190

188191
```powershell
189192
ForEach -Parallel -ThrottleLimit 10 ($<item> in $<collection>)
@@ -216,7 +219,7 @@ Workflow Copy-Files
216219
217220
## Checkpoints
218221

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.
220223

221224
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.
222225

@@ -248,36 +251,37 @@ Workflow Copy-Files
248251
}
249252
```
250253

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.`
252255

253256
The following same code demonstrates how to handle this in your PowerShell Workflow runbooks.
254257

255258
```powershell
256259
workflow CreateTestVms
257260
{
258-
$Cred = Get-AzureAutomationCredential -Name "MyCredential"
259-
$null = Connect-AzureRmAccount -Credential $Cred
261+
$Cred = Get-AzAutomationCredential -Name "MyCredential"
262+
$null = Connect-AzAccount -Credential $Cred
260263
261-
$VmsToCreate = Get-AzureAutomationVariable -Name "VmsToCreate"
264+
$VmsToCreate = Get-AzAutomationVariable -Name "VmsToCreate"
262265
263266
foreach ($VmName in $VmsToCreate)
264267
{
265268
# Do work first to create the VM (code not shown)
266269
267270
# Now add the VM
268-
New-AzureRmVm -VM $Vm -Location "WestUs" -ResourceGroupName "ResourceGroup01"
271+
New-AzVM -VM $Vm -Location "WestUs" -ResourceGroupName "ResourceGroup01"
269272
270273
# Checkpoint so that VM creation is not repeated if workflow suspends
271274
$Cred = $null
272275
Checkpoint-Workflow
273-
$Cred = Get-AzureAutomationCredential -Name "MyCredential"
274-
$null = Connect-AzureRmAccount -Credential $Cred
276+
$Cred = Get-AzAutomationCredential -Name "MyCredential"
277+
$null = Connect-AzAccount -Credential $Cred
275278
}
276279
}
277280
```
278281

279-
> [!IMPORTANT]
280-
> **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+
281285

282286
This is not required if you are authenticating using a Run As account configured with a service principal.
283287

0 commit comments

Comments
 (0)