Demo showing how to query Azure AD in PowerShell. Walk each step with full PowerShell source code available.
- Execute “Connect-AzureAD” with admin user
- Create self signed certificate PFX for unattended login
- Create new App Registration
- Grant permission “User.ReadAll” to MS Graph API
- Execute “Connect-AzureAD” with unattended certificate PFX login
- Execute query “Get-AzureADUser” to display results
Please leave comment with suggestions and questions. Cheers.

SOURCE CODE
https://github.com/spjeff/spadmin/blob/master/Connect-AzureAD.ps1
VIDEO
REFERENCES
- https://docs.microsoft.com/en-us/powershell/module/azuread/connect-azuread?view=azureadps-2.0
- https://docs.microsoft.com/en-us/powershell/module/azuread/new-azureadapplicationkeycredential?view=azureadps-2.0
- https://erjenrijnders.nl/2018/08/30/azuread-login-without-credentials-unattended/