How microsoft/power-bi-embedded-contoso-sales-demo works
Contoso Sales Demo is a React/.NET sales portal centered on embedding an interactive Power BI report, with role-based access and Dataverse writeback. The main user path is login, report embedding and customization, then optional report export or sales-record edits. The graph preserves documented report interactions and sales-management capabilities; unsampled modules are represented only where the tree or README supports them. Some client-to-server writeback and authentication wiring is not shown, so those relationships are omitted.
Main entry points: EmbedPage.tsx Embedded report page · PowerBiController.cs Power BI API · AadService.cs Aad token service · App.tsx App routing
Components 25
Sales portal
- App routing
ContosoSalesDemo/ClientApp/src/App.tsx - Login and roles
ContosoSalesDemo/ClientApp/src/components/Login/Login.tsx - Lead editing
ContosoSalesDemo/ClientApp/src/components/Forms/EditLeadForm.tsx - Opportunity editing
ContosoSalesDemo/ClientApp/src/components/Forms/UpdateOpportunityForm.tsx - Form submission
ContosoSalesDemo/ClientApp/src/components/Forms/SaveData.ts
Embedded analytics
- Embedded report page
ContosoSalesDemo/ClientApp/src/components/EmbedPage/EmbedPage.tsx - Visual layout
ContosoSalesDemo/ClientApp/src/components/VisualGroup.ts - Report configuration
ContosoSalesDemo/ClientApp/src/reportConfig.ts - Report personalization
ContosoSalesDemo/ClientApp/src/components/PersonaliseBar/PersonaliseBar.tsx - Bookmarks
ContosoSalesDemo/ClientApp/src/components/BookmarksList/BookmarksList.tsx - Export controls
ContosoSalesDemo/ClientApp/src/components/AnalyticsPopup/Export/Export.tsx
Application API
- Authentication API
ContosoSalesDemo/Controllers/BasicAuthenticationController.cs - Power BI API
ContosoSalesDemo/Controllers/PowerBiController.cs - Dataverse API
ContosoSalesDemo/Controllers/DataverseController.cs - Embed token service
ContosoSalesDemo/Services/EmbedService.cs - Report export service
ContosoSalesDemo/Services/ExportService.cs
Identity services
- Aad token service
ContosoSalesDemo/Services/AadService.cs - JWT generation
ContosoSalesDemo/Services/JwtTokenService.cs
Sales data
- Dataverse operations
ContosoSalesDemo/Services/DataverseService.cs
Other components
- Salesperson
- Power BI service
- Microsoft Dataverse
- Microsoft Entra ID
- Azure Key Vault
- MSAL.NET
Connections 27
- Salesperson → App routing: uses
README.md - App routing → Login and roles: shows when unauthenticated
- App routing → Embedded report page: renders
ContosoSalesDemo/ClientApp/src/App.tsx - Embedded report page → Power BI API: fetches embed params
ContosoSalesDemo/ClientApp/src/components/EmbedPage/EmbedPage.tsx - Power BI API → Embed token service: generates embed params
ContosoSalesDemo/Controllers/PowerBiController.cs - Embed token service → Power BI service: requests embed token
ContosoSalesDemo/Services/EmbedService.cs - Embedded report page → Visual layout: uses visual layouts
ContosoSalesDemo/ClientApp/src/components/EmbedPage/EmbedPage.tsx - Visual layout → Report configuration: reads configuration
ContosoSalesDemo/ClientApp/src/components/VisualGroup.ts - Embedded report page → Report personalization: renders controls
ContosoSalesDemo/ClientApp/src/components/EmbedPage/EmbedPage.tsx - Embedded report page → Bookmarks: renders list
ContosoSalesDemo/ClientApp/src/components/EmbedPage/EmbedPage.tsx - Embedded report page → Lead editing: renders edit form
ContosoSalesDemo/ClientApp/src/components/EmbedPage/EmbedPage.tsx - Embedded report page → Opportunity editing: supports editing
ContosoSalesDemo/ClientApp/src/components/EmbedPage/EmbedPage.tsx - Lead editing → Form submission: uses submission
- Opportunity editing → Form submission: uses submission
ContosoSalesDemo/ClientApp/src/components/Forms/UpdateOpportunityForm.tsx - Export controls → Power BI API: requests export
- Power BI API → Report export service: gets exported file
ContosoSalesDemo/Controllers/PowerBiController.cs - Report export service → Power BI service: exports report
ContosoSalesDemo/Services/ExportService.cs - Authentication API → JWT generation: generates token
ContosoSalesDemo/Controllers/BasicAuthenticationController.cs - Power BI API → Dataverse API: routes edits
- Dataverse API → Dataverse operations: delegates operations
ContosoSalesDemo/Controllers/DataverseController.cs - Dataverse operations → Microsoft Dataverse: reads and writes
ContosoSalesDemo/Services/DataverseService.cs - Embed token service → Aad token service: gets access token
ContosoSalesDemo/Services/EmbedService.cs - Report export service → Aad token service: gets access token
ContosoSalesDemo/Services/ExportService.cs - Dataverse operations → Aad token service: gets access token
ContosoSalesDemo/Services/DataverseService.cs - Aad token service → MSAL.NET: acquires token
ContosoSalesDemo/Services/AadService.cs - JWT generation → Azure Key Vault: signs JWT
ContosoSalesDemo/Services/JwtTokenService.cs - Aad token service → Microsoft Entra ID: authenticates service principal
ContosoSalesDemo/Services/AadService.cs