Skip to content

Intune-Set-PrimaryUsers.ps1 - Import-Module Microsoft.Graph.Authentication fails with GetTokenAsync TypeLoadException (v2.35.1) #33

@Sri-Boddupalli

Description

@Sri-Boddupalli

When importing Microsoft.Graph.Authentication (version 2.35.1), the module fails to load with a TypeLoadException.
As a result, Connect-MgGraph and Disconnect-MgGraph are not usable, and any script depending on Microsoft Graph authentication fails at runtime.
This occurs during module import, before any Graph request is executed.

Error Message:

Import-Module : Method 'GetTokenAsync' in type
'Microsoft.Graph.PowerShell.Authentication.Core.Utilities.UserProvidedTokenCredential'
from assembly 'Microsoft.Graph.Authentication.Core, Version=2.35.1.0'
does not have an implementation.

CategoryInfo          : NotSpecified: (:) [Import-Module], TypeLoadException
FullyQualifiedErrorId : System.TypeLoadException,Microsoft.PowerShell.Commands.ImportModuleCommand

Subsequent errors after the failed import:

The 'Connect-MgGraph' command was found in the module
'Microsoft.Graph.Authentication', but the module could not be loaded.
For more information, run 'Import-Module Microsoft.Graph.Authentication'.
Failed to disconnect from Graph:
The 'Disconnect-MgGraph' command was found in the module
'Microsoft.Graph.Authentication', but the module could not be loaded.

Environment:
PowerShell: Windows PowerShell 5.1
Module: Microsoft.Graph.Authentication 2.35.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions