Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
Anonymous
Not applicable

Assistance with Intune report exports for use with Power BI

Morning all,

 

I have a business requirement to export the Windows Defender reports from Intune which I can do if using a PowerShell script (https://github.com/ztrhgf/useful_powershell_functions/blob/master/INTUNE/Get-IntuneReport.ps1).

 

The script has four main elements.

 

1. The OAuth2 authentication request.

2. Rest API Post request to generate the required report(s).

3. Rest API Get request to check if the report has been generated (loops)

4. Rest API Get request to download the zip file which contains a CSV file.

 

Can anyone help me with some code please which would allow me to display the data for the report 'UnhealthyDefenderAgents'?

 

I do have PoC code for accessing MS Graph.

 

let
token_uri = "https://login.windows.net/" & #"Azure Tenant ID" & "/oauth2/token",
resource="https://graph.microsoft.com",
tokenResponse = Json.Document(Web.Contents(token_uri,
[
Content = Text.ToBinary(Uri.BuildQueryString(
[
client_id = #"Azure Application ID",
resource = resource,
grant_type = "client_credentials",
client_secret = #"Azure Application Client Secret"
]
)),
Headers = [Accept = "application/json"], ManualStatusHandling = {400}
])),
access_token = tokenResponse[access_token],
Source = OData.Feed("https://graph.microsoft.com/v1.0/deviceManagement/managedDevices", [ Authorization = "Bearer " & access_token ], [ ExcludedFromCacheKey = {"Authorization"}, ODataVersion = 4, Implementation = "2.0" ])
in
Source

 

Thanks in advance for any help you can give.

 

Mike

2 REPLIES 2
v-yingjl
Community Support
Community Support

Hi @Anonymous ,

About creating Intune report in Power BI, you can refer:

  1. Create custom reports using Power BI 
  2. How to Leverage Intune Data and Write a Basic Power BI Report 
  3. Microsoft Intune Reports with Power BI | create Reports with Power BI Intune 

 

Best Regards,
Community Support Team _ Yingjie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

@v-yingjl - Thank-you for the links.

 

Your second & third links references Intune Data Warehouse which does not use real-time data instead is only updated once a day which does not meet our requirements which is why we are trying to use MS Graph.

 

Need help to create code for each of the API rest requests.

 

Regards

 

Mike

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors
Top Kudoed Authors