Query Azure AD (Connect-AzureAD) unattended with Azure App Registration certificate PFX

Demo showing how to query Azure AD in PowerShell. Walk each step with full PowerShell source code available.

  1. Execute “Connect-AzureAD” with admin user
  2. Create self signed certificate PFX for unattended login
  3. Create new App Registration
  4. Grant permission “User.ReadAll” to MS Graph API
  5. Execute “Connect-AzureAD” with unattended certificate PFX login
  6. 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/

Return to Top ▲Return to Top ▲