Jump to content

I cannot get Connect-MgGraph -Scopes "User.Read.All" to work


Recommended Posts

Posted

I've been trying all morning to get this powershell command to work and I'm getting nowhere.

 

 

Connect-MgGraph -Scopes "User.Read.All"

 

 

 

Connect-MgGraph : The term 'Connect-MgGraph' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify     
that the path is correct and try again.
At line:1 char:1
+ Connect-MgGraph -Scopes "User.Read.All"
+ ~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Connect-MgGraph:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

 

 

 

 

 

Anyone any ideas?

 

It's driving me nuts and I've wasted 3 hours today trying to get this to work :(

 

Screenshot 2025-06-26 123922.jpg

Posted

PS C:\Users\ja> Get-InstalledModule Microsoft.Graph     

Version              Name                                Repository           Description
-------              ----                                ----------           -----------
2.28.0               Microsoft.Graph                     PSGallery            Microsoft Graph PowerShell module


PS C:\Users\ja> 

 

Confirms that the module is installed...

 

Posted
1 minute ago, SteveM555 said:

Might sound silly, but have you imported the module?

Import-Module Microsoft.Graph

 

I get this: 

 

PS C:\Users\ja> Import-Module Microsoft.Graph
Import-Module : The specified module 'Microsoft.Graph' was not loaded because no valid module file was found in any module directory.
At line:1 char:1
+ Import-Module Microsoft.Graph
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ResourceUnavailable: (Microsoft.Graph:String) [Import-Module], FileNotFoundException
    + FullyQualifiedErrorId : Modules_ModuleNotFound,Microsoft.PowerShell.Commands.ImportModuleCommand

Posted

Have you installed it for your user, but running Powershell as Admin? or the other way around? Id suggest running the following if so:

Uninstall-Module Microsoft.Graph -Force -AllVersions and then Install-Module Microsoft.Graph -Scope AllUsers -Force

  • Like 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...