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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

PowerBI REST GroupID and dataset name

Hi All,

 

I am looking to find out all dataset names that are run in multiple workspaces. 

I have 100 workspaces on dedicated capacity and I need to know all workspaces and all datasets that are using it.

I am working in PowerShell.

 

I know that workspace Name is same as Office365 group so I am able to add my admin account to all workspaces if neede.

 

What I have up untill now is:

 

Import-Module azurerm
$clientId = "my-client-id"
 
function GetAuthToken
{
    $adal = "${env:ProgramFiles}\WindowsPowerShell\Modules\AzureRM.profile\5.3.4\Microsoft.IdentityModel.Clients.ActiveDirectory.dll"
    
    $adalforms = "${env:ProgramFiles}\WindowsPowerShell\Modules\AzureRM.profile\5.3.4\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll"
 
    [System.Reflection.Assembly]::LoadFrom($adal) | Out-Null

    [System.Reflection.Assembly]::LoadFrom($adalforms) | Out-Null

    $redirectUri = "urn:ietf:wg:oauth:2.0:oob"

    $resourceAppIdURI = "https://analysis.windows.net/powerbi/api"

    $authority = "https://login.microsoftonline.com/common/oauth2/authorize";

    $authContext = New-Object "Microsoft.IdentityModel.Clients.ActiveDirectory.AuthenticationContext" -ArgumentList $authority
    
    $authResult = $authContext.AcquireToken($resourceAppIdURI, $clientID, $redirectUri, "Auto")

    return $authResult
}

function get_groups_path($group_id) {
    if ($group_id -eq "me") {
        return "myorg"
    } else {
        return "myorg/groups/$group_ID"
    }
}

$token = GetAuthToken

$auth_header = @{
   'Content-Type'='application/json'
   'Authorization'=$token.CreateAuthorizationHeader()
}

and it works for below 

 

$uri = "https://api.powerbi.com/v1.0/myorg/groups/"
$all_groups = (Invoke-RestMethod -Uri $uri –Headers $auth_header –Method GET).value

This gives me all workspaces that I have access to and thats OK I am happy so far.

 

What I cant get over is how to get dataset name in each workspace that I have access to.

Each command I run is comming up with Forbidden access or Not Found.

Anyone hav any idea how to show dataset in workspace other then my?

 

 

1 ACCEPTED SOLUTION
v-jiascu-msft
Employee
Employee

Hi @Anonymous,

 

If you'd like to continue with PowerShell, please try this get-powerbidataset. You can just type commands in the PowerShell. Another approach is the rest api getdatasetsingroup that can work with Invoke-RestMethod.

Power_BI_REST_Group_ID_and_dataset_name

 

 

Best Regards,

Dale

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
v-jiascu-msft
Employee
Employee

Hi @Anonymous,

 

If you'd like to continue with PowerShell, please try this get-powerbidataset. You can just type commands in the PowerShell. Another approach is the rest api getdatasetsingroup that can work with Invoke-RestMethod.

Power_BI_REST_Group_ID_and_dataset_name

 

 

Best Regards,

Dale

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Kudoed Authors