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

Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers. Get Fabric certified for FREE! Learn more

Reply
Jerome_C63
Frequent Visitor

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 : Query MS Graph URL
Source = OData.Feed(“https://graph.microsoft.com/v1.0/deviceAppManagement/mobileApps?$select=id,displayName,assignments,c..., [ Authorization = “Bearer ‘ & access_token ], [ ExcludedFromCacheKey = {’Authorization”}, ODataVersion = 4, Implementation = “2.0” ]),

#“Renamed Columns” = Table.RenameColumns(Source,{{“id”, “Appsid”}})
in
#Renamed Columns


I get my 4 columns with a “Table” for the values for “assignments” and “categories”.
When I click on a “Table” to see the values linked to an application, I get a nice error message.

Jerome_C63_0-1743675531650.jpeg

In my opinion, Power BI uses the wrong URL Url=https://graph.microsoft.com/v1.0/deviceAppManagement/mobileApps('4e7d39d6-4466-4636-89e3-1172ff69135... because when I run the following query I get the result I want by doing some transformation afterwards.

 

    #“Apps with Assignments” = Table.AddColumn(Source, “Assignments”, each 
        let 
            appId = [id],
            assignments = try OData.Feed(“https://graph.microsoft.com/v1.0/deviceAppManagement/mobileApps/” & appId & “/assignments”, 
                [ Authorization = “Bearer ” & access_token ], 
                [ ExcludedFromCacheKey = {“Authorization”}, ODataVersion = 4, Implementation = “2.0” ])
        in 
            assignments
    ),

 

The problem with doing it this way is that I launch as many requests as there are applications and this has an impact on data retrieval time.

 

Do you have a better solution for retrieving information from “Tables” without having to relaunch an application-specific MS Graph query in Power Bi?



Thank you in advance for your ideas



1 ACCEPTED SOLUTION
Jerome_C63
Frequent Visitor

Hello @v-pgoloju 

 

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

View solution in original post

6 REPLIES 6
v-pgoloju
Community Support
Community Support

Hi @Jerome_C63,

 

Sure! Here's a rephrased version of your message:


Thanks for sharing the solution! If you could kindly mark your response as the "Accepted Solution", it would really help others in the community who might face a similar issue. It’ll make it easier for them to find the answer quickly.

 

Thanks & regards,

Prasanna Kumar

Jerome_C63
Frequent Visitor

Hello @v-pgoloju 

 

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

v-pgoloju
Community Support
Community Support

Hi @Jerome_C63,

Just a gentle reminder — has your issue been resolved? If so, we’d be grateful if you could mark the solution that worked as Accepted Solution, or feel free to share your own if you found a different fix.

This not only closes the loop on your query but also helps others in the community solve similar issues faster.

Thank you for your time and feedback!

 

Best,

Prasanna Kumar

v-pgoloju
Community Support
Community Support

Hi @Jerome_C63,

 

we wanted to kindly follow up to check if the solution provided for the issue worked? or Let us know if you need any further assistance?

If our response addressed, please mark it as Accept as solution and click Yes if you found it helpful.

 

Regards,

Prasanna Kumar

v-pgoloju
Community Support
Community Support

Hi @Jerome_C63,

 

As we haven’t heard back from you, we wanted to kindly follow up to check if the solution provided for the issue worked? or Let us know if you need any further assistance?
If our response addressed, please mark it as Accept as solution and click Yes if you found it helpful.

 

Regards,
Prasanna Kumar

v-pgoloju
Community Support
Community Support

Hell0 @Jerome_C63 

Thank you for reaching out to the Microsoft Fabric Forum Community.

 

Use $expand=assignments,categories in the Graph API URL to include navigation property data in a single request.

Use Table.ExpandTableColumn after expansion to flatten nested data for reporting.

Combine $select and $expand like this:

// Step 1: Query MS Graph API with $expand
Source = OData.Feed("https://graph.microsoft.com/v1.0/deviceAppManagement/mobileApps?$select=id,displayName&$expand=assig...",
[Authorization = "Bearer " & access_token, ExcludedFromCacheKey = {"Authorization"}, ODataVersion = 4, Implementation = "2.0"]),

// Step 2: Expand Assignments and Categories
ExpandedAssignments = Table.ExpandTableColumn(Source, "assignments", {"id", "target", "intent"}, {"AssignmentId", "Target", "Intent"}),
ExpandedCategories = Table.ExpandTableColumn(ExpandedAssignments, "categories", {"id", "displayName"}, {"CategoryId", "CategoryName"}),

// Step 3: Rename Columns
RenamedColumns = Table.RenameColumns(ExpandedCategories, {{"id", "Appsid"}})
in
RenamedColumns


If this information is helpful, please “Accept it as a solution” and give a "kudos" to assist other community members in resolving similar issues more efficiently.
Thank you.

Helpful resources

Announcements
Notebook Gallery Carousel1

NEW! Community Notebooks Gallery

Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.

April2025 Carousel

Fabric Community Update - April 2025

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

"); $(".slidesjs-pagination" ).prependTo(".pagination_sec"); $(".slidesjs-pagination" ).append("
"); $(".slidesjs-play.slidesjs-navigation").appendTo(".playpause_sec"); $(".slidesjs-stop.slidesjs-navigation").appendTo(".playpause_sec"); $(".slidesjs-pagination" ).append(""); $(".slidesjs-pagination" ).append(""); } catch(e){ } /* End: This code is added by iTalent as part of iTrack COMPL-455 */ $(".slidesjs-previous.slidesjs-navigation").attr('tabindex', '0'); $(".slidesjs-next.slidesjs-navigation").attr('tabindex', '0'); /* start: This code is added by iTalent as part of iTrack 1859082 */ $('.slidesjs-play.slidesjs-navigation').attr('id','playtitle'); $('.slidesjs-stop.slidesjs-navigation').attr('id','stoptitle'); $('.slidesjs-play.slidesjs-navigation').attr('role','tab'); $('.slidesjs-stop.slidesjs-navigation').attr('role','tab'); $('.slidesjs-play.slidesjs-navigation').attr('aria-describedby','tip1'); $('.slidesjs-stop.slidesjs-navigation').attr('aria-describedby','tip2'); /* End: This code is added by iTalent as part of iTrack 1859082 */ }); $(document).ready(function() { if($("#slides .item").length < 2 ) { /* Fixing Single Slide click issue (commented following code)*/ // $(".item").css("left","0px"); $(".item.slidesjs-slide").attr('style', 'left:0px !important'); $(".slidesjs-stop.slidesjs-navigation").trigger('click'); $(".slidesjs-previous").css("display", "none"); $(".slidesjs-next").css("display", "none"); } var items_length = $(".item.slidesjs-slide").length; $(".slidesjs-pagination-item > button").attr("aria-setsize",items_length); $(".slidesjs-next, .slidesjs-pagination-item button").attr("tabindex","-1"); $(".slidesjs-pagination-item button").attr("role", "tab"); $(".slidesjs-previous").attr("tabindex","-1"); $(".slidesjs-next").attr("aria-hidden","true"); $(".slidesjs-previous").attr("aria-hidden","true"); $(".slidesjs-next").attr("aria-label","Next"); $(".slidesjs-previous").attr("aria-label","Previous"); //$(".slidesjs-stop.slidesjs-navigation").attr("role","button"); //$(".slidesjs-play.slidesjs-navigation").attr("role","button"); $(".slidesjs-pagination").attr("role","tablist").attr("aria-busy","true"); $("li.slidesjs-pagination-item").attr("role","list"); $(".item.slidesjs-slide").attr("tabindex","-1"); $(".item.slidesjs-slide").attr("aria-label","item"); /*$(".slidesjs-stop.slidesjs-navigation").on('click', function() { var itemNumber = parseInt($('.slidesjs-pagination-item > a.active').attr('data-slidesjs-item')); $($('.item.slidesjs-slide')[itemNumber]).find('.c-call-to-action').attr('tabindex', '0'); });*/ $(".slidesjs-stop.slidesjs-navigation, .slidesjs-pagination-item > button").on('click keydown', function() { $.each($('.item.slidesjs-slide'),function(i,el){ $(el).find('.c-call-to-action').attr('tabindex', '-1'); }); var itemNumber = parseInt($('.slidesjs-pagination-item > button.active').attr('data-slidesjs-item')); $($('.item.slidesjs-slide')[itemNumber]).find('.c-call-to-action').attr('tabindex', '0'); }); $(".slidesjs-play.slidesjs-navigation").on('click', function() { $.each($('.item.slidesjs-slide'),function(i,el){ $(el).find('.c-call-to-action').attr('tabindex', '-1'); }); }); $(".slidesjs-pagination-item button").keyup(function(e){ var keyCode = e.keyCode || e.which; if (keyCode == 9) { e.preventDefault(); $(".slidesjs-stop.slidesjs-navigation").trigger('click').blur(); $("button.active").focus(); } }); $(".slidesjs-play").on("click",function (event) { if (event.handleObj.type === "click") { $(".slidesjs-stop").focus(); } else if(event.handleObj.type === "keydown"){ if (event.which === 13 && $(event.target).hasClass("slidesjs-play")) { $(".slidesjs-stop").focus(); } } }); $(".slidesjs-stop").on("click",function (event) { if (event.handleObj.type === "click") { $(".slidesjs-play").focus(); } else if(event.handleObj.type === "keydown"){ if (event.which === 13 && $(event.target).hasClass("slidesjs-stop")) { $(".slidesjs-play").focus(); } } }); $(".slidesjs-pagination-item").keydown(function(e){ switch (e.which){ case 37: //left arrow key $(".slidesjs-previous.slidesjs-navigation").trigger('click'); e.preventDefault(); break; case 39: //right arrow key $(".slidesjs-next.slidesjs-navigation").trigger('click'); e.preventDefault(); break; default: return; } $(".slidesjs-pagination-item button.active").focus(); }); }); // Start This code is added by iTalent as part of iTrack 1859082 $(document).ready(function(){ $("#tip1").attr("aria-hidden","true").addClass("hidden"); $("#tip2").attr("aria-hidden","true").addClass("hidden"); $(".slidesjs-stop.slidesjs-navigation, .slidesjs-play.slidesjs-navigation").attr('title', ''); $("a#playtitle").focus(function(){ $("#tip1").attr("aria-hidden","false").removeClass("hidden"); }); $("a#playtitle").mouseover(function(){ $("#tip1").attr("aria-hidden","false").removeClass("hidden"); }); $("a#playtitle").blur(function(){ $("#tip1").attr("aria-hidden","true").addClass("hidden"); }); $("a#playtitle").mouseleave(function(){ $("#tip1").attr("aria-hidden","true").addClass("hidden"); }); $("a#play").keydown(function(ev){ if (ev.which ==27) { $("#tip1").attr("aria-hidden","true").addClass("hidden"); ev.preventDefault(); return false; } }); $("a#stoptitle").focus(function(){ $("#tip2").attr("aria-hidden","false").removeClass("hidden"); }); $("a#stoptitle").mouseover(function(){ $("#tip2").attr("aria-hidden","false").removeClass("hidden"); }); $("a#stoptitle").blur(function(){ $("#tip2").attr("aria-hidden","true").addClass("hidden"); }); $("a#stoptitle").mouseleave(function(){ $("#tip2").attr("aria-hidden","true").addClass("hidden"); }); $("a#stoptitle").keydown(function(ev){ if (ev.which ==27) { $("#tip2").attr("aria-hidden","true").addClass("hidden"); ev.preventDefault(); return false; } }); }); // End This code is added by iTalent as part of iTrack 1859082
Top Kudoed Authors