Skip to content

Commit 3d32069

Browse files
authored
AB#6262: Microsoft Graph PowerShell throws error 'IDX14102: Unable to decode the header'
1 parent 547f2b5 commit 3d32069

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
@@ -331,6 +331,8 @@
331331
href: users-groups-entra-apis/b2c-or-tenant-premium-license-sign-in-activities.md
332332
- name: Problem with using the Graph SDK - libraries
333333
items:
334+
- name: IDX14102 error - Unable to decode the header
335+
href: users-groups-entra-apis/idx14102-unable-to-decode-the-header.md
334336
- name: Python scripts making requests are detected as web crawlers
335337
href: users-groups-entra-apis/python-scripts-microsoft-graph-requests-detected-as-web-crawler.md
336338
- 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: Describes an error that occurs when you run the Microsoft Graph PowerShell Connect-MgGraph cmdlet and provides solutions to it.
4+
ms.date: 06/18/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 an 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 acquired 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 only accepts a plaint string for 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 acquire 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)