Embed Token - Generate Token
複数のレポート、データセット、およびターゲット ワークスペースの埋め込みトークンを生成します。
- レポートとデータセットを関連付ける必要はありません。
- 埋め込み中にレポートをデータセットにバインドできます。
-
targetWorkspaces
パラメーターで指定されたワークスペースでのみレポートを作成できます。
権限
- 認証にサービス プリンシパルを使用する場合は、「サービス プリンシパルの を使用して Power BI コンテンツを埋め込む」と の考慮事項と制限事項を参照してください。
- ページ分割されたビジュアルを含む Power BI レポートの場合は、API 呼び出しにページ分割されたレポート ID を含めます。 詳細については、例を参照してください。
- この API 呼び出しは、サービス プリンシパル プロファイルによって呼び出すことができます。 詳細については、「Power BI Embeddedでのサービス プリンシパル プロファイルの
」を参照してください。
必要なスコープ
要件が適用されない場合を除き、次のすべてを行います。
- 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 |
データセットの一覧 |
|
datasourceIdentities |
シングル Sign-On (SSO) が有効になっているデータ ソースに接続するときに使用する ID の一覧。 |
|
identities |
行レベルのセキュリティ規則に使用する ID の一覧 |
|
lifetimeInMinutes |
integer |
トークンの最大有効期間 (生成時刻から開始) (分単位)。 トークンの有効期限を短縮するために使用できますが、それを拡張することはできません。 値は正の整数である必要があります。 0 ( |
reports |
レポートの一覧 |
|
targetWorkspaces |
埋め込みトークンで保存できるワークスペースの一覧 |
応答
名前 | 型 | 説明 |
---|---|---|
200 OK |
わかりました |
例
Example of generating an embed token for a dataset and two reports example. Only one of the reports can be edited.
要求のサンプル
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"
}
]
}
応答のサンプル
{
"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
要求のサンプル
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"
]
}
]
}
応答のサンプル
{
"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
要求のサンプル
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="
}
]
}
応答のサンプル
{
"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
要求のサンプル
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="
}
]
}
応答のサンプル
{
"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
要求のサンプル
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="
}
]
}
応答のサンプル
{
"token": "H4sI....AAA=",
"tokenId": "49ae3742-54c0-4c29-af52-619ff93b5c80",
"expiration": "2028-07-29T17:58:19Z"
}
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
要求のサンプル
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="
}
]
}
応答のサンプル
{
"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.
要求のサンプル
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"
}
]
}
応答のサンプル
{
"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.
要求のサンプル
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"
]
}
]
}
応答のサンプル
{
"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
要求のサンプル
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
}
応答のサンプル
{
"token": "H4sI....AAA=",
"tokenId": "4b76f5ed-5a06-4150-8d1b-60f8e4c186f4",
"expiration": "2028-07-29T17:58:19Z"
}
定義
名前 | 説明 |
---|---|
Datasource |
Power BI データ ソース接続の詳細。 「 |
Datasource |
シングル サインオン (SSO) が有効になっている DirectQuery データ ソースを接続するための有効な ID。 |
Datasource |
接続の詳細によって 1 つのデータ ソースを一意に識別するオブジェクト。 |
Effective |
ユーザー ID とロールを定義します。 詳細については、「Power BI Embeddedを使用した行レベルのセキュリティ」を参照してください。 |
Embed |
Power BI 埋め込みトークン |
Generate |
Power BI のトークン生成要求 V2 |
Generate |
GenerateTokenRequestV2 内のデータセット オブジェクト |
Generate |
GenerateTokenRequestV2 のレポート オブジェクト |
Generate |
GenerateTokenRequestV2 内のワークスペース オブジェクト |
Identity |
ID を指定するための BLOB。 Azure SQL への DirectQuery 接続を持つデータセットでのみサポートされます |
Xmla |
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 |
この ID が適用されるデータ ソースの配列。 |
|
identityBlob |
string |
ID を指定するための BLOB。 |
DatasourceSelector
接続の詳細によって 1 つのデータ ソースを一意に識別するオブジェクト。
名前 | 型 | 説明 | |||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
connectionDetails |
データ ソース接続の詳細。 ページ分割されたレポートのデータソースの取得 を使用して接続の詳細を取得し、powerbi レポート API のデータソースを取得 できます。 |
||||||||||||||||||||||||||||||||||||||||||||||||||||
datasourceType |
string |
データ ソースの型。
|
EffectiveIdentity
ユーザー ID とロールを定義します。 詳細については、「Power BI Embeddedを使用した行レベルのセキュリティ」を参照してください。
名前 | 型 | 説明 |
---|---|---|
auditableContext |
string |
EffectiveIdentity 監査可能なコンテキスト。 このパラメーターが指定され、空でない場合は、EffectiveIdentity の監査が有効になり、その値は監査レコードのユーザー名に設定されます。 それ以外の場合、EffectiveIdentity コンテキストは GenerateToken 監査レコードから省略されます。 |
customData |
string |
行レベルのセキュリティ規則の適用に使用されるカスタム データ。 Azure Analysis Services モデルとクラウド モデルへのライブ接続でのみサポートされます。 |
datasets |
string[] |
この ID が適用されるデータセットの配列 |
identityBlob |
IDを指定する BLOB。 Azure SQL への DirectQuery 接続を持つデータセットでのみサポートされます。 |
|
reports |
string[] |
この ID が適用されるレポートの配列。 ページ分割されたレポートでのみサポートされます。 |
roles |
string[] |
RLS ルールを適用するトークン内の行レベル セキュリティ (RLS) ロールの配列。 ID には、最大 50 個のロールを含めることができます。 ロールには、 |
username |
string |
行レベルのセキュリティ規則を適用するトークン内の有効なユーザー名。 オンプレミス モデルの場合、ユーザー名には、英数字、または次のいずれかの文字 |
EmbedToken
Power BI 埋め込みトークン
名前 | 型 | 説明 |
---|---|---|
expiration |
string (date-time) |
トークンの有効期限の日付と時刻 (UTC) |
token |
string |
埋め込みトークン |
tokenId |
string (uuid) |
一意のトークン ID。 監査ログを使用すると、トークン ID を使用して、トークンを使用する操作を生成操作と関連付けることができます。 |
GenerateTokenRequestV2
Power BI のトークン生成要求 V2
名前 | 型 | 説明 |
---|---|---|
datasets |
データセットの一覧 |
|
datasourceIdentities |
シングル Sign-On (SSO) が有効になっているデータ ソースに接続するときに使用する ID の一覧。 |
|
identities |
行レベルのセキュリティ規則に使用する ID の一覧 |
|
lifetimeInMinutes |
integer |
トークンの最大有効期間 (生成時刻から開始) (分単位)。 トークンの有効期限を短縮するために使用できますが、それを拡張することはできません。 値は正の整数である必要があります。 0 ( |
reports |
レポートの一覧 |
|
targetWorkspaces |
埋め込みトークンで保存できるワークスペースの一覧 |
GenerateTokenRequestV2Dataset
GenerateTokenRequestV2 内のデータセット オブジェクト
名前 | 型 | 説明 |
---|---|---|
id |
string |
データセット ID |
xmlaPermissions |
XMLA のアクセス許可 |
GenerateTokenRequestV2Report
GenerateTokenRequestV2 のレポート オブジェクト
名前 | 型 | 説明 |
---|---|---|
allowEdit |
boolean |
生成された埋め込みトークンがレポートの編集をサポートしているかどうか |
id |
string (uuid) |
レポート ID |
GenerateTokenRequestV2TargetWorkspace
GenerateTokenRequestV2 内のワークスペース オブジェクト
名前 | 型 | 説明 |
---|---|---|
id |
string (uuid) |
ワークスペース ID |
IdentityBlob
ID を指定するための BLOB。 Azure SQL への DirectQuery 接続を持つデータセットでのみサポートされます
名前 | 型 | 説明 |
---|---|---|
value |
string |
Azure SQL の OAuth 2.0 アクセス トークン |
XmlaPermissions
XMLA のアクセス許可
値 | 説明 |
---|---|
Off |
生成された埋め込みトークンが、データセットの XMLA エンドポイントへのアクセス許可を付与しないことを示します。 |
ReadOnly |
生成された埋め込みトークンが、データセットの XMLA エンドポイントに対する読み取りアクセス許可を付与することを示します。 |