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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

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
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Kudoed Authors