Get-MgUser: Insufficient Privileges To Complete The Operation

Introduction

When connecting to Graph PowerShell Module and trying to read the users information, I saw the error below:

The error says ‘Insufficient Privileges’ to complete the operation.

Cause

When connecting to Graph Module in PowerShell, it basically connects with the default scope, which is ‘User.Read’. This means you have access to read only your profile.

Fix

Step 1

First, disconnect the existing graph session by running the below command:

#To disconnect Graph Session
Disconnect-MgGraph

Step 2

Connect to your tenant using the Microsoft Graph application with the required scopes with a privileged account or Global Admin account.

Connect-MgGraph -Scopes "User.Read.all","Application.Read.All"

Step 3

Now try running the command below to validate that you have updated the scopes so that you are able to read all users' information in your tenant.

Connect-MgGraph -Scopes "User.Read.all","Application.Read.All"

References