Maak een semantisch model-app met GitHub Copilot

Gebruik dit recept om een analytische app te maken die verbonden is met een semantisch model met GitHub Copilot-agent-modus. Copilot genereert de basisstructuur van de appsjabloon voor gegevens, voegt een Fabric-connector voor semantische modellen toe, maakt DAX-query's en visualisaties, en valideert de app.

De data-app sjabloon biedt Fabric-authenticatie, DAX-generatiebegeleiding, visuele componenten en browservalidatie. De connector biedt gedelegeerde semantische modeltoegang via de Fabric Apps-client. Zie Een app maken die is verbonden met een semantisch model voor meer informatie.

In deze handleiding leert u:

  • Bereid GitHub Copilot voor agent-gedreven ontwikkeling.
  • Vraag Copilot om de basisstructuur voor het data-app-sjabloon te genereren.
  • Verbind de app met een semantisch model.
  • Bouw een interactieve verkenner voor verkoopprestaties.
  • Bekijk en valideer de gegenereerde wijzigingen.
  • Rol de app uit op Fabric.
  • Controleer de implementatie en open de app.

Prerequisites

  • Node.js 20 of hoger.
  • Visual Studio Code.
  • GitHub Copilot in Visual Studio Code met agentmodus beschikbaar.
  • Een GitHub-account met toegang tot GitHub Copilot.
  • Een Microsoft-account met toegang tot Fabric.
  • Een Fabric werkruimte met inzender-, lid- of beheerdersmachtigingen.
  • De Fabric Apps-workload is ingeschakeld voor je tenant.
  • De Semantic Model Execute Query's REST API-tenantinstelling ingeschakeld.
  • Bouw- en leesrechten op een semantisch model dat wordt gehost op Fabric- of Power BI-capaciteit.
  • De werkruimte-ID en item-ID voor het semantische model.

Opmerking

Copilot vraagt om goedkeuring voordat hij terminalcommando's uitvoert. Je moet ook interactieve browser-aanmelding voltooien wanneer de Rayfin CLI dit aanvraagt.

Open de agentmodus van GitHub Copilot

  1. Open Visual Studio Code.
  2. Open de hoofdmap waar je wilt dat Copilot het project aanmaakt.
  3. Open Chat.
  4. Selecteer de agentmodus .
  5. Bevestig dat de agent toegang heeft tot de terminal en werkruimte.

Open geen map met niet-gerelateerde bestanden die je niet wilt dat Copilot inspecteert of bewerkt.

Genereer de data-app.

Kopieer de volgende prompt naar Copilot Chat:

Set up a new Fabric data app for me, end to end.

Create the project in a folder named sales-insights. Before changing code, read any
copilot-instructions.md files and agent guidance included in the scaffolded project.

Do the work yourself instead of only printing instructions:
1. Run `npm create @microsoft/rayfin@latest -- "sales-insights" --template dataapp --workspace <workspace-name>`.
2. In the scaffolded project, run `npx rayfin connector add --type fabric-semanticmodel --workspace-id <workspace-id> --item-id <semantic-model-item-id> --name salesModel --operations executeQuery`.
3. Run the version-matched npm install command printed by the connector command.
4. Open and inspect the scaffolded project. Explain the data app template's DAX query,
   visualization, data grid, theme, and browser-validation patterns.
5. Configure the template to use ConnectorsRayfinClient, the generated salesModel
   schema, and the fabricSemanticModel() runtime. Don't retain or add a direct
   Execute Queries REST API client.
6. If authentication is required, run `npx rayfin login` and pause while I complete
   sign-in.
7. Run the existing build and report any errors.
8. Summarize the scaffolded app and wait for my semantic model requirements.

Ask before making a destructive change or using a force option.

Vervang <workspace-name>, <workspace-id>, en <semantic-model-item-id> door waarden voor je Fabric-werkruimte en semantisch model. Keur de commando's goed terwijl Copilot ze uitvoert, en voltooi het Rayfin-inlogproces wanneer hierom wordt gevraagd.

Vraag het aan Copilot om je app te bouwen

Beschrijf de doelgroep, vragen, interacties en visualisaties van de app. De salesModel connector identificeert het semantische model al.

Gebruik de volgende prompt als startrecept voor een sales performance explorer. Pas de zakelijke vereisten aan op de beschikbare velden in jouw model.

Use the existing salesModel connector to build a sales performance explorer for
sales managers.

Requirements:
- Inspect the generated connector schema and semantic model metadata before editing.
  Use actual table, measure, and column names instead of guessing them.
- Show KPI callouts for the model's revenue, order volume, and margin measures when
  those measures are available.
- Add a time-series chart for sales performance, a bar chart that compares a useful
  business category, and a detailed data grid.
- Add date and category filters, and use the template's cross-highlighting behavior.
- Use the template's DAX generation patterns and visual primitives. Minimize the
  number of DAX queries and don't duplicate queries for the same data.
- Submit DAX with client.connectors.salesModel.executeQuery(), check the returned
  status, and handle success and error results.
- Apply the semantic model's format strings consistently to cards, charts, tooltips,
  and the data grid.
- Include loading, empty, and error states.
- Don't add mock data, embed credentials, or implement a separate authentication flow.
- Preserve the template's Fabric authentication and the semantic model connector.
- Don't add dependencies unless they're necessary.

Before editing, inspect the relevant files and give me a short implementation plan.
Ask me to clarify any model fields that are ambiguous. Then make the changes, run
the existing build, and use the template's browser validation workflow to check the
layout at desktop and mobile sizes. Explain any errors you fix.

Bekijk het plan van Copilot voordat het project wordt bewerkt. Als het plan niet aan je eisen voldoet, corrigeer het dan in Chat voordat je de uitvoering goedkeurt.

De gegenereerde wijzigingen controleren

Nadat Copilot klaar is, vraag het om zijn werk te beoordelen:

Review the changes you made against every requirement in my previous prompt.

Check for:
- DAX queries that reference fields that aren't in the semantic model.
- Duplicate or unnecessary DAX queries.
- Hard-coded sample data, credentials, access tokens, or a second sign-in flow.
- Formatting that ignores the semantic model's format strings.
- Charts, filters, cross-highlighting, or data grid interactions that don't work.
- Missing loading, empty, or error states.
- TypeScript or build errors.

Fix confirmed issues, run the existing build and browser validation, and summarize
the final behavior.

Inspecteer de verschillen in broncodebeheer in Visual Studio Code. Let vooral op:

  • De configuratie van de salesModel connector, het gegenereerde schema en DAX-query's.
  • Serviceconfiguratie in rayfin/rayfin.yml.
  • Nieuwe afhankelijkheden in package.json.
  • Wijzigingen in de authenticatie of directe REST-aanroepen die de connector omzeilen.
  • Geheimen of inloggegevens die je niet mag committen.

Rol de semantische modelverbinding uit en verifieer deze

Vraag het aan Copilot om de app uit te rollen en de verbinding te verifiëren:

Deploy the app with `npx rayfin up`, then run `npx rayfin up status` and confirm
that the deployment is healthy. Give me the Fabric portal link from the command
output.

Don't add mock data if a semantic model query fails. Check the workspace and model
IDs in the connector configuration, the Semantic Model Execute Queries REST API
tenant setting, my Build and Read permissions, the DAX query, the connector error
result, and the browser console. Report the exact failure and the corrective action.

Open de app via het Fabric-portaal om live semantische model-queries te testen.

De app valideren

Vraag het aan Copilot om de bestaande validatie van het project uit te voeren:

Validate the app without adding new tools.

1. Run the existing build and type-check commands from package.json.
2. Run the template's browser validation at desktop and mobile sizes.
3. Check for clipped charts, unreadable labels, empty visuals, and console errors.
4. Tell me which semantic model queries and user interactions I must verify in the
    Fabric portal.
5. Fix confirmed build, type, or layout errors, and rerun the failed check.

Controleer in het Fabric-portaal de acceptatiecriteria die je aan Copilot hebt gegeven. Test de authenticatie, filters, kruislings markeren, gegevensopmaak, lege statussen, foutafhandeling en de resultaten van elke visualisatie.

Rol de voltooide app uit

Nadat je de wijzigingen hebt bekeken en de app hebt getest, vraag Copilot om deze uit te rollen:

Deploy the reviewed app to Fabric.

1. Show me the current git diff and summarize what will be deployed.
2. Run `npx rayfin up`.
3. Run `npx rayfin up status`.
4. Confirm that the deployment is healthy.
5. Give me the hosted app URL and Fabric portal link from the command output.

Stop and explain the issue if deployment or verification fails.

Hetzelfde npx rayfin up commando updatet een bestaande implementatie wanneer je de app verder ontwikkelt.

Blijf itereren met Copilot

Gebruik gerichte prompts voor latere wijzigingen. Neem het gewenste gedrag, getroffen gebruikers, beperkingen en validatiestappen op.

Add a product detail view to the sales performance explorer.

Open the view when a user selects a product in the data grid. Use fields and measures
that exist in the semantic model, reuse existing query results where practical, and
preserve filters and formatting. Run the existing build and browser validation, then
list the interactions and DAX results I should verify in the Fabric portal.

Houd elk verzoek klein genoeg om te kunnen beoordelen. Bepaal een werkstatus voordat je Copilot vraagt een grote of mogelijk destructieve verandering door te voeren.

Problemen met de Copilot-workflow oplossen

Copilot print alleen commando's af

Zeg tegen Copilot dat hij de commando's zelf moet uitvoeren en de resultaten moet rapporteren. Bevestig dat de chat in Agent-modus staat en dat terminaltoegang is ingeschakeld.

Een commando wacht op aanmelden

Voltooi de inlogflow van de browser. Vertel dan Copilot dat het inloggen voltooid is zodat het verder kan gaan.

Copilot bewerkt de verkeerde map

Stop de agent, open de gegenereerde projectmap in Visual Studio Code en start een nieuwe chat vanuit die werkruimte.

Uitrol slaagt, maar query's voor het semantische model mislukken

Vraag Copilot om de werkruimte- en model-ID's van de connector te controleren, de tenantinstelling voor de Semantic Model Execute Queries REST API, je Build- en Read-machtigingen, de gegenereerde DAX, het foutresultaat van de connector en de browserconsole. Vervang mislukte queries niet door mock data.

Copilot stelt voor--force

Laat Copilot eerst de mogelijk destructieve schema-operaties tonen. Accepteer --force alleen wanneer je het mogelijke dataverlies begrijpt en goedkeurt.

Voor andere kwesties, zie Troubleshoot Fabric Apps.