Embed Token - Generate Token

複数のレポート、データセット、およびターゲット ワークスペースの埋め込みトークンを生成します。

  • レポートとデータセットは関連付ける必要はありません。
  • 埋め込み中にレポートをデータセットにバインドできます。
  • レポートは、 パラメーターで targetWorkspaces 指定されたワークスペースでのみ作成できます。

重要

この API 呼び出しは、 顧客向けの埋め込み シナリオにのみ関連します。 この API の使用の詳細については、「 埋め込みトークンを生成するときの考慮事項」を参照してください。

アクセス許可

必要なスコープ

要件が適用されない場合を除き、次のすべて。

  • Content.Create。ターゲット ワークスペースが GenerateTokenRequestV2 で指定されている場合に必要です。
  • Report.ReadWrite.All または Report.Read.All。 GenerateTokenRequestV2 でレポートが指定されている場合は必須です。
  • Report.ReadWrite.All。GenerateTokenRequestV2 で少なくとも 1 つのレポートにフラグが指定されている場合allowEditに必要です。
  • Dataset.ReadWrite.All または Dataset.Read.All

制限事項

  • レポートは、 パラメーターで targetWorkspaces 指定されたワークスペースでのみ作成できます。
  • すべてのレポートとデータセットは 、V2 ワークスペースに存在する必要があります。
  • すべてのターゲット ワークスペースは V2 ワークスペースである必要があります。
  • 最大 50 個のレポート。
  • 最大 50 個のデータセット。
  • 最大 50 個のターゲット ワークスペース。
  • Azure Analysis Servicesまたは Analysis Services オンプレミスのライブ接続レポートの場合、行レベル セキュリティ (RLS) を使用した埋め込みトークンの生成が、再バインド後に数分間機能しない場合があります。

POST https://api.powerbi.com/v1.0/myorg/GenerateToken

要求本文

名前 説明
datasets

GenerateTokenRequestV2Dataset[]

データセットの一覧

datasourceIdentities

DatasourceIdentity[]

シングル Sign-On (SSO) が有効になっているデータ ソースに接続するときに使用する ID の一覧。

identities

EffectiveIdentity[]

行レベルのセキュリティ規則に使用する ID の一覧

lifetimeInMinutes

integer

トークンの最大有効期間 (生成時刻から始まる分単位)。 トークンの有効期限を短縮するために使用できますが、それを拡張することはできません。 この値は、正の整数にする必要があります。 0 (0) は と同じ nullであり、既定の有効期限が設定されます。

reports

GenerateTokenRequestV2Report[]

レポートの一覧

targetWorkspaces

GenerateTokenRequestV2TargetWorkspace[]

埋め込みトークンで保存できるワークスペースの一覧

応答

名前 説明
200 OK

EmbedToken

OK

Example of generating an embed token for a dataset and two reports example. Only one of the reports can be edited.
Example of generating an embed token for a paginated report which has a Power BI dataset as a datasource. The ID of the dataset must be specified in the request. The report and dataset can each have its own identity
Example of generating an embed token for a paginated report with a data source identity
Example of generating an embed token for a paginated report with multiple data source identities and a single identity blob
Example of generating an embed token for a paginated report with multiple data source identities and multiple identity blobs
Example of generating an embed token for a Power BI report with a dataset which is connected with DirectQuery to another Power BI dataset. All related dataset IDs must be specified in the request with 'xmlaPermissions' set to 'ReadOnly'. IdentityBlobs for all SSO-enabled data sources must be provided in the 'datasourceIdentities' array
Example of generating an embed token for a Power BI report with a paginated visual. The paginated report ID ('...4850') of the paginated visual must be included in the 'reports' section of the request.
Example of generating an embed token for two datasets with RLS identities and a single report with read-only permissions. The embed token lets you view the report, which is dynamically bound to two different datasets.
Example of generating an embed token that expires no later than ten minutes from the API call

Example of generating an embed token for a dataset and two reports example. Only one of the reports can be edited.

Sample Request

POST https://api.powerbi.com/v1.0/myorg/GenerateToken
{
  "datasets": [
    {
      "id": "cfafbeb1-8037-4d0c-896e-a46fb27ff229"
    }
  ],
  "reports": [
    {
      "allowEdit": true,
      "id": "b2e49b01-2356-4456-bfb9-3f4c2bc4ddbd"
    },
    {
      "id": "759908bb-ead8-4a43-9645-7ffbf921c68d"
    }
  ]
}

Sample Response

{
  "token": "H4sI....AAA=",
  "tokenId": "49ae3742-54c0-4c29-af52-619ff93b5c80",
  "expiration": "2018-07-29T17:58:19Z"
}

Example of generating an embed token for a paginated report which has a Power BI dataset as a datasource. The ID of the dataset must be specified in the request. The report and dataset can each have its own identity

Sample Request

POST https://api.powerbi.com/v1.0/myorg/GenerateToken
{
  "datasets": [
    {
      "id": "cfafbeb1-8037-4d0c-896e-a46fb27ff229",
      "xmlaPermissions": "ReadOnly"
    }
  ],
  "reports": [
    {
      "id": "b2e49b01-2356-4456-bfb9-3f4c2bc4ddbd"
    }
  ],
  "identities": [
    {
      "username": "john@contoso.com",
      "roles": [
        "sales"
      ],
      "datasets": [
        "cfafbeb1-8037-4d0c-896e-a46fb27ff229"
      ]
    },
    {
      "username": "john@contoso.com",
      "reports": [
        "b2e49b01-2356-4456-bfb9-3f4c2bc4ddbd"
      ]
    }
  ]
}

Sample Response

{
  "token": "H4sI....AAA=",
  "tokenId": "49ae3742-54c0-4c29-af52-619ff93b5c80",
  "expiration": "2028-07-29T17:58:19Z"
}

Example of generating an embed token for a paginated report with a data source identity

Sample Request

POST https://api.powerbi.com/v1.0/myorg/GenerateToken
{
  "reports": [
    {
      "id": "b2e49b01-2356-4456-bfb9-3f4c2bc4ddbd"
    }
  ],
  "datasourceIdentities": [
    {
      "datasources": [
        {
          "datasourceType": "Sql",
          "connectionDetails": {
            "server": "New-Sql-Server",
            "database": "New-Sql-Database"
          }
        }
      ],
      "identityBlob": "eyJ0eX....AAA="
    }
  ]
}

Sample Response

{
  "token": "H4sI....AAA=",
  "tokenId": "49ae3742-54c0-4c29-af52-619ff93b5c80",
  "expiration": "2028-07-29T17:58:19Z"
}

Example of generating an embed token for a paginated report with multiple data source identities and a single identity blob

Sample Request

POST https://api.powerbi.com/v1.0/myorg/GenerateToken
{
  "reports": [
    {
      "id": "b2e49b01-2356-4456-bfb9-3f4c2bc4ddbd"
    }
  ],
  "datasourceIdentities": [
    {
      "datasources": [
        {
          "datasourceType": "Sql",
          "connectionDetails": {
            "server": "New-Sql-Server",
            "database": "New-Sql-Database"
          }
        },
        {
          "datasourceType": "MySql",
          "connectionDetails": {
            "server": "New-MySql-Server",
            "database": "New-MySql-Database"
          }
        }
      ],
      "identityBlob": "eyJ0eX....AAA="
    }
  ]
}

Sample Response

{
  "token": "H4sI....AAA=",
  "tokenId": "49ae3742-54c0-4c29-af52-619ff93b5c80",
  "expiration": "2028-07-29T17:58:19Z"
}

Example of generating an embed token for a paginated report with multiple data source identities and multiple identity blobs

Sample Request

POST https://api.powerbi.com/v1.0/myorg/GenerateToken
{
  "reports": [
    {
      "id": "b2e49b01-2356-4456-bfb9-3f4c2bc4ddbd"
    }
  ],
  "datasourceIdentities": [
    {
      "datasources": [
        {
          "datasourceType": "Sql",
          "connectionDetails": {
            "server": "New-Sql-Server",
            "database": "New-Sql-Database"
          }
        }
      ],
      "identityBlob": "eyJ0eX....AAA="
    },
    {
      "datasources": [
        {
          "datasourceType": "MySql",
          "connectionDetails": {
            "server": "New-MySql-Server",
            "database": "New-MySql-Database"
          }
        }
      ],
      "identityBlob": "eyJ0dW....AAA="
    }
  ]
}

Sample Response

{
  "token": "H4sI....AAA=",
  "tokenId": "49ae3742-54c0-4c29-af52-619ff93b5c80",
  "expiration": "2028-07-29T17:58:19Z"
}

Sample Request

POST https://api.powerbi.com/v1.0/myorg/GenerateToken
{
  "datasets": [
    {
      "id": "b2e49b01-2356-4456-bfb9-3f4c2bc4ddbd",
      "xmlaPermissions": "ReadOnly"
    },
    {
      "id": "cfafbeb1-8037-4d0c-896e-a46fb27ff229",
      "xmlaPermissions": "ReadOnly"
    }
  ],
  "reports": [
    {
      "id": "f904e89a-7ebe-4aa0-8647-e409063b4850"
    }
  ],
  "datasourceIdentities": [
    {
      "datasources": [
        {
          "datasourceType": "Sql",
          "connectionDetails": {
            "server": "Best-Sql-Server",
            "database": "Database3"
          }
        }
      ],
      "identityBlob": "eyJ0eX....AAA="
    }
  ]
}

Sample Response

{
  "token": "H4sI....AAA=",
  "tokenId": "ab4d49ae-c054-4c29-af52-93b5c80619ff",
  "expiration": "2022-06-10T12:41:11Z"
}

Example of generating an embed token for a Power BI report with a paginated visual. The paginated report ID ('...4850') of the paginated visual must be included in the 'reports' section of the request.

Sample Request

POST https://api.powerbi.com/v1.0/myorg/GenerateToken
{
  "datasets": [
    {
      "id": "cfafbeb1-8037-4d0c-896e-a46fb27ff229"
    }
  ],
  "reports": [
    {
      "id": "b2e49b01-2356-4456-bfb9-3f4c2bc4ddbd"
    },
    {
      "id": "f904e89a-7ebe-4aa0-8647-e409063b4850"
    }
  ]
}

Sample Response

{
  "token": "H4sI....AAA=",
  "tokenId": "49ae3742-54c0-4c29-af52-619ff93b5c80",
  "expiration": "2018-07-29T17:58:19Z"
}

Example of generating an embed token for two datasets with RLS identities and a single report with read-only permissions. The embed token lets you view the report, which is dynamically bound to two different datasets.

Sample Request

POST https://api.powerbi.com/v1.0/myorg/GenerateToken
{
  "datasets": [
    {
      "id": "cfafbeb1-8037-4d0c-896e-a46fb27ff229"
    },
    {
      "id": "e75afc47-1150-45e0-aba7-4eb04e4876e5"
    }
  ],
  "reports": [
    {
      "id": "b2e49b01-2356-4456-bfb9-3f4c2bc4ddbd"
    }
  ],
  "identities": [
    {
      "username": "john@contoso.com",
      "roles": [
        "sales"
      ],
      "datasets": [
        "cfafbeb1-8037-4d0c-896e-a46fb27ff229"
      ]
    },
    {
      "username": "iris@contoso.com",
      "roles": [
        "executive"
      ],
      "datasets": [
        "e75afc47-1150-45e0-aba7-4eb04e4876e5"
      ]
    }
  ]
}

Sample Response

{
  "token": "H4sI....AAA=",
  "tokenId": "4b76f5ed-5a06-4150-8d1b-60f8e4c186f4",
  "expiration": "2028-07-29T17:58:19Z"
}

Example of generating an embed token that expires no later than ten minutes from the API call

Sample Request

POST https://api.powerbi.com/v1.0/myorg/GenerateToken
{
  "datasets": [
    {
      "id": "cfafbeb1-8037-4d0c-896e-a46fb27ff229"
    }
  ],
  "reports": [
    {
      "id": "b2e49b01-2356-4456-bfb9-3f4c2bc4ddbd"
    }
  ],
  "identities": [
    {
      "username": "john@contoso.com",
      "roles": [
        "sales"
      ],
      "datasets": [
        "cfafbeb1-8037-4d0c-896e-a46fb27ff229"
      ]
    }
  ],
  "lifetimeInMinutes": 10
}

Sample Response

{
  "token": "H4sI....AAA=",
  "tokenId": "4b76f5ed-5a06-4150-8d1b-60f8e4c186f4",
  "expiration": "2028-07-29T17:58:19Z"
}

定義

名前 説明
DatasourceConnectionDetails

Power BI データ ソース接続の詳細。 「 データソースを取得 する」または「 グループ内のデータソースを取得する」の例を参照してください。

DatasourceIdentity

シングル サインオン (SSO) が有効になっている DirectQuery データ ソースを接続するための有効な ID。

DatasourceSelector

接続の詳細によって 1 つのデータ ソースを一意に識別する オブジェクト。

EffectiveIdentity

ユーザー ID とロールを定義します。 詳細については、「Power BI Embeddedを使用した行レベルのセキュリティ」を参照してください。

EmbedToken

Power BI 埋め込みトークン

GenerateTokenRequestV2

Power BI のトークン要求の生成 V2

GenerateTokenRequestV2Dataset

GenerateTokenRequestV2 のデータセット オブジェクト

GenerateTokenRequestV2Report

GenerateTokenRequestV2 のレポート オブジェクト

GenerateTokenRequestV2TargetWorkspace

GenerateTokenRequestV2 のワークスペース オブジェクト

IdentityBlob

ID を指定するための BLOB。 Azure SQL への DirectQuery 接続を持つデータセットでのみサポートされます

XmlaPermissions

XMLA のアクセス許可

DatasourceConnectionDetails

Power BI データ ソース接続の詳細。 「 データソースを取得 する」または「 グループ内のデータソースを取得する」の例を参照してください。

名前 説明
account

string

接続アカウント

classInfo

string

接続クラス情報

database

string

接続データベース

domain

string

接続ドメイン

emailAddress

string

接続メール アドレス

kind

string

接続の種類

loginServer

string

接続ログイン サーバー

path

string

接続パス

server

string

接続サーバー

url

string

接続 URL

DatasourceIdentity

シングル サインオン (SSO) が有効になっている DirectQuery データ ソースを接続するための有効な ID。

名前 説明
datasources

DatasourceSelector[]

この ID が適用されるデータ ソースの配列。

identityBlob

string

ID を指定するための BLOB。

DatasourceSelector

接続の詳細によって 1 つのデータ ソースを一意に識別する オブジェクト。

名前 説明
connectionDetails

DatasourceConnectionDetails

データ ソース接続の詳細。 接続の詳細は、 ページ分割されたレポートのデータソースの取得powerbi レポート API のデータソースの取得 を使用して取得できます。

datasourceType

string

データ ソースの型。

データ ソースの API 名
ActiveDirectory AdobeAnalytics AdoDotNet
AnalysisServices AzureBlobs AzureDataLakeStorage
AzureMarketplace AzureTables BizTalk
CDPA CustomConnector CustomHttpApi
DB2 Essbase EventHub
Excel Exchange 拡張機能
Facebook ファイル Folder
GoogleAnalytics Hdfs HDInsight
Informix MQ MySQL
OData ODBC OleDb
Oracle PostgreSQL PowerQueryMashup
PubNub Salesforce SAPBW
SAPBWMessageServer SapErp SAPHana
SharePoint SharePointDocLib SharePointList
Sql Sybase Teradata
UIFlow Web

EffectiveIdentity

ユーザー ID とロールを定義します。 詳細については、「Power BI Embeddedを使用した行レベルのセキュリティ」を参照してください。

名前 説明
auditableContext

string

EffectiveIdentity 監査可能なコンテキスト。 このパラメーターが指定され、空でない場合は、EffectiveIdentity の監査が有効になり、その値は監査レコードのユーザー名に設定されます。 それ以外の場合、GenerateToken 監査レコードから EffectiveIdentity コンテキストが省略されます。

customData

string

行レベルのセキュリティ規則を適用するために使用されるカスタム データ。 Azure Analysis Services モデルとクラウド モデルへのライブ接続でのみサポートされます。

datasets

string[]

この ID が適用されるデータセットの配列

identityBlob

IdentityBlob

ID を指定する BLOB。 Azure SQLへの DirectQuery 接続を持つデータセットでのみサポートされます。

reports

string[]

この ID が適用されるレポートの配列。 ページ分割されたレポートでのみサポートされます。

roles

string[]

RLS ルールを適用するトークン内の行レベル セキュリティ (RLS) ロールの配列。 ID には、最大 50 個のロールを含めることができます。 ロールには を除く ,任意の文字を含めることができます。また、その長さは 50 文字を超えてはなりません。

username

string

行レベルのセキュリティ規則を適用するトークン内の有効なユーザー名。 オンプレミス モデルの場合、ユーザー名には英数字、または次の文字 .、、 #-!@_^~\\のいずれかを含めることができます。 クラウド モデルの場合、ユーザー名には任意の ASCII 文字を含めることができます。 どちらのモデルでも、ユーザー名の長さは 256 文字を超えてはなりません。また、ユーザー名にはスペースを含めることはできません。

EmbedToken

Power BI 埋め込みトークン

名前 説明
expiration

string

トークンの有効期限の日付と時刻 (UTC)

token

string

埋め込みトークン

tokenId

string

一意のトークン ID。 監査ログを使用すると、トークン ID を使用して、トークンを使用する操作を生成操作と関連付けることができます。

GenerateTokenRequestV2

Power BI のトークン要求の生成 V2

名前 説明
datasets

GenerateTokenRequestV2Dataset[]

データセットの一覧

datasourceIdentities

DatasourceIdentity[]

シングル Sign-On (SSO) が有効になっているデータ ソースに接続するときに使用する ID の一覧。

identities

EffectiveIdentity[]

行レベルのセキュリティ規則に使用する ID の一覧

lifetimeInMinutes

integer

トークンの最大有効期間 (生成時刻から始まる分単位)。 トークンの有効期限を短縮するために使用できますが、それを拡張することはできません。 この値は、正の整数にする必要があります。 0 (0) は と同じ nullであり、既定の有効期限が設定されます。

reports

GenerateTokenRequestV2Report[]

レポートの一覧

targetWorkspaces

GenerateTokenRequestV2TargetWorkspace[]

埋め込みトークンで保存できるワークスペースの一覧

GenerateTokenRequestV2Dataset

GenerateTokenRequestV2 のデータセット オブジェクト

名前 説明
id

string

データセット ID

xmlaPermissions

XmlaPermissions

XMLA のアクセス許可

GenerateTokenRequestV2Report

GenerateTokenRequestV2 のレポート オブジェクト

名前 説明
allowEdit

boolean

生成された埋め込みトークンがレポート編集をサポートするかどうか

id

string

レポート ID

GenerateTokenRequestV2TargetWorkspace

GenerateTokenRequestV2 のワークスペース オブジェクト

名前 説明
id

string

ワークスペース ID

IdentityBlob

ID を指定するための BLOB。 Azure SQL への DirectQuery 接続を持つデータセットでのみサポートされます

名前 説明
value

string

Azure SQLの OAuth 2.0 アクセス トークン

XmlaPermissions

XMLA のアクセス許可

名前 説明
Off

string

生成された埋め込みトークンが、データセットの XMLA エンドポイントへのアクセス許可を付与しないことを示します。

ReadOnly

string

生成された埋め込みトークンが、データセットの XMLA エンドポイントに対する読み取りアクセス許可を付与することを示します。