Skip to content

Get-MgUser imports an alternate version of Microsoft.Graph.Authentication, causing AggregateException error #1981

Closed
@Lauwnch

Description

@Lauwnch

Hello,

Working with a fresh install of Microsoft.Graph from PSGallery. After Connect-MgGraph, Microsoft.Graph.Authentication version 1.25.0 is imported. Then, once Get-MgUser is run, Microsoft.Graph.Authentication version 1.27.0 is imported. Per past issues on this project where AggregateException occurred, this version mismatch may be responsible, but not sure how to resolve on my end since the module is responsible for these imports.

Only thing that you don't see in the snippet below is that, in a previous powershell session, I did run Select-MgProfile -Name "beta".

Any help is appreciated!

Windows PowerShell

Copyright (C) Microsoft Corporation. All rights reserved.

Install the latest PowerShell for new features and improvements! https://aka.ms/PSWindows

PS C:\WINDOWS\system32> Get-Module Microsoft.Graph.Identity.DirectoryManagement, Microsoft.Graph.Authentication | Select Name, Version
PS C:\WINDOWS\system32> Update-Module Microsoft.Graph
PS C:\WINDOWS\system32> Connect-MgGraph
Welcome To Microsoft Graph!
PS C:\WINDOWS\system32> Get-Module Microsoft.Graph.Identity.DirectoryManagement, Microsoft.Graph.Authentication | Select Name, Version

Name                           Version
----                           -------
Microsoft.Graph.Authentication 1.25.0


PS C:\WINDOWS\system32> Get-MgUser -All
Get-MgUser : One or more errors occurred.
At line:1 char:1
+ Get-MgUser -All
+ ~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Get-MgUser_List1], AggregateException
    + FullyQualifiedErrorId : System.AggregateException,Microsoft.Graph.PowerShell.Cmdlets.GetMgUser_List1

PS C:\WINDOWS\system32> Get-Module Microsoft.Graph.Identity.DirectoryManagement, Microsoft.Graph.Authentication | Select Name, Version

Name                           Version
----                           -------
Microsoft.Graph.Authentication 1.25.0
Microsoft.Graph.Authentication 1.27.0


PS C:\WINDOWS\system32> Get-MgContext


ClientId              :  <redacted>
TenantId              :  <redacted>
CertificateThumbprint :
Scopes                : {Application.Read.All, Application.ReadWrite.All, Directory.Read.All, Group.ReadWrite.All...}
AuthType              : Delegated
AuthProviderType      : InteractiveAuthenticationProvider
CertificateName       :
Account               :  <redacted>
AppName               : Microsoft Graph PowerShell
ContextScope          : CurrentUser
Certificate           :
PSHostVersion         : 5.1.22621.963



PS C:\WINDOWS\system32>

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions