Forum Discussion

Jerome_C63's avatar
Jerome_C63
Frequent Visitor
1 year ago
Solved

Power BI and Intune MobileApps

Hi everyone, I'm in the process of creating a dashboard for applications managed by Intune via MS Graph. Attached is my command to retrieve the id, displayname and assignments. // Step 2 :...
  • Jerome_C63's avatar
    1 year ago

    Hello Anonymous 

     

    I tried your solution but it didn't work. I was able to find a solution on my own and this is how I managed it.


    // Step 1 : Get Token
    resource = "https://graph.microsoft.com",
    tokenResponse = Json.Document(Web.Contents("https://login.windows.net/",
    [
    RelativePath = #"Azure AD Tenant ID" & "/oauth2/token",
    Content = Text.ToBinary(Uri.BuildQueryString(
    [
    client_id = #"Azure Application Client ID",
    resource = resource,
    grant_type = "client_credentials",
    client_secret = #"Azure Application Client Secret"
    ]
    )),
    Headers = [Accept = "application/json"], ManualStatusHandling = {400}
    ])),
    access_token = tokenResponse[access_token],

    // Step 2 : Query MS Graph URL
    SourceAssignmentApps = Web.Contents("https://graph.microsoft.com/beta/deviceAppManagement/mobileApps?$select=id&$expand=assignments",[ Headers = [ Authorization = "Bearer " & access_token, Accept = "application/json" ] ]),

    // Handle json to retrieve values
    parsedJsonAssignmentApps = Json.Document(SourceAssignmentApps),
    metadataAssignmentApps = Record.ToTable(parsedJsonAssignmentApps),
    ValueAssignmentApps = metadataAssignmentApps{2}[Value],

    I hope this helps others.

    Have a nice day