I've been working on a way to retrieve our PowerBI data, and managed to get exactly all the data I'd need to process, however I can't seem to figure out on how to actually parse the data to a proper CSV.
I use the invoke command to get user access to a certain dataset with the below command in PowerShell
Invoke-PowerBIRestMethod -Url 'https://api.powerbi.com/v1.0/myorg/admin/datasets/DATASETID/users' -Method Get
This then comes back with the below response:
{
"@odata.context":"http://wabi-north-europe-j-primary-redirect.analysis.windows.net/v1.0/myorg/admin/$metadata#Collection(Microsoft.PowerBI.ServiceContracts.Api.
Access.DatasetUser)","value":[
{
"datasetUserAccessRight":"ReadWriteReshareExplore","emailAddress":"hiddenemail","displayName":"hiddenname","identifier":"hiddenidentifier","graphId":"hiddengraphid","principalType":"User","userType":"Member"
},{
"datasetUserAccessRight":"Read","emailAddress":"hiddenemail","displayName":"hiddenname","identifi
er":"hiddenidentifier","graphId":"hiddengraphid","principalType":"Group"
}
]
}
As shown above it came back with 2 entries of permissions on that dataset, one being a user and the other a group.
I want to parse/export this to a simple CSV file containing the below information:
- User rights
- Email address
- Displayname
- Identifier
- Principal Type
How would one achieve this? I've tried several ConvertFrom utilities in PowerShell, but those doesn't seem to work correctly. Is there any easy way to get this to export correctly?
Thank you in advance for any suggestions/advice!