Events
Power BI DataViz World Championships
Feb 14, 4 PM - Mar 31, 4 PM
With 4 chances to enter, you could win a conference package and make it to the LIVE Grand Finale in Las Vegas
Learn moreThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
This sample shows how to use the Global Discovery service from a Blazor WebAssembly application.
You can download the sample from https://github.com/microsoft/PowerApps-Samples/tree/master/dataverse/webapi/C#/BlazorCDS
This sample is a modification of the steps in the Tutorial: Create an ASP.NET Core Blazor WebAssembly app using Microsoft Dataverse
You can try this sample online here: https://blazorcds.mohsinonxrm.com/
This sample demonstrates how to provide a select (drop-down) control in a web application to allow users to switch environments that they have access to.
The Pages/EnvironmentChooser.razor
file provides the user interface to allow users to select from available environments based on their credentials after they have logged in.
This page depends on a named definition of an HttpClient (GDSClient
) in Program.cs that is configured to access the Global Discovery Service. Access to the Global Discovery Service is added to the available scopes when the user logs in. When the user selects a different environment, the SelectedEnvUrl
in Models/AppState.cs
changes.
Access to the account records is provided by Pages/FetchAccounts.razor
with an access token that depends on the selected environment.
To run this sample you must first configure an Microsoft Entra ID application on your tenant and update the BlazorCDS\wwwroot\appsettings.json
file to replace the placeholder ClientId
value with the application (client) Id. Use the following steps:
Go to Azure.
Select Microsoft Entra ID.
Go To App registrations.
Select New Registration.
Enter the following:
Field | Value |
---|---|
Name | Your choice. You might use: BlazorGlobalDiscoverySample |
Supported account types: | Accounts in this organization directory only (Single Tenant) |
Redirect URI (optional) | https://localhost:44363/authentication/login-callback |
Click Register.
Copy the Application (client) ID value. You will need this when you Update the project.
Go to Authentication.
Under Implicit grant and hybrid flows, select both of the following options:
Click Save.
Read the following important information about using implicit grant or implicit flow in application code.
Important
Microsoft recommends that you use the most secure authentication flow available. The authentication flow described in this article requires a very high degree of trust in the application, and carries risks that are not present in other flows. You should only use this flow when other more secure flows, such as managed identities, aren't viable.
wwwroot
and open the appsettings.json
file.ClientId
value (11111111-1111-1111-1111-111111111111
) with the application (client) ID value you copied in Create an app registration.In Visual Studio, click IIS Express to run the sample.
This sample makes no changes to data in your environment.
Discover user organizations
Sample: Global Discovery Service (C#)
Events
Power BI DataViz World Championships
Feb 14, 4 PM - Mar 31, 4 PM
With 4 chances to enter, you could win a conference package and make it to the LIVE Grand Finale in Las Vegas
Learn moreTraining
Learning path
Get started using Microsoft Dataverse - Training
Do you want to learn how to build solutions that can use a standardized data structure, and work with other solutions sharing the same data model? Do you want to extend the standard model to support custom solutions? This learning path explains the concepts behind and benefits of Dataverse. Creating an environment, entities, fields and options sets are also discussed.
Certification
Microsoft Certified: Power Platform Developer Associate - Certifications
Demonstrate how to simplify, automate, and transform business tasks and processes using Microsoft Power Platform Developer.
Documentation
Quickstart: Blazor Server Web API sample (C#) (Microsoft Dataverse) - Power Apps
This sample demonstrates how to authenticate with a Microsoft Dataverse from a Blazor Server application and then call a basic WhoAmI Web API function.