<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic PowerBI REST GroupID and dataset name in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/PowerBI-REST-GroupID-and-dataset-name/m-p/481555#M14799</link>
    <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am looking to find out all dataset names that are run in multiple workspaces.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have 100 workspaces on dedicated capacity and I need to know all workspaces and all datasets that are using it.&lt;/P&gt;&lt;P&gt;I am working in PowerShell.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I know that workspace Name is same as Office365 group so I am able to add my admin account to all workspaces if neede.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I have up untill now is:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;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()
}

&lt;/PRE&gt;&lt;P&gt;and it works for below&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;$uri = "https://api.powerbi.com/v1.0/myorg/groups/"
$all_groups = (Invoke-RestMethod -Uri $uri –Headers $auth_header –Method GET).value&lt;/PRE&gt;&lt;P&gt;This gives me all workspaces that I have access to and thats OK I am happy so far.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I cant get over is how to get dataset name in each workspace that I have access to.&lt;/P&gt;&lt;P&gt;Each command I run is comming up with Forbidden access or Not Found.&lt;/P&gt;&lt;P&gt;Anyone hav any idea how to show dataset in workspace other then my?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 06 Aug 2018 15:14:55 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2018-08-06T15:14:55Z</dc:date>
    <item>
      <title>PowerBI REST GroupID and dataset name</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/PowerBI-REST-GroupID-and-dataset-name/m-p/481555#M14799</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am looking to find out all dataset names that are run in multiple workspaces.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have 100 workspaces on dedicated capacity and I need to know all workspaces and all datasets that are using it.&lt;/P&gt;&lt;P&gt;I am working in PowerShell.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I know that workspace Name is same as Office365 group so I am able to add my admin account to all workspaces if neede.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I have up untill now is:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;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()
}

&lt;/PRE&gt;&lt;P&gt;and it works for below&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;$uri = "https://api.powerbi.com/v1.0/myorg/groups/"
$all_groups = (Invoke-RestMethod -Uri $uri –Headers $auth_header –Method GET).value&lt;/PRE&gt;&lt;P&gt;This gives me all workspaces that I have access to and thats OK I am happy so far.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I cant get over is how to get dataset name in each workspace that I have access to.&lt;/P&gt;&lt;P&gt;Each command I run is comming up with Forbidden access or Not Found.&lt;/P&gt;&lt;P&gt;Anyone hav any idea how to show dataset in workspace other then my?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 06 Aug 2018 15:14:55 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/PowerBI-REST-GroupID-and-dataset-name/m-p/481555#M14799</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-08-06T15:14:55Z</dc:date>
    </item>
    <item>
      <title>Re: PowerBI REST GroupID and dataset name</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/PowerBI-REST-GroupID-and-dataset-name/m-p/482275#M14800</link>
      <description>&lt;P&gt;Hi&amp;nbsp;@Anonymous&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you'd like to continue with PowerShell, please try this&amp;nbsp;&lt;A href="https://docs.microsoft.com/en-us/powershell/module/microsoftpowerbimgmt.data/get-powerbidataset?view=powerbi-ps" target="_self"&gt;get-powerbidataset&lt;/A&gt;. You can just type commands in the PowerShell. Another approach is&amp;nbsp;&lt;A href="https://docs.microsoft.com/en-us/rest/api/power-bi/datasets/getdatasetsingroup" target="_self"&gt;the rest api getdatasetsingroup&amp;nbsp;&lt;/A&gt;that can work with&amp;nbsp;Invoke-RestMethod.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://ibb.co/f2oQMK" target="_blank"&gt;&lt;IMG src="https://ip1.i.lithium.com/39c6e1f4a7a35b301233d4dbbdc8ab4f3b7e5bd2/68747470733a2f2f696d6167652e6962622e636f2f64794d3176652f506f7765725f42495f524553545f47726f75705f49445f616e645f646174617365745f6e616d652e706e67" border="0" alt="Power_BI_REST_Group_ID_and_dataset_name" /&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: 'Segoe UI'; font-size: 10.5pt; color: #333333;"&gt;Best Regards,&lt;/P&gt;
&lt;P style="margin: 0in; font-family: 'Segoe UI'; font-size: 10.5pt; color: #333333;"&gt;Dale&lt;/P&gt;</description>
      <pubDate>Tue, 07 Aug 2018 07:56:59 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/PowerBI-REST-GroupID-and-dataset-name/m-p/482275#M14800</guid>
      <dc:creator>v-jiascu-msft</dc:creator>
      <dc:date>2018-08-07T07:56:59Z</dc:date>
    </item>
  </channel>
</rss>

