In this blog, you will see how to call Microsoft Graph service using Microsoft Graph PowerShell SDK.
Prerequisites
Install the following modules
- Install-Module Microsoft.Graph
PowerShell Script
Open Notepad and paste the following script. Save the file as script.ps1.
- # Connect To Graph and authenticate using Delegated access via Device Code Flow
- Connect-Graph -Scopes "User.Read"
-
- # Retrieve all users
- Get-MgUser
-
- # Disconnect
- Disconnect-Graph
Open SharePoint Online Management shell and navigate to the location where the script file was saved.
Run the following command.
.\script.ps1
Reference
https://github.com/microsoftgraph/msgraph-sdk-powershell
Summary
Thus, in this blog, you saw how to call Microsoft Graph service using Microsoft Graph PowerShell SDK.