powerbi-secure-embed
Skill1 starsChanged 6 months agoMITView on GitHub
Reference for the Power BI secure embed URL format used by this template. Read when debugging report iframes, when a report fails to load, or when adapting the embed for a non-default scenario.
In this repository7 other files it gives its agents.
- AGENTS.mdAGENTS.md
- app-designSkill
- app-validationSkill
- org-app-fetchSkill
- org-app-parsingSkill
- org-app-themingSkill
- playwright-cliSkill
The file
We split this skill into the rules it gives an agent
3 rules. About 0 are common, 0 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 30
All URL building lives in src/lib/fabricUrls.ts (getReportEmbedUrl, getOpenAppUrl, getOpenReportUrl) — change embed parameters there, not …
- Very specific: line 53
If the user later needs filters, bookmarks, or eventing — switch to powerbi-client.
- Very specific: line 68
When deploying somewhere other than localhost:5173, add the deployed origin to:
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
powerbi-secure-embed
What this template uses
This template uses "Embed for your organization" with autoAuth=true — the simplest of the three Power BI embed flows.
{FABRIC_PORTAL_ORIGIN}/reportEmbed
?reportId={itemId}
&groupId={workspaceId}
&autoAuth=true
&ctid={tenantId}
&actionBarEnabled=true
&reportCopilotInEmbed=trueThe embed origin is read from VITE_FABRIC_PORTAL_URL (set by rayfin up / rayfin env from RAYFIN_PUBLIC_PORTAL_URL). The same Fabric portal host serves the report embed endpoint — no fabric.microsoft.com → powerbi.com host swap is needed.
| Fabric portal | Embed origin used |
https://app.fabric.microsoft.com/ | https://app.fabric.microsoft.com |
The user's existing Power BI / Fabric session signs them into the iframe automatically. No embed token, no service principal, no Power BI Embedded capacity required.
All URL building lives in src/lib/fabricUrls.ts (getReportEmbedUrl, getOpenAppUrl, getOpenReportUrl) — change embed parameters there, not at call sites.
Reference: Embed Power BI content with service principal and secrets / "Embed for your organization"
Parameter source-of-truth
| Param | Source | Note |
reportId | manifest.reports[].itemId | The Power BI report GUID |
groupId | manifest.workspaceId | The workspace that owns the report |
autoAuth=true | hard-coded | Skips the interactive sign-in inside the iframe |
ctid | manifest.tenantId | Required for multi-tenant guest users; harmless to include always |
actionBarEnabled=true | hard-coded | Shows the Power BI action bar (Comment, Subscribe, Share) — parity with in-portal |
reportCopilotInEmbed=true | hard-coded | Enables Copilot pane inside the embed (where tenant policy allows) |
What is not this template
This template intentionally does not use:
- Embed for your customers (app-owns-data) — requires service principal + embed token + Power BI Embedded capacity
- Embed token flow — requires backend API call to
/v1.0/myorg/groups/{groupId}/reports/{reportId}/GenerateToken - Power BI Client SDK (
powerbi-client) — heavier, gives you JS event hooks but adds bundle weight; the iframe is sufficient for read-only embed
If the user later needs filters, bookmarks, or eventing — switch to powerbi-client. For migration parity with the original Org App, the iframe is correct.
Debugging a non-loading report
| Symptom | Cause | Fix |
| Iframe shows "You don't have access" | User is not a viewer of the workspace or the underlying report | Verify in the Fabric portal directly (VITE_FABRIC_PORTAL_URL) |
| Iframe shows AAD login form | autoAuth did not pick up the session | User must visit the Fabric portal once in this browser session (e.g. https://app.fabric.microsoft.com/) to seed the cookie |
| Iframe loads then shows "Tenant mismatch" | ctid doesn't match the session tenant | Confirm tenantId in the manifest matches az account show --query tenantId |
| Iframe loads blank, no error | reportId belongs to a different groupId | Re-run the migration agent to refresh the manifest |
| Mixed content / X-Frame-Options error in console | Self-hosted under a non-HTTPS origin | Use https:// (or http://localhost which Power BI allows) |
| Iframe loads to a 404 or "site doesn't exist" | VITE_FABRIC_PORTAL_URL points at the wrong environment | Re-run rayfin up against the right env, or set RAYFIN_PUBLIC_PORTAL_URL before pnpm dev |
Allowed embed origins
When deploying somewhere other than localhost:5173, add the deployed origin to:
rayfin/rayfin.yml→auth.fabric.allowedRedirectUris- The Power BI tenant admin's Embed content in apps allowed-origins list (if your tenant restricts this — most don't)
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

