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/troubleshoot/runbooks.md
+47-23Lines changed: 47 additions & 23 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -24,7 +24,7 @@ When you have errors executing runbooks in Azure Automation, you can use the fol
24
24
25
25
2.**Investigate runbook**[error streams](https://docs.microsoft.com/azure/automation/automation-runbook-output-and-messages#runbook-output) for specific messages and compare them to the errors below.
26
26
27
-
3.**Ensure your Nodes and Automation workspace have the required modules:** If your runbook imports any modules, ensure they are available to your Automation Account using the steps listed in [Import Modules](../shared-resources/modules.md#import-modules). Update your modules to the latest version by following the instructions at [Update Azure modules in Azure Automation](..//automation-update-azure-modules.md). For more troubleshooting information, see [Troubleshoot Modules](shared-resources.md#modules).
27
+
3.**Ensure your Nodes and Automation workspace have the required modules:** If your runbook imports any modules, ensure they are available to your Automation account using the steps listed in [Import Modules](../shared-resources/modules.md#import-modules). Update your modules to the latest version by following the instructions at [Update Azure modules in Azure Automation](..//automation-update-azure-modules.md). For more troubleshooting information, see [Troubleshoot Modules](shared-resources.md#modules).
28
28
29
29
If your Runbook is suspended or unexpectedly failed:
30
30
@@ -59,12 +59,12 @@ If you're trying to access resources in another subscription, you can follow the
59
59
60
60
1. Go to the Automation Run As account and copy the Application ID and thumbprint.
61
61

62
-
1. Go to the subscription's Access Control where the Automation Account is NOT hosted, and add a new role assignment.
62
+
1. Go to the subscription's Access Control where the Automation account is NOT hosted, and add a new role assignment.
1. Add the Application ID you collected in the previous step. Select Contributor permissions.
65
65

66
66
1. Copy the name of the subscription for the next step.
67
-
1. You can now use the following runbook code to test the permissions from your Automation Account to the other subscription.
67
+
1. You can now use the following runbook code to test the permissions from your Automation account to the other subscription.
68
68
69
69
Replace the "\<CertificateThumbprint\>" with the value you copied in step #1 and the "\<SubscriptionName\>" value you copied in step #4.
70
70
@@ -183,7 +183,7 @@ This error can be caused by using outdated Azure modules.
183
183
184
184
This error can be resolved by updating your Azure modules to the latest version.
185
185
186
-
In your Automation Account, click **Modules**, and click **Update Azure modules**. The update takes roughly 15 minutes, once complete rerun the runbook that was failing. To learn more about updating your modules, see [Update Azure modules in Azure Automation](../automation-update-azure-modules.md).
186
+
In your Automation account, click **Modules**, and click **Update Azure modules**. The update takes roughly 15 minutes, once complete rerun the runbook that was failing. To learn more about updating your modules, see [Update Azure modules in Azure Automation](../automation-update-azure-modules.md).
187
187
188
188
## <aname="runbook-auth-failure"></a>Scenario: Runbooks fail when dealing with multiple subscriptions
189
189
@@ -240,16 +240,16 @@ The term 'Connect-AzureRmAccount' is not recognized as the name of a cmdlet, fun
240
240
241
241
This error can happen because of the following reasons:
242
242
243
-
* The module containing the cmdlet isn't imported into the Automation Account.
243
+
* The module containing the cmdlet isn't imported into the Automation account.
244
244
* The module containing the cmdlet is imported but is out of date.
245
245
246
246
### Resolution
247
247
248
248
This error can be resolved by completing one of the following tasks:
249
249
250
-
If the module is an Azure module, see [How to update Azure PowerShell modules in Azure Automation](../automation-update-azure-modules.md) to learn how to update your modules in your Automation Account.
250
+
If the module is an Azure module, see [How to update Azure PowerShell modules in Azure Automation](../automation-update-azure-modules.md) to learn how to update your modules in your Automation account.
251
251
252
-
If it's a separate module, make sure the module in imported in your Automation Account.
252
+
If it's a separate module, make sure the module in imported in your Automation account.
253
253
254
254
## <aname="job-attempted-3-times"></a>Scenario: The runbook job start was attempted three times, but failed to start each time
255
255
@@ -281,7 +281,7 @@ This error occurs due to one of the following issues.
281
281
282
282
* Module Incompatible. Update your Azure modules by following the steps in [How to update Azure PowerShell modules in Azure Automation](../automation-update-azure-modules.md).
283
283
284
-
* No Authentication with ADAL for Sandbox. When authenticating to Azure AD with a runbook, ensure that the Azure AD module is available in your Automation Account. Be sure to grant the Run As account the necessary permissions to perform the tasks that the runbook automates.
284
+
* No Authentication with ADAL for Sandbox. When authenticating to Azure AD with a runbook, ensure that the Azure AD module is available in your Automation account. Be sure to grant the Run As account the necessary permissions to perform the tasks that the runbook automates.
285
285
286
286
If your runbook can't call an executable or subprocess running in an Azure sandbox, use the runbook on a [Hybrid Runbook Worker](../automation-hrw-run-runbooks.md). Hybrid workers aren't limited by the memory and network limits that Azure sandboxes have.
287
287
@@ -429,7 +429,7 @@ This error occurs when the job execution exceeds the 500-minute free quota for y
429
429
If you want to use more than 500 minutes of processing per month, you need to change your subscription from the Free tier to the Basic tier. You can upgrade to the Basic tier by taking the following steps:
430
430
431
431
1. Sign in to your Azure subscription.
432
-
2. Select the Automation Account to upgrade.
432
+
2. Select the Automation account to upgrade.
433
433
3. Click **Settings**, then **Pricing**.
434
434
4. Click **Enable** on page bottom to upgrade your account to the **Basic** tier.
435
435
@@ -452,7 +452,7 @@ This error is caused when the PowerShell engine can't find the cmdlet you're usi
452
452
Any of the following solutions fix the problem:
453
453
454
454
* Check that you've entered the cmdlet name correctly.
455
-
* Make sure the cmdlet exists in your Automation Account and that there are no conflicts. To verify if the cmdlet is present, open a runbook in edit mode and search for the cmdlet you want to find in the library or run `Get-Command <CommandName>`. Once you've validated that the cmdlet is available to the account, and that there are no name conflicts with other cmdlets or runbooks, add it to the canvas and make sure that you're using a valid parameter set in your runbook.
455
+
* Make sure the cmdlet exists in your Automation account and that there are no conflicts. To verify if the cmdlet is present, open a runbook in edit mode and search for the cmdlet you want to find in the library or run `Get-Command <CommandName>`. Once you've validated that the cmdlet is available to the account, and that there are no name conflicts with other cmdlets or runbooks, add it to the canvas and make sure that you're using a valid parameter set in your runbook.
456
456
* If you do have a name conflict and the cmdlet is available in two different modules, you can resolve this issue by using the fully qualified name for the cmdlet. For example, you can use **ModuleName\CmdletName**.
457
457
* If you're executing the runbook on-premises in a hybrid worker group, then make sure that the module and cmdlet is installed on the machine that hosts the hybrid worker.
458
458
@@ -564,53 +564,77 @@ The nxautomationuser account for the Log Analytics agent for Linux is not correc
564
564
565
565
* Verify the configuration of the nxautomationuser account in the sudoers file. See [Running runbooks on a Hybrid Runbook Worker](../automation-hrw-run-runbooks.md)
566
566
567
+
## Scenario: Cmdlet failing in PnP PowerShell runbook on Azure Automation
568
+
569
+
### Issue
570
+
571
+
When a runbook writes a PnP PowerShell-generated object to the Azure Automation output directly, cmdlet output can't stream back to Automation.
572
+
573
+
### Cause
574
+
575
+
This issue is most commonly caused when Azure Automation processes runbooks that invoke PnP PowerShell cmdlets, for example, **add-pnplistitem**, without catching the return objects.
576
+
577
+
### Resolution
578
+
579
+
Edit your scripts to assign any return values to variables so that the cmdlets do not attempt to write whole objects to the standard output. A script can redirect the output stream to a cmdlet as shown below.
580
+
581
+
```azurecli
582
+
$null = add-pnplistitem
583
+
```
584
+
If your script parses cmdlet output, the script must store the output in a variable and manipulate the variable instead of simply streaming the output.
585
+
586
+
```azurecli
587
+
$SomeVariable = add-pnplistitem ....
588
+
if ($SomeVariable.someproperty -eq ....
589
+
```
590
+
567
591
## <aname="other"></a>My problem isn't listed above
568
592
569
593
The sections below list other common errors in addition to supporting documentation to help you resolve your issue.
570
594
571
-
## Hybrid runbook worker doesn't run jobs or isn't responding
595
+
###Hybrid runbook worker doesn't run jobs or isn't responding
572
596
573
597
If you are running jobs using a hybrid worker instead of in Azure Automation, you might need to [troubleshoot the hybrid worker itself](https://docs.microsoft.com/azure/automation/troubleshoot/hybrid-runbook-worker).
574
598
575
-
## Runbook fails with "No permission" or some variation
599
+
###Runbook fails with "No permission" or some variation
576
600
577
601
Run As accounts might not have the same permissions against Azure resources as your current account. Ensure that your Run As account has [permissions to access any resources](https://docs.microsoft.com/azure/role-based-access-control/role-assignments-portal) used in your script.
578
602
579
-
## Runbooks were working, but suddenly stopped
603
+
###Runbooks were working, but suddenly stopped
580
604
581
605
* If runbooks were previously executing but stopped, ensure that the [Run As account](https://docs.microsoft.com/azure/automation/manage-runas-account#cert-renewal) has not expired.
582
606
* If you are using webhooks to start runbooks, ensure that a [webhook](https://docs.microsoft.com/azure/automation/automation-webhooks#renew-webhook) has not expired.
583
607
584
-
## Issues passing parameters into webhooks
608
+
###Issues passing parameters into webhooks
585
609
586
610
For help with passing parameters into webhooks, see [Start a runbook from a webhook](https://docs.microsoft.com/azure/automation/automation-webhooks#parameters).
587
611
588
-
## Issues using Az modules
612
+
###Issues using Az modules
589
613
590
-
Using Az modules and AzureRM modules in the same Automation Account is not supported. For more information, see [Az modules in runbooks](https://docs.microsoft.com/azure/automation/az-modules) for more details.
614
+
Using Az modules and AzureRM modules in the same Automation account is not supported. For more information, see [Az modules in runbooks](https://docs.microsoft.com/azure/automation/az-modules) for more details.
591
615
592
-
## Inconsistent behavior in runbooks
616
+
###Inconsistent behavior in runbooks
593
617
594
618
Follow the guidance in [Runbook execution](https://docs.microsoft.com/azure/automation/automation-runbook-execution#runbook-behavior) to avoid issues with concurrent jobs, resources getting created multiple times, or other timing-sensitive logic in runbooks.
595
619
596
-
## Runbook fails with the error No permission, Forbidden (403), or some variation
620
+
###Runbook fails with the error No permission, Forbidden (403), or some variation
597
621
598
622
Run As accounts might not have the same permissions against Azure resources as your current account. Ensure that your Run As account has [permissions to access any resources](https://docs.microsoft.com/azure/role-based-access-control/role-assignments-portal) used in your script.
599
623
600
-
## Runbooks were working, but suddenly stopped
624
+
###Runbooks were working, but suddenly stopped
601
625
602
626
* If runbooks were previously executing but stopped, ensure that the Run As account has not expired. See [certification renewal](https://docs.microsoft.com/azure/automation/manage-runas-account#cert-renewal).
603
627
* If you are using webhooks to start runbooks, ensure that the webhook [has not expired](https://docs.microsoft.com/azure/automation/automation-webhooks#renew-webhook).
604
628
605
-
## Passing parameters into webhooks
629
+
###Passing parameters into webhooks
606
630
607
631
For help with passing parameters into webhooks, see [Start a runbook from a webhook](https://docs.microsoft.com/azure/automation/automation-webhooks#parameters).
608
632
609
-
## Using Az modules
633
+
###Using Az modules
610
634
611
-
Using Az modules and AzureRM modules in the same Automation Account is not supported. See [Az modules in runbooks](https://docs.microsoft.com/azure/automation/az-modules).
635
+
Using Az modules and AzureRM modules in the same Automation account is not supported. See [Az modules in runbooks](https://docs.microsoft.com/azure/automation/az-modules).
612
636
613
-
## Using self-signed certificates
637
+
###Using self-signed certificates
614
638
615
639
To use Self-Signed certificates, see [Creating a new certificate](https://docs.microsoft.com/azure/automation/shared-resources/certificates#creating-a-new-certificate).
0 commit comments