Skip to content

Commit ab41966

Browse files
author
Simonx Xu
authored
Merge pull request #9152 from AmandaAZ/Branch-CI6262
AB#6262: Microsoft Graph PowerShell throws error 'IDX14102: Unable to…
2 parents 31c9b94 + 866049e commit ab41966

File tree

2 files changed

+45
-0
lines changed

2 files changed

+45
-0
lines changed

support/entra/entra-id/toc.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,8 @@
337337
href: users-groups-entra-apis/b2c-or-tenant-premium-license-sign-in-activities.md
338338
- name: Problem with using the Graph SDK - libraries
339339
items:
340+
- name: IDX14102 error - Unable to decode the header
341+
href: users-groups-entra-apis/unable-to-decode-header-error.md
340342
- name: Python scripts making requests are detected as web crawlers
341343
href: users-groups-entra-apis/python-scripts-microsoft-graph-requests-detected-as-web-crawler.md
342344
- 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)