You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: powerapps-docs/developer/common-data-service/walkthrough-blazor-webassembly-single-tenant.md
+95-97Lines changed: 95 additions & 97 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -58,24 +58,11 @@ Let’s make sure that your environment is configured properly, and you understa
58
58
59
59
### Get the CDS Web API URI
60
60
61
-
> [!NOTE]
62
-
> These instructions were valid when this content was written. The steps may change in the future.
63
-
64
-
1. When you have an environment with the database you want to connect to, select the **Settings** (Gear) icon and choose **Advanced settings**.
65
-
66
-
:::image type="content" source="media/blazor-webassembly-walkthrough-advanced-settings.png" alt-text="Navigating to the Advanced settings are from the maker portal":::
67
-
68
-
1. The Dynamics 365 settings app will open. Select **Settings** > **Customizations**.
61
+
You will need the Instance Web API Service Root URL. This is found on the Developer Resources page of your CDS environment.
69
62
70
-
:::image type="content" source="media/blazor-webassembly-walkthrough-settings-customizations.png" alt-text="Navigating to the customizations area in the Dynamics 365 settings area.":::
63
+
Follow the instructions found in [View or download developer resources](view-download-developer-resources.md)to copy the Url.
71
64
72
-
1. Then select **Developer Resources**.
73
-
74
-
:::image type="content" source="media/blazor-webassembly-walkthrough-developer-resources.png" alt-text="Navigating to the developer resources page.":::
75
-
76
-
1. Then copy the **Instance Web API Service Root URL**. You will need this in the [Step 3: Apply code changes](#step-3-apply-code-changes).
77
-
78
-
:::image type="content" source="media/blazor-webassembly-walkthrough-instance-web-api.png" alt-text="The developer resources page showing the Instance Web API URL":::
65
+
It will look something like this: `https://yourorgname.api.crm.dynamics.com/api/data/v9.1/`
79
66
80
67
### Navigate to the Azure Active Directory portal
81
68
@@ -101,9 +88,14 @@ The [Secure an ASP.NET Core Blazor WebAssembly standalone app with Azure Active
101
88
These steps will describe how to create an app registration in AAD and run a .NET Core CLI command to generate the scaffold for the basic app with support for AAD authentication.
102
89
103
90
> [!NOTE]
104
-
> At this time, you must use the .NET Core CLI command to generate the app. There is no template for this app when creating a project using Visual Studio.
91
+
> At this time, you must use the .NET Core CLI command to generate the app. There is no template for this specific type of app when creating a project using Visual Studio.
92
+
93
+
Go to [Secure an ASP.NET Core Blazor WebAssembly standalone app with Azure Active Directory](/aspnet/core/security/blazor/webassembly/standalone-with-azure-active-directory) and follow the instructions there to generate the basic app template.
105
94
106
-
The rest of the content in this section provides supplemental information to assist in completing the steps described in the [Secure an ASP.NET Core Blazor WebAssembly standalone app with Azure Active Directory](/aspnet/core/security/blazor/webassembly/standalone-with-azure-active-directory) topic.
95
+
> [!NOTE]
96
+
> The rest of the content in this section provides supplemental information to assist in completing the steps described in the [Secure an ASP.NET Core Blazor WebAssembly standalone app with Azure Active Directory](/aspnet/core/security/blazor/webassembly/standalone-with-azure-active-directory) topic.
97
+
>
98
+
> You may want to review this as you complete those steps, but it is not required. When you are done, come back here and start with [Step 3 Grant API permissions](#step-3-grant-api-permissions).
107
99
108
100
Registering the application involves completing a form. The default value for the Redirect URI includes a placeholder for the port value. You must replace the placeholder with a number value to complete the registration, for example, just add `1111` for now. You can provide the randomly generated port value later after you open the project in Visual Studio. See [Update callback URL](#update-callback-url).
109
101
@@ -158,7 +150,7 @@ Now that the Redirect URI has been updated; you should be able to press F5 in Vi
158
150
159
151
At this point, all the capabilities of the app work whether you log-in or not. Only members of the AAD tenant can log in.
160
152
161
-
###Grant API permissions
153
+
##Step 3: Grant API permissions
162
154
163
155
To connect to CDS, you must configure permissions for the app to connect.
164
156
@@ -183,12 +175,24 @@ To connect to CDS, you must configure permissions for the app to connect.
183
175
184
176
:::image type="content" source="media/blazor-webassembly-walkthrough-grant-admin-consent.png" alt-text="The button showing the optional button to grant admin consent for the registered application.":::
185
177
186
-
## Step 3: Apply code changes
178
+
## Step 4: Apply code changes
187
179
188
180
Apply changes to the following files to enable displaying CDS data in the application.
189
181
190
182
### \wwwroot\appsettings.json
191
183
184
+
You will find that this file already has configuration information generated by the template with information about the application registered in Azure AD. It will look like this:
Update the file to include a new `CDSWebAPI` section that includes the root of the **Instance Web API Service Root URL** you copied in the [Get the CDS Web API URI](#get-the-cds-web-api-uri) step.
193
197
194
198
> [!NOTE]
@@ -211,41 +215,39 @@ Update the file to include a new `CDSWebAPI` section that includes the root of t
211
215
212
216
### Program.cs
213
217
214
-
1. Comment out or remove the following line:
218
+
1. Install the `Microsoft.Extensions.Http` NuGet package.
219
+
1. In the solution explorer, right-click the project and select **Manage NuGet Packages...**.
220
+
1. Select **Browse** and search for `Microsoft.Extensions.Http`.
>ThislineenablesanHttpClienttoaccessJSONdatawithinthewebsitefor the Weather Forecast functionality. Changes in this walkthrough will break this functionality
223
+
:::image type="content" source="media/blazor-webassembly-walkthrough-install-microsoft.extensions.http-nuget-package.png" alt-text="Install the required NuGet package":::
221
224
222
-
1. Add the following code to replace the line commented out in step 1. This code will read configuration information from appsettings.json and enable an HttpClient to use for CDS Data.
225
+
1. Add the following code below the line that starts with `builder.Services.AddTransient(sp => new HttpClient...`
223
226
224
227
```csharp
228
+
// Get configuration data about the Web API set in wwwroot/appsettings.json
0 commit comments