Skip to content

Commit 1c9a173

Browse files
authored
Merge pull request #6623 from MicrosoftDocs/jdaly-main-discovery-unification
Jdaly main discovery unification
2 parents 771905d + 761468d commit 1c9a173

16 files changed

+992
-409
lines changed

.openpublishing.redirection.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,30 @@
11
{
22
"redirections": [
3+
{
4+
"source_path": "powerapps-docs/developer/data-platform/org-service/samples/access-discovery-service.md",
5+
"redirect_url": "../../sample-discovery-service-crmserviceclient",
6+
"redirect_document_id": false
7+
},
8+
{
9+
"source_path": "powerapps-docs/developer/data-platform/webapi/samples/global-discovery-service-csharp.md",
10+
"redirect_url": "../../sample-global-discovery-service-csharp",
11+
"redirect_document_id": false
12+
},
13+
{
14+
"source_path": "powerapps-docs/developer/data-platform/org-service/discovery-service.md",
15+
"redirect_url": "../discovery-service",
16+
"redirect_document_id": false
17+
},
18+
{
19+
"source_path": "powerapps-docs/developer/data-platform/webapi/discovery-orgsdk-to-webapi.md",
20+
"redirect_url": "../discovery-service",
21+
"redirect_document_id": false
22+
},
23+
{
24+
"source_path": "powerapps-docs/developer/data-platform/webapi/discover-url-organization-web-api.md",
25+
"redirect_url": "../discovery-service",
26+
"redirect_document_id": false
27+
},
328
{
429
"source_path": "powerapps-docs/maker/canvas-apps/formula-reference.md",
530
"redirect_url": "/power-platform/power-fx/formula-reference",

powerapps-docs/developer/data-platform/TOC.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,12 @@
436436
href: xrm-tooling/
437437
- name: Discover user organizations
438438
href: discovery-service.md
439+
- name: "Sample: Global Discovery Service"
440+
href: sample-global-discovery-service-csharp.md
441+
- name: "Sample: Blazor WebAssembly with Global Discovery"
442+
href: sample-blazor-web-assembly-global-discovery.md
443+
- name: "Sample: Global Discovery Service with CrmServiceClient"
444+
href: sample-discovery-service-crmserviceclient.md
439445
- name: Tutorials
440446
items:
441447
- name: "Tutorial: Register an app with Azure Active Directory"

powerapps-docs/developer/data-platform/discovery-service.md

Lines changed: 273 additions & 17 deletions
Large diffs are not rendered by default.

powerapps-docs/developer/data-platform/includes/cc-discovery-service-description.md

Lines changed: 0 additions & 7 deletions
This file was deleted.

powerapps-docs/developer/data-platform/org-service/TOC.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@
1818
href: subscribe-sdk-assembly-updates-using-nuget.md
1919
- name: Visual Studio and the .NET Framework
2020
href: visual-studio-dot-net-framework.md
21-
- name: Discovery Service
22-
href: discovery-service.md
2321
- name: Use XRM Tooling
2422
href: ../xrm-tooling/build-windows-client-applications-xrm-tools.md
2523
- name: Table operations

powerapps-docs/developer/data-platform/org-service/discovery-service.md

Lines changed: 0 additions & 41 deletions
This file was deleted.

powerapps-docs/developer/data-platform/org-service/samples/toc.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,4 @@
307307
- name: Import files as web resources
308308
href: import-files-as-web-resources.md
309309
- name: Workflow operations
310-
href: workflow-operations.md
311-
- name: Access the Discovery service
312-
href: access-discovery-service.md
310+
href: workflow-operations.md
Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
---
2+
title: "Sample: Blazor WebAssembly with Global Discovery (C#) (Microsoft Dataverse) | Microsoft Docs" # Intent and product brand in a unique string of 43-59 chars including spaces
3+
description: "This sample a Blazor WebAssembly project that uses the Global Discovery Service and Dataverse Web API to access multiple environments available to the user." # 115-145 characters including spaces. This abstract displays in the search result.
4+
ms.date: 07/18/2022
5+
author: ImadYanni
6+
ms.author: iyanni
7+
ms.reviewer: jdaly
8+
search.audienceType:
9+
- developer
10+
search.app:
11+
- PowerApps
12+
- D365CE
13+
contributors:
14+
- JimDaly
15+
- phecke
16+
---
17+
# Sample: Blazor WebAssembly with Global Discovery
18+
19+
This sample shows how to use the Global Discovery service from a Blazor WebAssembly application.
20+
21+
You can download the sample from [https://github.com/microsoft/PowerApps-Samples/tree/master/cds/webapi/C#/BlazorCDS](https://github.com/microsoft/PowerApps-Samples/tree/master/cds/webapi/C%23/BlazorCDS)
22+
23+
This sample is a modification of the steps in the [Tutorial: Create an ASP.NET Core Blazor WebAssembly app using Microsoft Dataverse](walkthrough-blazor-webassembly-single-tenant.md)
24+
25+
You can try this sample online here: [https://blazorcds.mohsinonxrm.com/](https://blazorcds.mohsinonxrm.com/)
26+
27+
## How to run this sample
28+
29+
1. Download or clone the [Samples](https://github.com/microsoft/PowerApps-Samples) repo so that you have a local copy.
30+
1. Follow the instructions in [Setup](#setup) to create an Azure Active Directory app registration and run the sample.
31+
32+
## What this sample does
33+
34+
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.
35+
36+
## How this sample works
37+
38+
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.
39+
40+
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.
41+
42+
Access to the account records is provided by `Pages/FetchAccounts.razor` with an access token that depends on the selected environment.
43+
44+
### Setup
45+
46+
To run this sample you must first configure an Azure Active Directory 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:
47+
48+
#### Create an app registration
49+
50+
1. Go to [Azure](https://portal.azure.com/).
51+
1. Select **Azure Active Directory**.
52+
1. Go To **App registrations**.
53+
1. Select **New Registration**.
54+
1. Enter the following:
55+
56+
|Field|Value|
57+
|---------|---------|
58+
|Name|Your choice. You might use: `BlazorGlobalDiscoverySample`|
59+
|Supported account types:|Accounts in this organization directory only (Single Tenant)|
60+
|Redirect URI (optional)|`https://localhost:44363/authentication/login-callback`|
61+
62+
1. Click **Register**.
63+
1. Copy the **Application (client) ID** value. You will need this when you [Update the project](#update-the-project).
64+
65+
#### Configure Authentication
66+
67+
1. Go to **Authentication**.
68+
1. Under **Implicit grant and hybrid flows**, select both of the following options:
69+
70+
- Access tokens (used for implicit flows)
71+
- ID tokens (used for implicit and hybrid flows)
72+
73+
1. Click **Save**.
74+
75+
#### Configure Permissions
76+
77+
1. Go to **API permissions**.
78+
1. Click **Add a permission**.
79+
1. In the **Request API permissions** fly-out, under the**Microsoft APIs** tab, select **Dynamics CRM**.
80+
1. Under **Select permissions**, select **user_impersonation**.
81+
1. Click **Add permissions**.
82+
1. Under **Configured permissions**, click **Grant admin consent** for {Your tenant name.}
83+
1. In the **Grant admin consent** confirmation dialog, click **Yes**.
84+
85+
#### Update the project
86+
87+
1. Open the BlazorCDS Visual Studio solution file (BlazorCDS.sln) with Visual Studio.
88+
1. In **Solution Explorer**, expand `wwwroot` and open the `appsettings.json` file.
89+
1. Replace the placeholder `ClientId` value (`11111111-1111-1111-1111-111111111111`) with the application (client) ID value you copied in [Create an app registration](#create-an-app-registration).
90+
91+
#### Run the sample
92+
93+
In Visual Studio, click **IIS Express** to run the sample.
94+
95+
### Demonstrate
96+
97+
1. In the browser window that opens with the app, click **Log in**.
98+
1. Enter your credentials and you will see a select control with the label: **Choose an Environment**. The select control should list all the environments you have access to with the credentials you provided.
99+
1. Click **Fetch Accounts**. This should display a list of account records you have access to view in the selected environment.
100+
1. If you have more than one environment to choose from, select a different environment and the list of account records will be refreshed to represent the records available in that environment.
101+
102+
### Clean up
103+
104+
This sample makes no changes to data in your environment.
105+
106+
### See Also
107+
108+
[Discover user organizations](discovery-service.md)<br />
109+
[Sample: Global Discovery Service (C#)](sample-global-discovery-service-csharp.md)
110+
111+
112+
[!INCLUDE [footer-banner](../../includes/footer-banner.md)]

powerapps-docs/developer/data-platform/org-service/samples/access-discovery-service.md renamed to powerapps-docs/developer/data-platform/sample-discovery-service-crmserviceclient.md

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
2-
title: "Sample: Work with discovery service (Microsoft Dataverse) | Microsoft Docs" # Intent and product brand in a unique string of 43-59 chars including spaces
2+
title: "Sample: Use CrmServiceClient to access the Global Discovery Service (Microsoft Dataverse) | Microsoft Docs" # Intent and product brand in a unique string of 43-59 chars including spaces
33
description: "This sample code shows how to use discovery services" # 115-145 characters including spaces. This abstract displays in the search result.
4-
ms.date: 04/03/2022
4+
ms.date: 07/18/2022
55
author: JimDaly
66
ms.author: jdaly
77
manager: kvivek
@@ -15,9 +15,13 @@ contributors:
1515
- JimDaly
1616
- phecke
1717
---
18-
# Sample: Access the Discovery service
18+
# Sample: Use CrmServiceClient to access the Global Discovery Service
1919

20-
This sample code shows how to use the discovery service with SDK assemblies. You can download the sample from [here](https://github.com/Microsoft/PowerApps-Samples/tree/master/cds/orgsvc/C%23/DiscoveryService)
20+
This sample code shows how to use the discovery service with the <xref:Microsoft.Xrm.Tooling.Connector.CrmServiceClient.DiscoverGlobalOrganizations%2A?text=CrmServiceClient.DiscoverGlobalOrganizations Method>. You can download the sample from [here](https://github.com/Microsoft/PowerApps-Samples/tree/master/cds/orgsvc/C%23/DiscoveryService)
21+
22+
> [!NOTE]
23+
> This sample is limited to .NET Full Framework.
24+
> There is a newer sample compatible with .NET Core using the <xref:Microsoft.PowerPlatform.Dataverse.Client.ServiceClient.DiscoverOnlineOrganizationsAsync%2A?text=Dataverse.Client.ServiceClient.DiscoverOnlineOrganizationsAsync Method>. See [Sample: Global Discovery Service (C#)](sample-global-discovery-service-csharp.md).
2125
2226
## How to run this sample
2327

@@ -61,5 +65,11 @@ In SampleMethods.cs there is a `Clouds` enumeration for each of the known global
6165

6266
This sample creates no records. No cleanup is required.
6367

68+
### See Also
69+
70+
[Discover user organizations](discovery-service.md)<br />
71+
[Sample: Global Discovery Service (C#)](sample-global-discovery-service-csharp.md)<br />
72+
[Sample: Blazor WebAssembly with Global Discovery](sample-blazor-web-assembly-global-discovery.md)
73+
6474

65-
[!INCLUDE[footer-include](../../../../includes/footer-banner.md)]
75+
[!INCLUDE [footer-banner](../../includes/footer-banner.md)]

0 commit comments

Comments
 (0)