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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
kpia
Helper I
Helper I

Dynamic Binding for Direct Query

I am working on a project to embed a report into our website. I have one dataset per customer and I want to dynmaically bind the report to the dataset at the time of embed. 

 

My report has a dataset associated with it and this dataset connects to one of the customers' datasets via direct query. I am trying to generate the embed token using Powershell with the method described here.

 

$bodyUser = [PSCustomObject]@{
    datasets = @(
        [PSCustomObject]@{
            id = "xxxxxxxx-report-dataset"
            xmlaPermissions = "ReadOnly"
        },
        [PSCustomObject]@{
            id = "xxxxxxxx-custer-dataset1"
            xmlaPermissions = "ReadOnly"
        },
        [PSCustomObject]@{
            id = "xxxxxxxx-custer-dataset2"
            xmlaPermissions = "ReadOnly"
        }
    )
    reports = @(
        [PSCustomObject]@{
            id = "xxxxxxxx-reportID"
        }
    )
    datasourceIdentities = @(
        [PSCustomObject]@{
            datasources = @(
                [PSCustomObject]@{
                    datasourceSelector = [PSCustomObject]@{
                        datasourceType = "ODBC"
                    }
                    connectionDetails = [PSCustomObject]@{
                        connectionString = "dsn=akpidatalake"
                        datasourceId = "xxxxxxxxxxx"
                        gatewayId = "xxxxxxxxxxx"
                    }
                },
                [PSCustomObject]@{
                    datasourceType = "AnalysisServices"
                    connectionDetails = [PSCustomObject]@{
                        server = "powerbi://api.powerbi.com/v1.0/myorg/embedded_poc"
                        database = "embedded dataset kap"
                    }
                    datasourceId = "xxxxxxxxxxx"
                    gatewayId = "xxxxxxxxxxx"
                }
            )
        }
    )
}

$jsonBody = $bodyUser | ConvertTo-Json -Depth 10

 

I am getthing this error: 

 

 Encountered errors when invoking the command: {   "code": "InvalidRequest",   "message": "Datasource identity must contain identity blob" }

 

Where do I get the indentity blob?

3 REPLIES 3
AmosHersch
Microsoft Employee
Microsoft Employee

Hi @kpia ,

 

If you don't have any external data source with SSO then just don't send the datasourceIdentities in your request. It's only required when you do have SSO.

AmosHersch
Microsoft Employee
Microsoft Employee

datasourceIdentities array is only required if you have external data sources (SQL/...) with SSO enabled. In such case this array is for providing access tokens (identity blobs) for those data sources. Since those are your data sources you should know how to create access tokens for them (not through Power BI).

If you don't have such data sources then you should not provide the datasourceIdentities array at all.

Thank you @AmosHersch for your response. It strange because we aren't using SSO so I'm not sure why it is giving this error message. 

 

We are using ODBC to connecto to AWS Athen with standard credentials via a gateway. Shouldn't the gateway handle all the credentials? 

 

 

kpia_0-1685568691955.png

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.