PrepAway - Latest Free Exam Questions & Answers

How should you complete the Azure PowerShell script?

DRAG DROP
You need to automate tasks with Azure by using Azure PowerShell workflows.
How should you complete the Azure PowerShell script? To answer, drag the appropriate cmdlet to
the correct location. Each cmdlet may be used once, more than once, or not at all. You may need to
drag the split bar between panes or scroll to view content.

PrepAway - Latest Free Exam Questions & Answers

Answer:

Explanation:
workflow Use-WorkflowCheckpointSample
{
# An exception occurs if ‘HasBeenSuspended’ does not already exist.
# Exceptions that are not caught with a try/catch will cause the runbook to suspend.
Set-AutomationVariable -Name ‘HasBeenSuspended’ -Value $False
# This line occurs before the checkpoint. When the runbook is resumed after
# suspension, ‘Before Checkpoint’ will not be output a second time.
Write-Output “Before Checkpoint”
# A checkpoint is created.
Checkpoint-Workflow
# This line occurs after the checkpoint. The runbook will start here on resume.
Write-Output “After Checkpoint”
$HasBeenSuspended = Get-AutomationVariable -Name ‘HasBeenSuspended’
# If branch only executes if the runbook has not previously suspended.
if (!$HasBeenSuspended) {
Set-AutomationVariable -Name ‘HasBeenSuspended’ -Value $True
# This will cause a runtime exception. Any runtime exception in a runbook
# will cause the runbook to suspend.
1 + “abc”
}
Write-Output “Runbook Complete”
}
How to use workflow checkpoints in Azure Automation Runbooks
https://gallery.technet.microsoft.com/scriptcenter/How-to-use-workflow-cd57324f

2 Comments on “How should you complete the Azure PowerShell script?


Leave a Reply