This project describes how to set up a connection between Power BI and Microsoft Graph API to retrieve data from Intune.
- A Microsoft Azure subscription
- Administrator access to Azure Active Directory
- Power BI Desktop installed on your computer
-
Log in to the [Entra Portal][(https://entra.microsoft.com/).
-
Navigate to "Application" > "App registrations".
-
Click on "New registration".
-
Give the app a name, e.g., "Intune Data Extractor".
-
Under Supported account types, select "Accounts in this organizational directory only".
-
Click "Register".
-
On the app's overview page, note down the following information:
- Application (client) ID
- Directory (tenant) ID
-
Go to "Certificates & secrets" and create a new client secret. Copy and save this immediately, as it won't be shown again.
- In your app registration, go to "API permissions".
- Click on "Add a permission".
- Select "Microsoft Graph".
- Choose "Application permissions".
- Add the following permissions:
- DeviceManagementManagedDevices.Read.All
- User.Read.All
- Click on "Grant admin consent" when you're done.
- Open Power BI Desktop.
- Click on "Get Data" and select "Blank Query".
- In Power Query Editor, go to "Manage Parameters" and create the following parameters:
- Client ID
- Client Secret
- Tenant ID
- In the Power Query Editor, click on New Source and "Blank Query".
- In the Advanced Editor window, paste the query code. The code can be found in the
IntuneDateExtractor.pqfile in this repository.
After pasting the query into the Advanced Editor in Power BI:
- You may see a prompt asking you to specify how to connect. Click "Edit Credentials".
- In the "Access Web content" dialog for https://login.windows.net/:
- Select "Anonymous" as the authentication method.
- Click "Connect".
- In the "OData feed" dialog for https://graph.microsoft.com/beta/users:
- Select "Anonymous" as the authentication method.
- Ensure the correct level (https://graph.microsoft.com/) is selected.
- Click "Connect".
- You may see a privacy levels warning. If so:
- Click "Continue".
- In the "Privacy levels" dialog, check the box next to "Ignore Privacy Levels checks for this file".
- Click "Save".
- Power BI will now attempt to load the data. If successful, you should see your user and device data in the query editor.
Note: Ignoring privacy levels could potentially expose sensitive data. Ensure you understand the implications and have appropriate security measures in place in your Power BI environment.



