Forum Discussion
Power BI Admin API - Get Datasets
- 5 years ago
Hi ginoroy ,
How did you connect to the Rest API, PowerShell or web connector?
Please show your M code in 'Edit Query' or the shell code.
Please refer to the code.
Connect-PowerBIServiceAccount $Workspace = Get-PowerBIWorkspace -All ForEach($Workspace in $Workspace) { $Url = 'https://api.powerbi.com/v1.0/myorg/groups/'+ $Workspace.Id + '/datasets' Invoke-PowerBIRestMethod -Url $Url -Method Get } Disconnect-PowerBIServiceAccountBest regards,
Lionel ChenIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi ginoroy ,
How did you connect to the Rest API, PowerShell or web connector?
Please show your M code in 'Edit Query' or the shell code.
Please refer to the code.
Connect-PowerBIServiceAccount
$Workspace = Get-PowerBIWorkspace -All
ForEach($Workspace in $Workspace)
{
$Url = 'https://api.powerbi.com/v1.0/myorg/groups/'+ $Workspace.Id + '/datasets'
Invoke-PowerBIRestMethod -Url $Url -Method Get
}
Disconnect-PowerBIServiceAccount
Best regards,
Lionel Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi v-lionel-msft ,
I am also trying to achieve the same automation, however, this requires a user interaction to login. MFA is enabled for our tenant. and service principal with client id and client secret are unable to return Admin API. Is there a way around this? To be able to automate the process? Many Thanks