Skip to content

Commit 358e739

Browse files
authored
Merge pull request #9244 from MicrosoftDocs/main
Auto push to live 2025-07-01 02:43:08
2 parents 2f7abff + ab41966 commit 358e739

File tree

6 files changed

+207
-3
lines changed

6 files changed

+207
-3
lines changed
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
---
2+
title: Troubleshoot Runbook Execution Issues in Azure Automation
3+
description: Provides troubleshooting guidance on runbook execution issues in Azure Automation.
4+
ms.date: 07/01/2025
5+
ms.service: azure-automation
6+
ms.reviewer: adoyle, v-weizhu
7+
ms.custom: sap:Runbook not working as expected
8+
---
9+
# Troubleshoot runbook execution issues in Azure Automation
10+
11+
Process automation in Azure Automation allows you to create and manage PowerShell, a PowerShell workflow, and graphical runbooks. Azure Automation executes your runbooks based on the logic defined within them. This article provides troubleshooting guidance on runbook execution issues in Azure Automation.
12+
13+
> [!NOTE]
14+
>
15+
> - If you use the Newtonsoft.Json v10, be sure to import this module explicitly so that your PowerShell 5.1 and PowerShell 7.1 runbooks that have a dependency on this version of the module function correctly.
16+
> - PowerShell 7.1 is no longer supported by the parent product PowerShell. We recommend creating PowerShell 7.2 runbooks for long-term support. Learn more about [PowerShell 7.2 runbooks](/azure/automation/automation-runbook-types).
17+
> - If none of the following solutions resolves your issue, see [Data to collect when opening a case for Microsoft Azure Automation](/azure/automation/troubleshoot/collect-data-microsoft-azure-automation-case) before opening a support case.
18+
> - Azure Automation enables the recovery of runbooks deleted in the last 29 days. You can restore the deleted runbook by running a PowerShell script as a job in your Automation account. For more information, see [Restore deleted runbook](/azure/automation/manage-runbooks#restore-deleted-runbook).
19+
20+
## Troubleshoot error code 400, 403, and 429
21+
22+
|Error|Solution|
23+
|---|---|
24+
|`400 Bad Request: This webhook is expired or disabled`|To resolve this error, see [400 Bad Request status when calling a webhook](/azure/automation/troubleshoot/runbooks#expired%20webhook).|
25+
|`The remote server returned an error: (403) Forbidden`|To resolve this error, see [Access blocked to Azure Storage, or Azure Key Vault, or Azure SQL](/azure/automation/troubleshoot/runbooks#scenario-access-blocked-to-azure-storage-or-azure-key-vault-or-azure-sql).|
26+
|`this.Client.SubscriptionId cannot be null`|To resolve this error, see [Runbook fails with "this.Client.SubscriptionId cannot be null." error message](/azure/automation/troubleshoot/runbooks#runbook-fails-no-permission).|
27+
|`ErrorCode: AuthorizationFailed` </br></br>`StatusCode: 403`|To resolve this error, see [Runbooks fail when dealing with multiple subscriptions](/azure/automation/troubleshoot/runbooks#runbook-auth-failure).|
28+
|`429: The request rate is currently too large. Please try again.`|To resolve this error, see [429: The request rate is currently too large](/azure/automation/troubleshoot/runbooks#429).|
29+
30+
## Troubleshoot errors related to cmdlet not recognized, sign-in required, or subscription missing
31+
32+
|Error|Solution|
33+
|---|---|
34+
|Runbooks fail with the error `The subscription named <subscription name> cannot be found.`|This error can occur when the runbook doesn't use a managed identity to access Azure resources. To resolve this error, see [Unable to find the Azure subscription](/azure/automation/troubleshoot/runbooks#unable-to-find-subscription).|
35+
|`Your Azure credentials haven't been set up or have expired, please run connect-azureRmAccount to set up your azure credentials.`|This error can occur when you don't use a managed identity. To resolve this error, use a managed identity.|
36+
|`Command not recognized.`|This error often occurs when modules aren't imported or are out of date. Make sure that dependent modules in your script are [imported into Azure Automation](/azure/automation/automation-runbook-gallery#modules-in-the-powershell-gallery) and are the correct version. If the module is in your Automation account, there might be an issue loading it into the sandbox. Try adding an explicit `import-module` statement at the beginning of your runbook.|
37+
|`Forbidden with client authentication scheme 'anonymous'`.|This error occurs when using credentials in an Azure Automation sandbox. To resolve this error, use a managed identity.|
38+
|`Unable to require token for tenant <tenant-id>`.|This error occurs when using credentials in an Azure Automation sandbox. To resolve this error, use a managed identity.|
39+
|`Server failed to authenticate the request.`|This error occurs when using credentials in an Azure Automation sandbox. To resolve this error, use a managed identity.|
40+
|Errors when using the `Connect-AzAccount` cmdlet.|To resolve this issue, see [Sign-in to Azure account failed](/azure/automation/troubleshoot/runbooks#sign-in-failed).|
41+
|`The term 'Connect-AzAccount' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if the path was included verify that the path is correct and try again.`|To resolve this error, see [Term not recognized as the name of a cmdlet, function, or script](/azure/automation/troubleshoot/runbooks#not-recognized-as-cmdlet).|
42+
|Cmdlet fails in PnP PowerShell runbook on Azure Automation.|To resolve this issue, see [Cmdlet fails in PnP PowerShell runbook on Azure Automation](/azure/automation/troubleshoot/runbooks#scenario-cmdlet-fails-in-pnp-powershell-runbook-on-azure-automation).|
43+
|`<cmdlet name>: The term <cmdlet name> is not recognized as the name of a cmdlet, function, script file, or operable program.`|To resolve this error, see [Cmdlet not recognized when executing a runbook](/azure/automation/troubleshoot/runbooks#cmdlet-not-recognized).|
44+
45+
## Troubleshoot issues with suspended runbooks, job failures, stopped runbooks, hybrid workers, and subscriptions
46+
47+
|Issue|Solution|
48+
|---|---|
49+
|Runbook is suspended or unexpectedly fails.|Review your [Job Statuses](/azure/automation/automation-runbook-execution#job-statuses) for runbook statuses and possible causes. [Add more output](/azure/automation/automation-runbook-output-and-messages#message-streams) to identify what happens before the runbook is suspended. [Handle any exceptions](/azure/automation/automation-runbook-execution#exceptions) thrown by your job. Retry your job when certain exceptions occur, such as WebSocket exceptions, to prevent transient network failures from causing runbook failures. If you have issues with a cmdlet, you might find more information with the service you try to use through the cmdlet. For example, the `New-AzAnalysisServicesServer` cmdlet related issues might end up with the Analysis Services team.|
50+
|Job was tried three times, but it failed.|Check the [Automation Limits](/azure/azure-subscription-service-limits#azure-automation-limits). If the limitation applies to Azure sandboxes only, consider moving to a [hybrid worker](/azure/automation/automation-hybrid-runbook-worker).|
51+
|Runbooks were working but stopped.|[Make sure to use a managed identity](/azure/automation/migrate-run-as-accounts-managed-identity#cert-renewal). If [using webhooks to start runbooks](/azure/automation/automation-webhooks#renew-webhook), make sure the webhook hasn't expired.|
52+
|Issues when using a hybrid worker.|To resolve these issues, see [Hybrid Runbook Worker troubleshooting guide](/azure/automation/troubleshoot/hybrid-runbook-worker).|
53+
|Runbook is stuck.|If you can't stop a runbook job in the Azure portal, try stopping it by using the PowerShell cmdlet `Stop-AzureRmAutomationJob` or `Stop-AzAutomationJob`.|
54+
|Can't start or schedule a runbook.|To resolve this issue, make sure your runbook [is published](/azure/automation/manage-runbooks#publish-a-runbook).|
55+
|Issues when using cmdlets that depend on binaries.|Some cmdlets rely on binaries, such as Microsoft Data Access Components (MDAC) or the Azure Fabric SDK. These cmdlets can't be run in the Azure Automation sandbox and must be executed through [a hybrid worker](/azure/automation/automation-hybrid-runbook-worker).|
56+
|Issues when there are multiple subscriptions in a runbook.|To manage Azure resources across several subscriptions with Azure Automation, see [Dealing with multiple subscriptions](/azure/automation/troubleshoot/runbooks#runbook-auth-failure) to prevent errors.|
57+
58+
## Troubleshoot common issues
59+
60+
The following table helps you troubleshoot common issues with runbooks:
61+
62+
|Issue|Solution|
63+
|---|---|
64+
|Unable to create a new Automation job in the West Europe region.|This issue occurs because of scalability limits with the Automation service in the West Europe region. To resolve it, follow the steps in [Unable to create new Automation job in West Europe region](/azure/automation/troubleshoot/runbooks#scenario-unable-to-create-new-automation-job-in-west-europe-region).|
65+
|Runbook bugs or Azure Automation issues.|To learn how to troubleshoot common scenarios, see [Troubleshoot runbook issues](/azure/automation/troubleshoot/runbooks#runbook-fails).|
66+
|Runbook output and message issues.| To resolve such issues, see [Retrieve runbook output and messages](/azure/automation/automation-runbook-output-and-messages#runbook-output).|
67+
|PowerShell module issues in Azure Automation.|To resolve such issues, see [Update Azure PowerShell modules in Automation](/azure/automation/automation-update-azure-modules).|
68+
69+
## References
70+
71+
- [How to start a runbook in Azure Automation](/azure/automation/start-runbooks)
72+
- [PowerShell runbooks](/azure/automation/automation-runbook-types#powershell-runbooks)
73+
- [Set-AzSqlDatabase](/powershell/module/az.sql/set-azsqldatabase) that sets properties for a database or move an existing database into an elastic pool

support/azure/automation/toc.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,15 @@
22
href: welcome-automation.yml
33
- name: Runbook not working as expected
44
items:
5-
- name: Troubleshoot error codes during runbook execution
6-
href: runbooks/error-running-powershell-runbook.md
75
- name: Runbook jobs get suspended
86
href: runbooks/runbook-job-suspended.md
7+
- name: Troubleshoot error codes during runbook execution
8+
href: runbooks/error-running-powershell-runbook.md
99
- name: Troubleshoot issues with python packages
1010
href: runbooks/error-running-python-runbook.md
1111
- name: Troubleshoot issues with runbook execution start time
1212
href: runbooks/job-not-start-as-expected.md
13+
- name: Troubleshoot runbook execution issues
14+
href: runbooks/troubleshoot-runbook-execution-issues.md
1315
- name: Troubleshoot runbook execution issues when using PowerShell
1416
href: runbooks/powershell-job-script-cmdlets-not-working.md

support/azure/automation/welcome-automation.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ landingContent:
2121
- title: Runbook not working as expected
2222
linkLists:
2323
- linkListType: how-to-guide
24-
links:
24+
links:
2525
- text: Runbook jobs get suspended
2626
url: runbooks/runbook-job-suspended.md
2727
- text: Troubleshoot error codes during runbook execution
@@ -30,5 +30,7 @@ landingContent:
3030
url: runbooks/error-running-python-runbook.md
3131
- text: Troubleshoot issues with runbook execution start time
3232
url: runbooks/job-not-start-as-expected.md
33+
- text: Troubleshoot runbook execution issues
34+
url: runbooks/troubleshoot-runbook-execution-issues.md
3335
- text: Troubleshoot runbook execution issues when using PowerShell
3436
url: runbooks/powershell-job-script-cmdlets-not-working.md
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
---
2+
title: MsalClientException - Failed to Get User Name
3+
description: Resolves the Failed to get user name error when an application uses Integrated Windows Authentication (IWA) with Microsoft Authentication Library (MSAL).
4+
ms.service: entra-id
5+
ms.date: 07/01/2025
6+
ms.reviewer: willfid, v-weizhu
7+
ms.custom: sap:Developing or Registering apps with Microsoft identity platform
8+
---
9+
10+
# Microsoft.Identity.Client.MsalClientException: Failed to get user name
11+
12+
This article provides a solution to the "Failed to get user name" error that occurs when an application uses Integrated Windows Authentication (IWA) together with Microsoft Authentication Library (MSAL).
13+
14+
## Symptoms
15+
16+
When your application uses IWA together with MSAL, if calling the `AcquireTokenByIntegratedWindowsAuth` method as follows:
17+
18+
```csharp
19+
result = await app.AcquireTokenByIntegratedWindowsAuth(scopes)
20+
```
21+
22+
You encounter one of the following errors:
23+
24+
- > Microsoft.Identity.Client.MsalClientException: Failed to get user name>
25+
> System.ComponentModel.Win32Exception: No mapping between account names and security IDs was done
26+
27+
- > Microsoft.Identity.Client.MsalClientException: Failed to get user name>
28+
> System.ComponentModel.Win32Exception: Access Denied
29+
30+
## Cause
31+
32+
The error originates from Windows. It occurs because MSAL calls the [GetUserNameEx](/windows/win32/api/secext/nf-secext-getusernameexa) function from `secur32.dll`. For more information, see [MSAL WindowsNativeMethods.cs - GetUserNameEx](https://github.com/AzureAD/microsoft-authentication-library-for-dotnet/blob/01ecd12464007fc1988b6a127aa0b1b980bca1ed/src/client/Microsoft.Identity.Client/Platforms/Features/DesktopOS/WindowsNativeMethods.cs#L66).
33+
34+
## Solution
35+
36+
> [!NOTE]
37+
> Before you begin, ensure the following minimum requirements are met:
38+
>
39+
> - Run the application as a local Active Directory user, not a local computer user account.
40+
> - The device running the application is joined to the domain.
41+
42+
To resolve this issue, pass the username to `AcquireTokenByIntegratedWindowsAuth`.
43+
44+
If the username is known beforehand, you can manually pass it to MSAL as follows:
45+
46+
```csharp
47+
result = await app.AcquireTokenByIntegratedWindowsAuth(scopes).WithUsername("<service-account>@contoso.com")
48+
```
49+
50+
If the username isn't known beforehand, dynamically retrieve the username and then pass it to `AcquireTokenByIntegratedWindowsAuth` by using one of the following methods:
51+
52+
- Use `System.Security.Principal.WindowsIdentity.GetCurrent()`
53+
54+
Here's the code example:
55+
56+
```csharp
57+
string username = System.Security.Principal.WindowsIdentity.GetCurrent().Name;
58+
result = await app.AcquireTokenByIntegratedWindowsAuth(scopes).WithUsername(username)
59+
```
60+
61+
> [!NOTE]
62+
> If the returned username doesn't include a domain, this method fails and returns different errors. For proper integration with Microsoft Entra ID, you must pass the username in the format of a user principal name.
63+
64+
- Use `PublicClientApplication.OperatingSystemAccount.Username`
65+
66+
Here's the code example:
67+
68+
```csharp
69+
string username = PublicClientApplication.OperatingSystemAccount.Username;
70+
result = await app.AcquireTokenByIntegratedWindowsAuth(scopes).WithUsername(username)
71+
```
72+
73+
> [!NOTE]
74+
> This method tries to access the Windows Account Broker to sign the user into the device. It doesn't work if the application runs on Internet Information Services (IIS) or Windows Server.
75+
76+
## Reference
77+
78+
[Using MSAL.NET with Integrated Windows Authentication (IWA)](/entra/msal/dotnet/acquiring-tokens/desktop-mobile/integrated-windows-authentication)
79+
80+
[!INCLUDE [Azure Help Support](../../../includes/azure-help-support.md)]

support/entra/entra-id/toc.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@
6767
href: app-integration/troubleshoot-error-idx10501-aspnet-b2c.md
6868
- name: Infinite sign-in loop issue with ASP.NET applications
6969
href: app-integration/asp-dot-net-application-infinite-sign-in-loop.md
70+
- name: MsalClientException - Failed to get user name
71+
href: app-integration/msal-client-exception-failed-to-get-user-name.md
7072
- name: No account or login hint was passed to the AcquireTokenSilent
7173
href: app-integration/no-account-login-hint-passed-acquire-token-silent.md
7274
- name: Package Inspector for MSAL Android Native
@@ -335,6 +337,8 @@
335337
href: users-groups-entra-apis/b2c-or-tenant-premium-license-sign-in-activities.md
336338
- name: Problem with using the Graph SDK - libraries
337339
items:
340+
- name: IDX14102 error - Unable to decode the header
341+
href: users-groups-entra-apis/unable-to-decode-header-error.md
338342
- name: Python scripts making requests are detected as web crawlers
339343
href: users-groups-entra-apis/python-scripts-microsoft-graph-requests-detected-as-web-crawler.md
340344
- name: Microsoft Entra User Provisioning and Synchronization
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
---
2+
title: IDX14102 Error When Using Microsoft Graph PowerShell
3+
description: Resolves an error that occurs when you run the Microsoft Graph PowerShell cmdlet Connect-MgGraph.
4+
ms.date: 07/01/2025
5+
ms.service: entra-id
6+
ms.custom: sap:Problem with using the Graph SDK - libraries
7+
ms.reviewer: adoyle, willfid, nualex, v-weizhu
8+
---
9+
10+
# Microsoft Graph PowerShell throws error "IDX14102: Unable to decode the header"
11+
12+
This article provides solutions to the error "IDX14102: Unable to decode the header" that occurs when you use Microsoft Graph PowerShell.
13+
14+
## Symptoms
15+
16+
When running the Microsoft Graph PowerShell command `Connect-MgGraph -AccessToken $token`, you receive the following error:
17+
18+
> IDX14102: Unable to decode the header
19+
20+
## Cause
21+
22+
This error occurs because an invalid access token is passed to the `AccessToken` parameter of the `Connect-MgGraph` cmdlet. This problem often occurs when the token is obtained via Azure PowerShell's `Get-AzAccessToken` cmdlet and passed as a `SecureString`. This behavior is observed starting with version 5.0.0 of the `Az.Accounts` module. Starting from Microsoft Graph PowerShell version 2.28.0, the `Connect-MgGraph` command accepts only a plain string as the `AccessToken` parameter.
23+
24+
## Solution
25+
26+
Here are two solutions for resolving this issue:
27+
28+
- Make sure the access token passed to the `AccessToken` parameter of the `Connect-MgGraph` cmdlet is valid.
29+
30+
For more information about access tokens, see [Access tokens in the Microsoft identity platform](/entra/identity-platform/access-tokens).
31+
32+
- If you use the `Get-AzAccessToken` cmdlet to obtain the access token, use one of the following methods:
33+
34+
- Downgrade `Az.Accounts` to version 4.2.0 to avoid the token being returned as a `SecureString`.
35+
- Convert the token from `SecureString` to `String`:
36+
37+
```azurepowershell
38+
$microsoftGraphToken = Get-AzAccessToken -ResourceUrl "https://graph.microsoft.com"
39+
40+
Connect-MgGraph -AccessToken (ConvertFrom-SecureString -SecureString $microsoftGraphToken.Token -AsPlainText)
41+
```
42+
43+
[!INCLUDE [Azure Help Support](../../../includes/azure-help-support.md)]

0 commit comments

Comments
 (0)