How to get an access token from Azure AD
Concrete question, concrete answer.
The following video guides you through the process of obtaining an access token from Azure AD OAuth 2.0 Endpoint. You can further use this token to query Azure AD Graph API.
And here is PowerShell function we used in the demo: