A simple example of how to authenticate users interactively (supports MFA) with Azure AD/Microsoft Entra and then call the Microsoft Graph API from a Golang application.
I ran into several problems and lacking documentation when trying to do this myself, so I hope this helps someone else.
- Create an Azure AD application following the steps here. Secrets/certificates are not required for user authentication.
- Create a
.envfile and place it in the root of the project. The file should contain the following values:
CLIENT_ID=<your client id>
TENANT_ID=<your tenant id>