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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
TravisKale
Helper I
Helper I

PowerShell ConvertFrom-Json Does not Create All Properties of API Result

I am issuing the following via PowerShell

 

 

$apiResult = Invoke-PowerBIRestMethod -Url 'https://api.powerbi.com/v1.0/myorg/admin/groups?$expand=dashboards,users,reports,datasets,dataflows,workbooks&$top=5000' -Method Get | ConvertFrom-Json

 

 

The call works and everything is returned, however, on the Group object there is only a boolean "IsOnDedicatedCapcity" field, and not a CapacityId. 

 

If I exclude the | ConvertFrom-Json, and look at the Raw JSON, the property is there.   I'm guessing since the first object returned does not have a CapacityId, when PowerShell tries to create an ojbect to store the result that the CapcityId property is excluded. 

 

To test this theory I changed the API call to use a filter to only return groups on a capacity via...

 

 

'https://api.powerbi.com/v1.0/myorg/admin/groups?$filter=isOnDedicatedCapacity eq true & $expand=dashboards,users,reports,datasets,dataflows,workbooks&$top=10'

 

 

Now, when I issue the ConvertFrom-Json, the CapacityId property is present on the object PowerShell creates for me. 

 

This is probably more of a PowerShell question at this point but is there a way to force the ConvertFrom-Json method to include all properties in the object array even if the first element property is not present?

2 REPLIES 2
lbendlin
Super User
Super User

wonder what happens when you don't expand the related entities?

Calls which did not expand the related entities had the same result.  I did further testing and modified the original post with updated info.  Is more a powershell issue then a Power BI API issue.   I guess this is why the cmdlets exist, I am going to turn back to the PS cmdlets as the issue I was having with them is easier to workaround than this issue.  Thanks for taking a look @lbendlin 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 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.