The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.
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
Hi @Anonymous ,
About creating Intune report in Power BI, you can refer:
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.
@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