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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
bidgeir
Most Valuable Professional
Most Valuable Professional

Get Datasource from Group - help parsing the JSON in PowerShell

Hi all

 

When quering Get Datasource from Group in PowerShell the response is nested JSON. I´m not very good with PowerShell so I´m having problems picking out the values that I need. What I´m after is the url and the datasourceType. Below is a sample response. If I try to convert it to csv it will create two columns @odata.context and value which does not traverse all the depths of the JSON. I don´t know how to pick out the relevant values. I have tried $MyVariable[0].[value][0].... but it says the array is empty. 

 

What I´m ultimetly trying to do is to grab the url for SharePoint sources, replace parts of the string and update it via the update datasource endpoint

 

Hope someone can help.

 

{
"@odata.context":"http://wabi-europe-north-b-redirect.analysis.windows.net/v1.0/myorg/groups/WORKSPACEID/$metadata#dat...":[
{
"datasourceType":"SharePointList","connectionDetails":{
"url":"https://COMPANY.sharepoint.com/"
},"datasourceId":"DATASOURCEID","gatewayId":"GATEWAYID"
}
]
}

1 REPLY 1
lbendlin
Super User
Super User

How is this related to Power BI?

 

Also, have you tried to do this in Power Query?  It guides you through the JSON structure and allows you to pick the fields you need .

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.