Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
Hi Power BI Community,
We’re working on embedding a Power BI report into a third-party web app using the App Owns Data model. This report is built on a DirectLake semantic model connected to a Fabric Lakehouse.
Initially, we encountered issues and thought embedding wasn’t supported for DirectLake reports. However, based on recent Microsoft documentation, we now understand that embedding is possible using a V2 embed token.
🔗 Confirming official support:
Now that we know it's supported with V2 embed tokens, we need help with the complete embedding workflow, specifically for DirectLake datasets.
Could you please help us understand:
Any guidance, code samples, or documentation references would be greatly appreciated!
Solved! Go to Solution.
Hi @manvishah17 ,
Thanks for reaching out to the Microsoft fabric community forum.
Please follow below steps for Embedding with V2 Embed Token (App Owns Data Model)
Step 1: Authenticate with Azure AD
Use a service principal (recommended) or a master user account to authenticate with Azure AD and obtain an access token.
# Example using Python with MSAL
from msal import ConfidentialClientApplication
client_id = 'your-client-id'
client_secret = 'your-client-secret'
tenant_id = 'your-tenant-id'
authority_url = f"https://login.microsoftonline.com/{tenant_id}"
scopes = ["https://analysis.windows.net/powerbi/api/.default"]
app = ConfidentialClientApplication(
client_id, authority=authority_url, client_credential=client_secret
)
token_response = app.acquire_token_for_client(scopes=scopes)
access_token = token_response.get("access_token")
Step 2: Get Report and Dataset IDs
Use Power BI REST API to get the report and dataset IDs in the workspace where the report is published:
GET https://api.powerbi.com/v1.0/myorg/groups/{workspaceId}/reports
Authorization: Bearer {access_token}
Step 3: Generate a V2 Embed Token
Use the Power BI REST API’s GenerateToken endpoint. For DirectLake, ensure you are using the V2 token schema:
POST https://api.powerbi.com/v1.0/myorg/GenerateToken
Authorization: Bearer {access_token}
Content-Type: application/json
{
"datasets": [
{
"id": "your-dataset-id"
}
],
"reports": [
{
"id": "your-report-id"
}
],
"targetWorkspaces": [
{
"id": "your-workspace-id"
}
],
"accessLevel": "View",
"identities": [
{
"username": "user@yourdomain.com",
"roles": ["Viewer"],
"datasets": ["your-dataset-id"]
}
]
}
Note: targetWorkspaces is required for V2 tokens. Use accessLevel: View for embedding. If RLS is not used, you can skip the identities block.
Step 4: Embed the Report in Your App
Use the Power BI JavaScript SDK to embed the report:
<script src="https://cdn.jsdelivr.net/npm/powerbi-client@2.19.0/dist/powerbi.js"></script>
<div id="reportContainer"></div>
<script>
const embedConfig = {
type: 'report',
tokenType: models.TokenType.Embed,
accessToken: 'EMBED_TOKEN_FROM_STEP_3',
embedUrl: 'EMBED_URL_FROM_REPORT_METADATA',
id: 'REPORT_ID',
settings: {
panes: {
filters: { visible: false },
pageNavigation: { visible: true }
}
}
};
const reportContainer = document.getElementById('reportContainer');
powerbi.embed(reportContainer, embedConfig);
</script>
Note: V2 tokens are required for semantic models in Fabric (DirectLake). You must have proper capacity (Power BI Embedded A/P SKU or Fabric). Ensure your workspace is hosted in Fabric (not classic Power BI workspace).You may also use EffectiveIdentity to apply row-level security.
Please refer below community threads and articles.
Embed Token - Generate Token - REST API (Power BI Power BI REST APIs) | Microsoft Learn
Solved: Power BI Embedded - getting it to work with Fabric... - Microsoft Fabric Community
Solved: Binding an Existing Report to Direct Lake - Microsoft Fabric Community
Embed Token - Generate Token - REST API (Power BI Power BI REST APIs) | Microsoft Learn
Permission tokens needed to embed a Power BI app - Power BI | Microsoft Learn
Power BI embedded analytics Client APIs | Microsoft Learn
If you find this post helpful, please mark it as an "Accept as Solution" and consider giving a KUDOS. Feel free to reach out if you need further assistance.
Thanks and Regards
Hi @manvishah17 ,
Thanks for reaching out to the Microsoft fabric community forum.
Please follow below steps for Embedding with V2 Embed Token (App Owns Data Model)
Step 1: Authenticate with Azure AD
Use a service principal (recommended) or a master user account to authenticate with Azure AD and obtain an access token.
# Example using Python with MSAL
from msal import ConfidentialClientApplication
client_id = 'your-client-id'
client_secret = 'your-client-secret'
tenant_id = 'your-tenant-id'
authority_url = f"https://login.microsoftonline.com/{tenant_id}"
scopes = ["https://analysis.windows.net/powerbi/api/.default"]
app = ConfidentialClientApplication(
client_id, authority=authority_url, client_credential=client_secret
)
token_response = app.acquire_token_for_client(scopes=scopes)
access_token = token_response.get("access_token")
Step 2: Get Report and Dataset IDs
Use Power BI REST API to get the report and dataset IDs in the workspace where the report is published:
GET https://api.powerbi.com/v1.0/myorg/groups/{workspaceId}/reports
Authorization: Bearer {access_token}
Step 3: Generate a V2 Embed Token
Use the Power BI REST API’s GenerateToken endpoint. For DirectLake, ensure you are using the V2 token schema:
POST https://api.powerbi.com/v1.0/myorg/GenerateToken
Authorization: Bearer {access_token}
Content-Type: application/json
{
"datasets": [
{
"id": "your-dataset-id"
}
],
"reports": [
{
"id": "your-report-id"
}
],
"targetWorkspaces": [
{
"id": "your-workspace-id"
}
],
"accessLevel": "View",
"identities": [
{
"username": "user@yourdomain.com",
"roles": ["Viewer"],
"datasets": ["your-dataset-id"]
}
]
}
Note: targetWorkspaces is required for V2 tokens. Use accessLevel: View for embedding. If RLS is not used, you can skip the identities block.
Step 4: Embed the Report in Your App
Use the Power BI JavaScript SDK to embed the report:
<script src="https://cdn.jsdelivr.net/npm/powerbi-client@2.19.0/dist/powerbi.js"></script>
<div id="reportContainer"></div>
<script>
const embedConfig = {
type: 'report',
tokenType: models.TokenType.Embed,
accessToken: 'EMBED_TOKEN_FROM_STEP_3',
embedUrl: 'EMBED_URL_FROM_REPORT_METADATA',
id: 'REPORT_ID',
settings: {
panes: {
filters: { visible: false },
pageNavigation: { visible: true }
}
}
};
const reportContainer = document.getElementById('reportContainer');
powerbi.embed(reportContainer, embedConfig);
</script>
Note: V2 tokens are required for semantic models in Fabric (DirectLake). You must have proper capacity (Power BI Embedded A/P SKU or Fabric). Ensure your workspace is hosted in Fabric (not classic Power BI workspace).You may also use EffectiveIdentity to apply row-level security.
Please refer below community threads and articles.
Embed Token - Generate Token - REST API (Power BI Power BI REST APIs) | Microsoft Learn
Solved: Power BI Embedded - getting it to work with Fabric... - Microsoft Fabric Community
Solved: Binding an Existing Report to Direct Lake - Microsoft Fabric Community
Embed Token - Generate Token - REST API (Power BI Power BI REST APIs) | Microsoft Learn
Permission tokens needed to embed a Power BI app - Power BI | Microsoft Learn
Power BI embedded analytics Client APIs | Microsoft Learn
If you find this post helpful, please mark it as an "Accept as Solution" and consider giving a KUDOS. Feel free to reach out if you need further assistance.
Thanks and Regards
Hi @manvishah17 ,
If my response has resolved your query, please mark it as the "Accepted Solution" to assist others. Additionally, a "Kudos" would be appreciated if you found my response helpful.
Thank you
Hi @manvishah17 ,
If my response has resolved your query, please mark it as the "Accepted Solution" to assist others. Additionally, a "Kudos" would be appreciated if you found my response helpful.
Thank you
Hi @manvishah17 ,
If my response has resolved your query, please mark it as the "Accepted Solution" to assist others. Additionally, a "Kudos" would be appreciated if you found my response helpful.
Thank you
Hi Power BI Community,
We’re working on embedding a Power BI report into a third-party web app using the App Owns Data model. This report is built on a DirectLake semantic model connected to a Fabric Lakehouse.
Initially, we encountered issues and thought embedding wasn’t supported for DirectLake reports. However, based on recent Microsoft documentation, we now understand that embedding is possible using a V2 embed token.
🔗 Confirming official support:
Direct Lake overview - Microsoft Fabric | Microsoft Learn
Now that we know it's supported with V2 embed tokens, we need help with the complete embedding workflow, specifically for DirectLake datasets.
Could you please help us understand:
User | Count |
---|---|
45 | |
32 | |
30 | |
27 | |
25 |
User | Count |
---|---|
55 | |
55 | |
35 | |
33 | |
28 |