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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
manvishah17
Responsive Resident
Responsive Resident

How to Embed Power BI Report with DirectLake (Fabric Lakehouse) Using V2 Embed Token?

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:

    1. What are the exact steps to embed the report using the V2 embed token and steps to generate a V2 embed token for a report connected to a DirectLake dataset?
    2. Can anyone share a working example or a Microsoft guide that walks through this end-to-end?

      Any guidance, code samples, or documentation references would be greatly appreciated!

1 ACCEPTED SOLUTION
v-dineshya
Community Support
Community Support

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 Power BI report in a Power BI embedded analytics application for your organization - Power BI ...

Embed Token - Generate Token - REST API (Power BI Power BI REST APIs) | Microsoft Learn

Data Warehouse Tutorial: Create a Direct Lake Semantic Model and Power BI Report - Microsoft Fabric ...

Introducing Power BI Embedded with Direct Lake Mode (Preview) | Microsoft Fabric Blog | Microsoft Fa...

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

View solution in original post

5 REPLIES 5
v-dineshya
Community Support
Community Support

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 Power BI report in a Power BI embedded analytics application for your organization - Power BI ...

Embed Token - Generate Token - REST API (Power BI Power BI REST APIs) | Microsoft Learn

Data Warehouse Tutorial: Create a Direct Lake Semantic Model and Power BI Report - Microsoft Fabric ...

Introducing Power BI Embedded with Direct Lake Mode (Preview) | Microsoft Fabric Blog | Microsoft Fa...

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

KeyurPatel14
Responsive Resident
Responsive Resident

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:

    1. What are the exact steps to embed the report using the V2 embed token and steps to generate a V2 embed token for a report connected to a DirectLake dataset?
    2. Can anyone share a working example or a Microsoft guide that walks through this end-to-end?


      Any guidance, code samples, or documentation references would be greatly appreciated!

Helpful resources

Announcements
June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.