At the end of this part you have a Fabric app that shows live numbers from your semantic model: KPI cards, a monthly chart and a forecast grid per region and product group.
Time: about an hour if everything works; it took me 1 h 35 min, 35 of them for a preview bug I’ll show you how to get around.
Credits: not measured separately; Parts 4 to 6 together were the biggest share of my monthly allowance. 😉 No more credits for Kathrin now 🙄
Not sure what to do at any point? Paste the step into your AI companion and ask it to guide you. That’s what it’s there for.
Step 1: Project from the Data App template
Rayfin has a template made for exactly our case: the Data App template. It brings DAX query guidance, chart components, a data grid, browser tests and instructions written for coding agents. Use it instead of the default template from Part 2.
You do:
1a. Open the terminal in VS Code: menu Terminal → New Terminal, or press Ctrl + Ö on a German keyboard (Ctrl + ` on an English one). A panel opens at the bottom.
1b. Go to your parent folder, not into another project. Type in the terminal and press Enter:
cd C:\Projects
If the folder doesn’t exist yet, type mkdir C:\Projects first.
1c. Create the project. Type and press Enter:
npm create @microsoft/rayfin@latest forecast-app
Move down with the arrow keys to „Use a template (built-in)“ and press Enter.
Then type 2 for Data App and press Enter.
1d. Open the new project. Type, one line at a time:
cd forecast-app
code -r .
The Explorer on the left must show FORECAST-APP at the top, with folders like .agents, .github and .playwright that the default template doesn’t have.
1e. Save a first version with Git. Click Source Control (the branch icon on the left) → Initialize Repository. Type Project created into the message field and click Commit. If VS Code asks whether to stage all changes, answer Always.
[Screenshot: Source Control. In my screenshot the button already says „Publish Branch“ because I had committed before. Don’t click that one.]
Stumbling block: I created the project inside the folder of my first app, and Source Control showed the old commits. Always cd C:\Projects first, and one repository per project.
Step 2: Connect the model and deploy
The connector is the app’s door to your model. It needs two IDs, and both are in the model’s URL.
You do:
2a. Open your semantic model in the Fabric portal and copy the two IDs from the address bar into a text file.
2b. In the terminal, type npx rayfin login and press Enter. A browser window opens for the sign-in; do this yourself, not via Copilot.
2c. Open the Copilot chat (chat icon at the top right, or Ctrl + Alt + I), click + for a new chat, and choose Agent in the dropdown below the input field. Paste this prompt, with your two IDs and your workspace name:
Prompt for your AI:
This is a Rayfin project created from the Data App template. Add a read-only semantic model connector and deploy the backend:
1. npx rayfin connector add --type fabric-semanticmodel --workspace-id <workspace-id> --item-id <item-id> --name salesModel --operations executeQuery
2. Run the exact npm install command the CLI prints.
3. Make sure the default profile in fabric.yaml points to the same semantic model, as the Data App template expects.
4. Run a test query with npx fabric-app-data query salesModel --file test.dax, where test.dax contains EVALUATE ROW("Sales YTD", [Sales YTD]). Use a file, not --query, to avoid PowerShell quoting problems. Show me the result.
5. Only if the query succeeds, run npx rayfin up and deploy to the workspace <workspace-name>.
If any step returns Unauthorized, stop and show me the full error.
Points 3 and 4 are there because they were missing in my first run and cost a round trip.
2d. When Copilot asks for permission to run a command, read it and click Allow (or Continue). During the deploy, the terminal asks which workspace to use: choose the one that holds your model, so app and model live together.
Checkpoint: the test query returns 20,883,715, the number from Part 3.
Good to know: –name salesModel is only an alias for the code. The app finds the model by its item ID, so the model’s display name doesn’t matter.
Commit point: Source Control → message Semantic model connector added → Commit.
Step 3: Let Copilot build the app
Now the big prompt. It names every table and measure, forbids recalculating them in code, and rules out a separate dev backend. Each of those lines prevents a detour I took on day 1.
You do:
3a. In the Copilot chat, click + for a new chat and check that Agent is selected.
3b. Paste the prompt below and press Enter. Copilot works 20–30 minutes at a stretch; you can watch, but you don’t have to.
3c. Copilot will explain which database changes it needs and ask before applying them. Read the explanation and confirm with Allow or Continue.
Prompt for your AI:
This is a Rayfin project (Microsoft Fabric Apps) created from the Data App template. Before writing any code, read AGENTS.md and the instructions under .github and .agents, then https://rayfin.ai/docs/reference/agent-rules.md, https://learn.microsoft.com/en-us/fabric/apps/connectors and https://learn.microsoft.com/en-us/fabric/apps/data-models. Follow these rules.
Context: A read-only semantic model connector named "salesModel" is already configured. The model contains the tables fact_sales_actual, dim_region (Region), dim_product_group (ProductGroup) and 'Date' (Month, Month Start, Year), plus measures in the table KPI: [Sales Actual], [Sales PY], [Sales YTD], [Growth YTD %], [Last Actual Month] and [Forecast Suggestion]. Always query these measures via DAX with executeQuery; never recalculate them in TypeScript or hardcode values.
Build an English "Sales Forecast" app:
1. Header with KPI cards: Sales YTD, Growth YTD % and Last Actual Month.
2. Filters for Region and Product Group.
3. A line chart with monthly Sales Actual from January 2025 up to the last actual month, continued by the forecast months (Forecast Suggestion and, once entered, the saved forecast).
4. An editable grid with one row per Region × Product Group. Columns: Sales YTD, Growth YTD %, and for each month after [Last Actual Month] until the end of that year: Sales PY, Forecast Suggestion, and an editable Forecast input pre-filled with the suggestion. Determine the forecast months dynamically from [Last Actual Month]. Show a total row. Format amounts in EUR.
5. A "Save forecast" button. Store the entries in the app's own database as a new entity "ForecastEntry" (id, regionId, productGroupId, month, forecastAmount, comment optional, user_id, updatedAt). Saving again for the same user, region, product group and month updates the existing entry. Each signed-in user only sees their own entries. Saved values replace the suggestion in the grid and chart.
Use the same Fabric backend that was already deployed with npx rayfin up, not a separate dev backend. Before deploying, explain which database changes are needed. Apply backend changes with npx rayfin up --exclude-services staticHosting and do not publish the web UI yet. Finally start npm run dev and tell me the URL. When you are done, end without further review loops.
Yes, the prompt already includes saving. Part 5 explains what happens there and how to test it.
Stumbling block: „Unauthorized“. My first run stopped after less than 3 minutes.
The cause: the „Semantic Model Execute Queries REST API“ setting was enabled only for a group I wasn’t in, admin or not.
After enabling it for my whole (demo) tenant (Part 2 shows where), this follow-up in the same chat unblocked Copilot:
The tenant setting "Semantic Model Execute Queries REST API" is enabled for a security group I am a member of, and I am workspace admin and owner of the semantic model. Please configure the default profile in fabric.yaml for the salesModel semantic model (workspace ID <workspace-id>, item ID <item-id>) as the Data App template expects. Then retry the preflight query and show me the full error details if it still fails. Only continue with the original task once a test query such as EVALUATE ROW("Sales YTD", [Sales YTD]) succeeds.
Step 4: The connector gate, and the way around it
This is the honest part. The app was built, the CLI could query the model, but the app itself said: „Connector ’salesmodel‘ is not enabled for this workspace“.
If you see exactly this message, you’re not doing anything wrong. Aligning alias spellings and backends didn’t help. It is a known preview issue on the server side, Rayfin issue #85. I added my setup there. If you hit it too, do the same, but leave out tenant IDs, workspace IDs and app URLs: GitHub issues are public.
The way around it is already in the Data App template: a second query path, the Fabric SDK route, which queries the model with the signed-in user’s access through Fabric itself. I asked Copilot to put all model reads behind one switch, so I can go back to the connector once the issue is fixed.
You do:
4a. New Copilot chat (+, Agent), paste the prompt below, confirm commands with Allow.
4b. When Copilot says it deployed, open the Fabric portal, go to your workspace and click the app item to open it. Refresh the page if it was already open.
Prompt for your AI (reconstructed from my session):
The app fails with "Connector 'salesmodel' is not enabled for this workspace" (known issue rayfin #85). The Data App template also supports querying the semantic model through the Fabric SDK route. Route all semantic model reads through one adapter with a central switch SALES_MODEL_QUERY_SOURCE = "fabric-sdk" | "rayfin-connector", default "fabric-sdk". Use one shared DAX query builder for both paths, and add a test that fails if any __PLACEHOLDER__ remains in a generated query, for all filter combinations. Do not change measures or DAX logic. Deploy with npx rayfin up and confirm the deployment.
The placeholder test is in there because my first switch failed with Failed to resolve name ‚__REGION_FILTER__‘: only the connector path filled in the filters.
Two consequences you need to know:
- The SDK route only works inside the Fabric portal. On localhost it says „Not running inside a Fabric iframe“. So you test by deploying with npx rayfin up and opening the app from the workspace.
- Access then follows the model’s permissions (Build/Read, RLS), not connector rules in the app.
Checkpoint: open the app in Fabric. Sales YTD shows €20,883,714.78, which rounds to our checkpoint of 20,883,715 from Part 3. That moment felt very good.
Commit point: Source Control → message Forecast app working → Commit.
Fabric Apps is in preview; menus and commands may change. Written October 2026, Rayfin CLI 1.36.2. Co-authored with Claude as co-learner. Previous: Part 3 · Next: Part 5. #HumanAICoProgramming