Embed secure
Power BI skills plugin for Claude Code — DAX authoring, data modeling, PBIP scaffolding, report theming, CI/CDFrom the repository description
npx -y skills add Insightpulseai/powerbi-skills --skill embed-secureAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
6.8 KB, as published. Nobody here has run it
/pbi-embed — Power BI Secure Embed Configuration
Configure secure embedding of Power BI reports in web applications.
When to use
- User wants to embed Power BI reports in a web app (Odoo, React, Angular, etc.)
- User asks about "embed for your organization" vs "embed for your customers"
- User needs to generate embed tokens
- User wants to configure iframe security (CSP, CORS)
Embedding models
| Model | Auth | Audience | License requirement |
|---|---|---|---|
| Secure embed (publish to web portal) | Entra ID SSO | Internal org users | Pro/PPU per viewer |
| Embed for organization (JS SDK) | Entra ID | Internal org users | Pro/PPU per viewer |
| Embed for customers (JS SDK + embed token) | App-owns-data | External users | Premium/Embedded capacity |
Workflow
Option A: Secure embed (simplest — iframe URL)
For internal apps like Odoo, SharePoint, Teams:
- In Power BI Service → Open report → File → Embed report → Website or portal
- Copy the embed URL (format:
https://app.powerbi.com/reportEmbed?reportId=...&autoAuth=true&ctid=...) - Embed as iframe:
<iframe
src="https://app.powerbi.com/reportEmbed?reportId=REPORT_ID&autoAuth=true&ctid=TENANT_ID"
width="100%"
height="100%"
frameborder="0"
allowfullscreen="true"
></iframe>
Requirements:
- Viewer must be signed in to Power BI (Entra ID)
- Browser must allow popups from
login.microsoftonline.com - Host page must be HTTPS
- Do NOT set
Cross-Origin-Opener-Policy: same-origin(breaks MSAL popup auth — usesame-origin-allow-popups)
CSP configuration (if your app sets Content-Security-Policy):
Content-Security-Policy: frame-src 'self' https://app.powerbi.com https://*.powerbi.com;
Option B: Embed for organization (JS SDK)
For richer integration with filters, events, and theming:
<div id="reportContainer" style="height: 600px;"></div>
<script src="https://cdn.jsdelivr.net/npm/powerbi-client@2/dist/powerbi.min.js"></script>
<script>
const models = window["powerbi-client"].models;
const config = {
type: "report",
id: "<REPORT_ID>",
embedUrl: "https://app.powerbi.com/reportEmbed",
accessToken: "<ENTRA_ID_TOKEN>", // acquired via MSAL.js
tokenType: models.TokenType.Aad,
settings: {
panes: {
filters: { expanded: false, visible: true },
pageNavigation: { visible: true },
},
bars: { statusBar: { visible: false } },
},
};
const report = powerbi.embed(
document.getElementById("reportContainer"),
config
);
// Listen for events
report.on("loaded", () => console.log("Report loaded"));
report.on("error", (event) => console.error(event.detail));
// Apply filters programmatically
report.on("loaded", async () => {
const filter = {
$schema: "http://powerbi.com/product/schema#basic",
target: { table: "Sales", column: "Region" },
operator: "In",
values: ["North America"],
filterType: models.FilterType.BasicFilter,
};
await report.setFilters([filter]);
});
</script>
MSAL.js token acquisition:
const msalConfig = {
auth: {
clientId: "<APP_CLIENT_ID>",
authority: "https://login.microsoftonline.com/<TENANT_ID>",
redirectUri: window.location.origin,
},
};
const msalInstance = new msal.PublicClientApplication(msalConfig);
async function getEmbedToken() {
const account = msalInstance.getAllAccounts()[0];
const response = await msalInstance.acquireTokenSilent({
scopes: ["https://analysis.windows.net/powerbi/api/Report.Read.All"],
account,
});
return response.accessToken;
}
Option C: Embed for customers (app-owns-data)
For ISV/SaaS scenarios where end users don't have Power BI licenses:
# Server-side: generate embed token
def get_embed_token(ws_id: str, report_id: str, dataset_id: str):
"""Generate embed token for app-owns-data scenario."""
resp = requests.post(
f"{BASE}/groups/{ws_id}/reports/{report_id}/GenerateToken",
headers=headers,
json={
"accessLevel": "View",
"lifetimeInMinutes": 60,
"datasets": [{"id": dataset_id}],
# Optional: apply RLS
"identities": [
{
"username": "[email protected]",
"roles": ["RegionManager"],
"datasets": [dataset_id],
}
],
},
)
return resp.json()["token"]
// Client-side: use embed token (no user sign-in needed)
const config = {
type: "report",
id: "<REPORT_ID>",
embedUrl: "https://app.powerbi.com/reportEmbed",
accessToken: "<EMBED_TOKEN_FROM_SERVER>",
tokenType: models.TokenType.Embed, // Not Aad
};
Capacity requirement: Premium (P1+), Embedded (A1+), or Fabric (F2+) — Pro licenses do NOT support embed tokens.
Step 3: Security checklist
## Embed Security Checklist
- [ ] HTTPS enforced on host application
- [ ] CSP includes `frame-src https://app.powerbi.com https://*.powerbi.com`
- [ ] No `X-Frame-Options: DENY` on the host page (would block the iframe)
- [ ] COOP is NOT `same-origin` (use `same-origin-allow-popups` for MSAL)
- [ ] RLS configured if data access varies by user
- [ ] Embed token lifetime is short (15-60 min) with auto-refresh
- [ ] Publish-to-web is DISABLED in tenant settings (prevents public URL leaks)
- [ ] "Export data" disabled in report settings if data is sensitive
- [ ] Azure Front Door / reverse proxy does not inject restrictive CSP headers
Odoo-specific integration
For embedding in Odoo 18 CE (OWL client action):
/** @odoo-module */
import { Component, xml, onWillStart, useState } from "@odoo/owl";
import { useService } from "@web/core/utils/hooks";
import { registry } from "@web/core/registry";
export class PowerBIDashboard extends Component {
static template = xml`
<div style="height:calc(100vh - 54px);">
<iframe t-if="state.url"
t-att-src="state.url"
style="width:100%;height:100%;border:none;"
allowfullscreen="true"/>
<div t-else="" style="display:flex;align-items:center;justify-content:center;height:100%;color:#888;">
Set ipai_ppm.powerbi_report_url in Settings → Technical → Parameters
</div>
</div>`;
setup() {
this.orm = useService("orm");
this.state = useState({ url: false });
onWillStart(async () => {
this.state.url = await this.orm.call(
"ir.config_parameter", "get_param",
["ipai_ppm.powerbi_report_url", false]
) || false;
});
}
}
registry.category("actions").add("powerbi.dashboard", PowerBIDashboard);
Use secure embed URL (not publish-to-web) stored in ir.config_parameter.