I was reading this amazing piece of documentation:
My goal is to try to access the Microsoft 365 admin center and pull the list of our users, each one with their licenses:
The URL I have to point to is this: https://admin.microsoft.com/Adminportal/Home#/users
But when I try to connect with Power BI I receive the error A web API key can only be specified when a web API key name is provided
But I'm providing the key that I've created in the documentation.
What am I doing wrong?
Is there another way to access the list of our Licenses?
Initially, register one Microsoft Entra application and add Reports.Read.All
permission of Application type by granting consent like this:
You can generate access token using client credentials flow with below parameters via Postman:
POST https://login.microsoftonline.com/tenantId/oauth2/v2.0/token
grant_type:client_credentials
client_id: appId
client_secret: secret
scope: https://graph.microsoft.com/.default
Response:
Now, you can use this access token to call Microsoft Graph API for fetching users along with their licenses:
GET https://graph.microsoft.com/v1.0/reports/getOffice365ActiveUserDetail(period='D7')
Authorization: Bearer <token>
Response:
In Power BI Desktop, you can create web connection by selecting Advanced
and included Authorization header with Bearer token like this:
This pulled data with list of users along with their assigned licenses as below:
Reference: