Forum Discussion
Power BI and Intune MobileApps
- 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
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