Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

Is it possible to get linage for all data sets via API?

Hi, 

I'd like to understand which data sources are being used by data sets. 
Technically I'd like to check the linage for all datasets within the organization. Do you know if it's possible? 

 

e.g. 
I'd like to get info that flows_report is being connected to the SQL server azu....




 

 

  • Hi Anonymous 

    Yes it is possible, You have to bi Power BI Admin and to use Powershell to excute this script

     

    Get-PowerBIDataset -Scope Organization |
    Foreach {
    $dsID = $_.Id;
    $dsName = $_.Name;
    Get-PowerBIDatasource -DatasetId $dsID -Scope Organization |
    Foreach {
    [PSCustoMObject]@{

    'WSID' = $wsId;
    'WSName' = $wsName;
    'DSID' = $dsID;
    'DSName' = $dsName;
    'SrcId' = $_.DatasourceId;
    'SrcName' = $_.Name;
    'DatasourceType' = $_.DatasourceType;
    'ConnectionString' = $_.ConnectionString;
    'ConnectionDetails.server' = $_.ConnectionDetails.server;
    'ConnectionDetails.database' = $_.ConnectionDetails.database;
    'ConnectionDetails.Url' = $_.ConnectionDetails.Url;
    'GatewayId' = $_.GatewayId

    }
    }
    }| ConvertTo-Json | Out-File -FilePath "D:\Logs\Inventaire\Datasources\PowerBI_Datasources_$(Get-Date -Format yyyyMMdd).json" -Encoding utf8 -Force

    Good luck

1 Reply

  • aj1973's avatar
    aj1973
    Icon for Community Champion rankCommunity Champion

    Hi Anonymous 

    Yes it is possible, You have to bi Power BI Admin and to use Powershell to excute this script

     

    Get-PowerBIDataset -Scope Organization |
    Foreach {
    $dsID = $_.Id;
    $dsName = $_.Name;
    Get-PowerBIDatasource -DatasetId $dsID -Scope Organization |
    Foreach {
    [PSCustoMObject]@{

    'WSID' = $wsId;
    'WSName' = $wsName;
    'DSID' = $dsID;
    'DSName' = $dsName;
    'SrcId' = $_.DatasourceId;
    'SrcName' = $_.Name;
    'DatasourceType' = $_.DatasourceType;
    'ConnectionString' = $_.ConnectionString;
    'ConnectionDetails.server' = $_.ConnectionDetails.server;
    'ConnectionDetails.database' = $_.ConnectionDetails.database;
    'ConnectionDetails.Url' = $_.ConnectionDetails.Url;
    'GatewayId' = $_.GatewayId

    }
    }
    }| ConvertTo-Json | Out-File -FilePath "D:\Logs\Inventaire\Datasources\PowerBI_Datasources_$(Get-Date -Format yyyyMMdd).json" -Encoding utf8 -Force

    Good luck