From 14f812fa6053e24e404f9b59387c8c7c3e6d88c2 Mon Sep 17 00:00:00 2001 From: Owen Richards <91555661+OwenRichards1@users.noreply.github.com> Date: Wed, 16 Oct 2024 11:02:38 +0100 Subject: [PATCH] console+desktop-update (#98) * console+desktop-update * remove-portal-refs * fix-tempaltes --- console-cli/Program.cs | 4 ++-- console-cli/README.md | 9 ++++----- console-daemon/Program.cs | 6 +++--- console-daemon/README.md | 14 ++++++-------- desktop-winforms/MainWindow.cs | 20 ++++++++++---------- desktop-winforms/README.md | 25 ++++++++++--------------- desktop-winui/MainWindow.xaml.cs | 8 ++++---- desktop-winui/README.md | 6 +++--- desktop-winui/WinUIApp.csproj | 4 ++-- desktop-wpf/MainWindow.xaml.cs | 2 +- desktop-wpf/README.md | 4 ++-- spa-blazor-wasm/Program.cs | 2 +- spa-blazor-wasm/README.md | 2 +- web-api-azure-function/README.md | 8 ++++---- web-api-obo-client/README.md | 4 ++-- web-api-obo-user/README.md | 14 ++++++-------- web-api/README.md | 6 +++--- web-app-aspnet/README.md | 12 +++++------- web-app-aspnet/WebApp.csproj | 3 +-- web-app-blazor-server/README.md | 8 ++++---- web-app-blazor-server/appsettings.json | 6 +++--- xplat-maui/README.md | 2 +- 22 files changed, 78 insertions(+), 91 deletions(-) diff --git a/console-cli/Program.cs b/console-cli/Program.cs index 2fe7833..b776a2d 100644 --- a/console-cli/Program.cs +++ b/console-cli/Program.cs @@ -4,10 +4,10 @@ var config = new PublicClientApplicationOptions { - // 'Directory (tenant) ID' of the app registration in the Microsoft Entra Admin Center + // 'Directory (tenant) ID' of the app registration in the Microsoft Entra admin center TenantId = "Enter the client ID obtained from the Microsoft Entra admin center", - // 'Application (client) ID' of the app registration in the Microsoft Entra Admin Center + // 'Application (client) ID' of the app registration in the Microsoft Entra admin center ClientId = "Enter the tenant ID obtained from the Microsoft Entra admin center" }; diff --git a/console-cli/README.md b/console-cli/README.md index f97eb25..b8fd68c 100644 --- a/console-cli/README.md +++ b/console-cli/README.md @@ -13,10 +13,9 @@ products: urlFragment: ms-identity-docs-code-console-cli-csharp --- - # .NET (C#) | console | user sign-in, protected web API access (Microsoft Graph) | Microsoft identity platform -This .NET8 (C#) console application authenticates a user via the device code flow, and then makes a request to the Graph API as the authenticated user. The response to the request is printed to the console. +This .NET 8 (C#) console application authenticates a user via the device code flow, and then makes a request to the Graph API as the authenticated user. The response to the request is printed to the console. ```console $ dotnet run @@ -57,15 +56,15 @@ Use these settings in your app registration. | **Platform type** | _None_ | No redirect URI required; don't select a platform. | | **Allow public client flows** | **Yes** | Required value for this sample. | -> :information_source: **Bold text** in the tables above matches (or is similar to) a UI element in the Azure portal, while `code formatting` indicates a value you enter into a text box in the Azure portal. +> :information_source: **Bold text** in the tables above matches (or is similar to) a UI element in the Microsoft Entra admin center, while `code formatting` indicates a value you enter into a text box in the Microsoft Entra admin center. ### 2. Update the _Program.cs_ file with app registration values ```csharp -// 'Directory (tenant) ID' of app registration in the Azure portal - this value is a GUID +// 'Directory (tenant) ID' of app registration in the Microsoft Entra admin center - this value is a GUID TenantId = "", -// 'Application (client) ID' of app registration in Azure portal - this value is a GUID +// 'Application (client) ID' of app registration in Microsoft Entra admin center - this value is a GUID ClientId = "" ``` diff --git a/console-daemon/Program.cs b/console-daemon/Program.cs index cd845ed..d92b14f 100644 --- a/console-daemon/Program.cs +++ b/console-daemon/Program.cs @@ -7,11 +7,11 @@ var config = new { // Full directory URL, in the form of https://login.microsoftonline.com/ Authority = " https://login.microsoftonline.com/Enter the tenant ID obtained from the Microsoft Entra admin center", - // 'Enter the client ID obtained from the Microsoft Entra Admin Center + // Enter the client ID obtained from the Microsoft Entra admin center ClientId = "Enter the client ID obtained from the Microsoft Entra admin center", - // Client secret 'Value' (not its ID) from 'Client secrets' in the Microsoft Entra Admin Center + // Client secret 'Value' (not its ID) from 'Client secrets' in the Microsoft Entra admin center ClientSecret = "Enter the client secret value obtained from the Microsoft Entra admin center", - // Client 'Object ID' of app registration in Microsoft Entra Admin Center - this value is a GUID + // Client 'Object ID' of app registration in Microsoft Entra admin center - this value is a GUID ClientObjectId = "Enter the client Object ID obtained from the Microsoft Entra admin center" }; diff --git a/console-daemon/README.md b/console-daemon/README.md index ada4bf6..eb31dbe 100644 --- a/console-daemon/README.md +++ b/console-daemon/README.md @@ -1,4 +1,3 @@ - - + # .NET | console | .NET (C#) console app that accesses a protected web API access (Microsoft Graph) | Microsoft identity platform @@ -59,7 +57,7 @@ Use these settings in your app registration. | **Platform type** | _None_ | No redirect URI required; don't select a platform. | | **Client secret** | _**Value** of the client secret (not its ID)_ | :warning: Record this value immediately!
It's shown only _once_ (when you create it). | -> :information_source: **Bold text** in the tables above matches (or is similar to) a UI element in the Azure portal, while `code formatting` indicates a value you enter into a text box in the Azure portal. +> :information_source: **Bold text** in the tables above matches (or is similar to) a UI element in the Microsoft Entra admin center, while `code formatting` indicates a value you enter into a text box in the Microsoft Entra admin center. ### 2. Update application code with values from app registration @@ -68,11 +66,11 @@ In _Program.cs_, update each variable with values from the app registration you ```csharp // Full directory URL, in the form of https://login.microsoftonline.com/ Authority = " https://login.microsoftonline.com/Enter the tenant ID obtained from the Microsoft Entra admin center", -// 'Enter the client ID obtained from the Microsoft Entra Admin Center +// 'Enter the client ID obtained from the Microsoft Entra admin center ClientId = "Enter the client ID obtained from the Microsoft Entra admin center", -// Client secret 'Value' (not its ID) from 'Client secrets' in the Microsoft Entra Admin Center +// Client secret 'Value' (not its ID) from 'Client secrets' in the Microsoft Entra admin center ClientSecret = "Enter the client secret value obtained from the Microsoft Entra admin center", -// Client 'Object ID' of app registration in Microsoft Entra Admin Center - this value is a GUID +// Client 'Object ID' of app registration in Microsoft Entra admin center - this value is a GUID ClientObjectId = "Enter the client Object ID obtained from the Microsoft Entra admin center" ``` @@ -118,7 +116,7 @@ If you can't get the sample working, you've checked [Stack Overflow](http://stac ### All other issues > :warning: WARNING: Any issue in this repository _not_ limited to running one of its sample apps will be closed without being addressed. -For all other requests, see [Support and help options for developers | Microsoft identity platform](https://docs.microsoft.com/azure/active-directory/develop/developer-support-help-options). +For all other requests, see [Support and help options for developers | Microsoft identity platform](https://learn.microsoft.com/entra/identity-platform/developer-support-help-options). ## Contributing diff --git a/desktop-winforms/MainWindow.cs b/desktop-winforms/MainWindow.cs index e2df887..4c5ade4 100644 --- a/desktop-winforms/MainWindow.cs +++ b/desktop-winforms/MainWindow.cs @@ -23,22 +23,22 @@ public MainWindow() msalPublicClientApp = PublicClientApplicationBuilder .CreateWithApplicationOptions(new PublicClientApplicationOptions { - // 'Tenant ID' of your Microsoft Entra instance - this value is a GUID - TenantId = "", + // Enter the tenant ID obtained from the Microsoft Entra admin center + TenantId = "Enter the client ID obtained from the Microsoft Entra admin center", - // 'Application (client) ID' of app registration in Azure portal - this value is a GUID - ClientId = "" + // Enter the client ID obtained from the Microsoft Entra admin center + ClientId = "Enter the tenant ID obtained from the Microsoft Entra admin center" }) .WithDefaultRedirectUri() // http://localhost .Build(); } - /// - /// Handle the "Sign In" button click. This will acquire an access token scoped to - /// Microsoft Graph, either from the cache or from an interactive session. It will - /// then use that access token in an HTTP request to Microsoft Graph and display - /// the results. - /// + // + // Handle the "Sign In" button click. This will acquire an access token scoped to + // Microsoft Graph, either from the cache or from an interactive session. It will + // then use that access token in an HTTP request to Microsoft Graph and display + // the results. + // private async void SignInButton_Click(object sender, EventArgs e) { AuthenticationResult? msalAuthenticationResult = null; diff --git a/desktop-winforms/README.md b/desktop-winforms/README.md index 039649e..81d4374 100644 --- a/desktop-winforms/README.md +++ b/desktop-winforms/README.md @@ -15,10 +15,6 @@ urlFragment: ms-identity-docs-code-app-csharp-winforms # .NET | Windows Forms | user sign-in, protected web API access (Microsoft Graph) | Microsoft identity platform - - This .NET Windows Forms application authenticates a user and then makes a request to the Graph API as the authenticated user. The response to the request is presented to the user. ![A screenshot of a Windows Forms application displaying a response from Microsoft Graph.](./app.png) @@ -43,7 +39,7 @@ Use these settings in your app registration. | **Platform type** | **Mobile and desktop applications** | Required value for this sample | | **Redirect URIs** | `http://localhost` | Required value for this sample | -> :information_source: **Bold text** in the tables above matches (or is similar to) a UI element in the Azure portal, while `code formatting` indicates a value you enter into a text box in the Azure portal. +> :information_source: **Bold text** in the tables above matches (or is similar to) a UI element in the Microsoft Entra admin center, while `code formatting` indicates a value you enter into a text box in the Microsoft Entra admin center. ### 2. Open the project in Visual Studio @@ -54,16 +50,16 @@ Next, open the _MsalExamples.csproj_ project in Visual Studio. Finally, set the following values in _MainWindow.cs_. ```csharp -// 'Tenant ID' of your Microsoft Entra instance - this value is a GUID -TenantId = "", +// Enter the tenant ID obtained from the Microsoft Entra admin center +TenantId = "Enter the client ID obtained from the Microsoft Entra admin center", -// 'Application (client) ID' of app registration in Azure portal - this value is a GUID -ClientId = "" +// Enter the client ID obtained from the Microsoft Entra admin center +ClientId = "Enter the tenant ID obtained from the Microsoft Entra admin center" ``` ## Run the application -Run the application by pressing F5 in Visual Studio. +Run the application by pressing **F5** in Visual Studio. The appliction will open allowing you to click the **Sign In (if needed) & Call Graph** button to use the authentication flow. @@ -71,7 +67,7 @@ The appliction will open allowing you to click the **Sign In (if needed) & Call ## About the code -This .NET 8 Windows Forms application presents a button that initiates an authentication flow using the Microsoft Authentication Library (MSAL). The user completes this flow in their default web browser. Upon successful authentication, an HTTP GET request to the Microsoft Graph /me endpoint is issued with the user's access token in the HTTP header. The response from the GET request is then displayed to the user. The MSAL client first looks to its token cache, refreshing if necessary, before acquiring a new access token. +This .NET 8 Windows Forms application presents a button that initiates an authentication flow using the Microsoft Authentication Library (MSAL). The user completes this flow in their default web browser. Upon successful authentication, an HTTP GET request to the Microsoft Graph /me endpoint is issued with the user's access token in the HTTP header. The response from the GET request is then displayed to the user. The MSAL client first looks to its token cache, refreshing if necessary, before acquiring a new access token. ## Reporting problems @@ -79,14 +75,13 @@ This .NET 8 Windows Forms application presents a button that initiates an authen If you can't get the sample working, you've checked [Stack Overflow](http://stackoverflow.com/questions/tagged/msal), and you've already searched the issues in this sample's repository, open an issue report the problem. -1. Search the [GitHub issues](/issues) in the repository - your problem might already have been reported or have an answer. -1. Nothing similar? [Open an issue](/issues/new) that clearly explains the problem you're having running the sample app. +1. Search the [GitHub issues](../../issues) in the repository - your problem might already have been reported or have an answer. +1. Nothing similar? [Open an issue](../../issues/new) that clearly explains the problem you're having running the sample app. ### All other issues > :warning: WARNING: Any issue in this repository _not_ limited to running one of its sample apps will be closed without being addressed. - -For all other requests, see [Support and help options for developers | Microsoft identity platform](https://docs.microsoft.com/azure/active-directory/develop/developer-support-help-options). +For all other requests, see [Support and help options for developers | Microsoft identity platform](https://learn.microsoft.com/entra/identity-platform/developer-support-help-options). ## Contributing diff --git a/desktop-winui/MainWindow.xaml.cs b/desktop-winui/MainWindow.xaml.cs index 851551b..3481488 100644 --- a/desktop-winui/MainWindow.xaml.cs +++ b/desktop-winui/MainWindow.xaml.cs @@ -32,11 +32,11 @@ public MainWindow() msalPublicClientApp = PublicClientApplicationBuilder .CreateWithApplicationOptions(new PublicClientApplicationOptions { - // 'Tenant ID' of your Microsoft Entra instance - this value is a GUID - TenantId = "", + // Enter the tenant ID obtained from the Microsoft Entra admin center + TenantId = "Enter the tenant ID obtained from the Microsoft Entra admin center", - // 'Application (client) ID' of app registration in Azure portal - this value is a GUID - ClientId = "" + // Enter the client ID obtained from the Microsoft Entra admin center + ClientId = "Enter the client ID obtained from the Microsoft Entra admin center" }) .WithDefaultRedirectUri() .Build(); diff --git a/desktop-winui/README.md b/desktop-winui/README.md index a497892..1228fc3 100644 --- a/desktop-winui/README.md +++ b/desktop-winui/README.md @@ -43,11 +43,11 @@ Use these settings in your app registration. | **Platform type** | **Mobile and desktop applications** | Required value for this sample | | **Redirect URIs** | `https://login.microsoftonline.com/common/oauth2/nativeclient` | Required value for this sample | -> :information_source: **Bold text** in the tables above matches (or is similar to) a UI element in the Azure portal, while `code formatting` indicates a value you enter into a text box in the Azure portal. +> :information_source: **Bold text** in the tables above matches (or is similar to) a UI element in the Microsoft Entra admin center, while `code formatting` indicates a value you enter into a text box in the Microsoft Entra admin center. ### 2. Open the project in Visual Studio -Next, open the _MsalExamples.csproj_ project in Visual Studio. +Next, open the _WinUIApp.csproj_ project in Visual Studio. ### 3. Update code sample in _MainWindow.xaml.cs_ with app registration values @@ -58,7 +58,7 @@ Finally, set the following values in _MainWindow.xaml.cs_. // 'Tenant ID' of your Microsoft Entra instance - this value is a GUID TenantId = "", -// 'Application (client) ID' of app registration in Azure portal - this value is a GUID +// 'Application (client) ID' of app registration in Microsoft Entra admin center - this value is a GUID ClientId = "" ``` diff --git a/desktop-winui/WinUIApp.csproj b/desktop-winui/WinUIApp.csproj index a2c169c..02d1678 100644 --- a/desktop-winui/WinUIApp.csproj +++ b/desktop-winui/WinUIApp.csproj @@ -1,7 +1,7 @@  WinExe - net8.0-windows10.0.19041.0 + net8.0-windows10.0.17763.0 10.0.17763.0 WinUIApp app.manifest @@ -36,6 +36,6 @@ Tools extension to be activated for this project even if the Windows App SDK Nuget package has not yet been restored --> - + diff --git a/desktop-wpf/MainWindow.xaml.cs b/desktop-wpf/MainWindow.xaml.cs index 9f2d258..15448d4 100644 --- a/desktop-wpf/MainWindow.xaml.cs +++ b/desktop-wpf/MainWindow.xaml.cs @@ -31,7 +31,7 @@ public MainWindow() // 'Tenant ID' of your Microsoft Entra instance - this value is a GUID TenantId = "", - // 'Application (client) ID' of app registration in Azure portal - this value is a GUID + // 'Application (client) ID' of app registration in Microsoft Entra admin center - this value is a GUID ClientId = "" }) .WithDefaultRedirectUri() // http://localhost diff --git a/desktop-wpf/README.md b/desktop-wpf/README.md index 79bc918..ee5dd4f 100644 --- a/desktop-wpf/README.md +++ b/desktop-wpf/README.md @@ -43,7 +43,7 @@ Use these settings in your app registration. | **Platform type** | **Mobile and desktop applications** | Required value for this sample | | **Redirect URIs** | `http://localhost` | Required value for this sample | -> :information_source: **Bold text** in the tables above matches (or is similar to) a UI element in the Azure portal, while `code formatting` indicates a value you enter into a text box in the Azure portal. +> :information_source: **Bold text** in the tables above matches (or is similar to) a UI element in the Microsoft Entra admin center, while `code formatting` indicates a value you enter into a text box in the Microsoft Entra admin center. ### 2. Open the project in Visual Studio @@ -57,7 +57,7 @@ Finally, set the following values in _MainWindow.xaml.cs_. // 'Tenant ID' of your Microsoft Entra instance - this value is a GUID TenantId = "", -// 'Application (client) ID' of app registration in Azure portal - this value is a GUID +// 'Application (client) ID' of app registration in Microsoft Entra admin center - this value is a GUID ClientId = "" ``` diff --git a/spa-blazor-wasm/Program.cs b/spa-blazor-wasm/Program.cs index d4fe526..1bb3c8c 100644 --- a/spa-blazor-wasm/Program.cs +++ b/spa-blazor-wasm/Program.cs @@ -26,4 +26,4 @@ return new HttpClient(authorizationMessageHandler); }); -await builder.Build().RunAsync(); +await builder.Build().RunAsync(CoreDispatcherPriority.Normal); diff --git a/spa-blazor-wasm/README.md b/spa-blazor-wasm/README.md index 951daa6..b3b83bd 100644 --- a/spa-blazor-wasm/README.md +++ b/spa-blazor-wasm/README.md @@ -43,7 +43,7 @@ Use the following settings for your app registration: | **Platform type** | `Single-page application` | Required value for this sample.
Enables the required and optional settings for the app type. | | **Redirect URIs** | `http://localhost:5000/authentication/login-callback` | Required value for this sample.
You can change that later in your own implementation. | -> :information_source: **Bold text** in the table matches (or is similar to) a UI element in the Azure portal, while `code formatting` indicates a value you enter into a text box or select in the Azure portal. +> :information_source: **Bold text** in the table matches (or is similar to) a UI element in the Microsoft Entra admin center, while `code formatting` indicates a value you enter into a text box or select in the Microsoft Entra admin center. ### 2. Configure the web app diff --git a/web-api-azure-function/README.md b/web-api-azure-function/README.md index eb1a934..5212ce9 100644 --- a/web-api-azure-function/README.md +++ b/web-api-azure-function/README.md @@ -50,7 +50,7 @@ Use these settings in your app registration. | **Platform type** | _None_ | No redirect URI required; don't select a platform. | | **Scopes defined by this API** | **Scope name**: `Greeting.Read`
**Who can consent?**: **Admins and users**
**Admin consent display name**: `Read API Greetings`
**Admin consent description**: `Allows the user to see greetings from the API.`
**User consent display name**: `Read API Greetings`
**User consent description**: `Allows you to see greetings from the API.`
**State**: **Enabled** | Required scope for this sample. | -> :information_source: **Bold text** in the table matches (or is similar to) a UI element in the Azure portal, while `code formatting` indicates a value you enter into a text box in the Azure portal. +> :information_source: **Bold text** in the table matches (or is similar to) a UI element in the Microsoft Entra admin center, while `code formatting` indicates a value you enter into a text box in the Microsoft Entra admin center. ### 2. Enable Function app authentication @@ -62,15 +62,15 @@ Use these settings in your identity provider configuration. |--------------------------------:|:--------------------------------------------------------|:---------------------------------------------------------------------------------| | **Identity provider** | **Microsoft** | Required value for this sample. | | **App registration type** | **Provide the details of an existing app registration** | Required value for this sample. | -| **Application (client) ID** | `` | Required value for this sample.
'Application (client) ID' of the API's app registration in Azure portal - this value is a GUID | +| **Application (client) ID** | `` | Required value for this sample.
'Application (client) ID' of the API's app registration in Microsoft Entra admin center - this value is a GUID | | **Client secret (recommended)** | _None_ | Suggested value for this sample.
This sample doesn't require this feature. | | **Issuer URL** | `https://login.microsoftonline.com//v2.0` | Required value for this sample.
Update to include 'Tenant ID' of your Microsoft Entra instance - this value is a GUID | -| **Allowed token audiences** | `api://` | Required value for this sample.
'Application ID URI' of app registration in Azure portal - this value typically starts with api:// | +| **Allowed token audiences** | `api://` | Required value for this sample.
'Application ID URI' of app registration in Microsoft Entra admin center - this value typically starts with api:// | | **Restrict access** | **Require authentication** | Required value for this sample. | | **Unauthenticated requests** | **HTTP 401 Unauthorized: recommended for APIs** | Suggested value for this sample. | | **Token store** | _Unselected_ | Suggested value for this sample. | -> :information_source: **Bold text** in the table matches (or is similar to) a UI element in the Azure portal, while `code formatting` indicates a value you enter into a text box in the Azure portal. +> :information_source: **Bold text** in the table matches (or is similar to) a UI element in the Microsoft Entra admin center, while `code formatting` indicates a value you enter into a text box in the Microsoft Entra admin center. ### 3. Deploy the Functions app diff --git a/web-api-obo-client/README.md b/web-api-obo-client/README.md index b37a5e3..8c236bc 100644 --- a/web-api-obo-client/README.md +++ b/web-api-obo-client/README.md @@ -70,11 +70,11 @@ Use these settings in your app registration. | **Platform type** | _None_ | No redirect URI required; don't select a platform. | | **Client secret** | _**Value** of the client secret (not its ID)_ | :warning: Record this value immediately!
It's shown only _once_ (when you create it). | -> :information_source: **Bold text** in the tables above matches (or is similar to) a UI element in the Azure portal, while `code formatting` indicates a value you enter into a text box in the Azure portal. +> :information_source: **Bold text** in the tables above matches (or is similar to) a UI element in the Microsoft Entra admin center, while `code formatting` indicates a value you enter into a text box in the Microsoft Entra admin center. ### 2. Configure the web API -Open the _~/msal-client-credentials-flow/appsettings.json_ file in your code editor and modify the following values values with those from your [app's registration in the Azure portal](https://docs.microsoft.com/azure/active-directory/develop/quickstart-register-app#register-an-application): +Open the _~/msal-client-credentials-flow/appsettings.json_ file in your code editor and modify the following values values with those from your [app's registration in the Microsoft Entra admin center](https://docs.microsoft.com/azure/active-directory/develop/quickstart-register-app#register-an-application): ```json "ClientId": "Enter_the_Application_Id_here", diff --git a/web-api-obo-user/README.md b/web-api-obo-user/README.md index ed96ff5..8c2c75a 100644 --- a/web-api-obo-user/README.md +++ b/web-api-obo-user/README.md @@ -47,8 +47,6 @@ $ curl https://localhost:5001/api/me -H "Authorization: Bearer {valid-access-tok ## Setup - - ### 1. Register the web API application in Microsoft Entra ID First, complete the steps in [Configure an application to expose a web API](https://docs.microsoft.com/azure/active-directory/develop/quickstart-register-app) to register the sample API and expose a scope. @@ -57,14 +55,14 @@ Use the following settings for your app registration: | App registration
setting | Value for this sample app | Notes | |------------------------------:|:--------------------------------------------------------------------|:------------------------------------------------------------------------------------------------------------| -| **Name** | `active-directory-protected-api-access-protected-api` | Suggested value for this sample.
You can change the app name at any time. | +| **Name** | `protected-api-access-protected-api` | Suggested value for this sample.
You can change the app name at any time. | | **Supported account types** | **Accounts in this organizational directory only (Single tenant)** | Required for this sample.
Support for the Single tenant. | -| **Identifier URI** | `api://{clientId}` | Suggested value for this sample.
You must change the client id using the Value shown in Azure portal. | +| **Identifier URI** | `api://{clientId}` | Suggested value for this sample.
You must change the client id using the Value shown in the Microsoft Entra admin center. | | **Expose an API** | **Scope name**: `user_impersonation`
**Who can consent?**: **Admins and users**
**Admin consent display name**: `Act on behalf of the user`
**Admin consent description**: `Allows the API to act on behalf of the user.`
**User consent display name**: `Act on your behalf`
**User consent description**: `Allows the API to act on your behalf.`
**State**: **Enabled** | Add a new scope that reads as follows `api://{clientId}/user_impersonation`. Required value for this sample. | | **API Permissions** | `https://graph.microsoft.com/User.Read` | Add a new delegated permission for `Microsoft Graph User.Read`. Required value for this sample. | -| **Client secret** | _Value shown in Azure portal_ | :warning: Record this value immediately!
It's shown only _once_ (when you create it). | +| **Client secret** | _Value shown in Microsoft Entra admin center_ | :warning: Record this value immediately!
It's shown only _once_ (when you create it). | -> :information_source: **Bold text** in the table matches (or is similar to) a UI element in the Azure portal, while `code formatting` indicates a value you enter into a text box or select in the Azure portal. +> :information_source: **Bold text** in the table matches (or is similar to) a UI element in the Microsoft Entra admin center, while `code formatting` indicates a value you enter into a text box or select in the Microsoft Entra admin center. @@ -80,9 +78,9 @@ Use the following settings for your app registration: | **Supported account types** | **Accounts in this organizational directory only (Single tenant)** | Required for this sample.
Support for the Single tenant. | | **Platform type** | **Web** | Required value for this sample.
Enables the required and optional settings for the app type. | | **API Permissions** | `api://{clientId}/user_impersonation` | Add a delegated type permission by searching within the APIs using the new Application (client) ID from the previous step. Then select the `user_impersonation`. Required value for this sample. | -| **Client secret** | _Value shown in Azure portal_ | :warning: Record this value immediately!
It's shown only _once_ (when you create it). | +| **Client secret** | _Value shown in Microsoft Entra admin center_ | :warning: Record this value immediately!
It's shown only _once_ (when you create it). | -> :information_source: **Bold text** in the table matches (or is similar to) a UI element in the Azure portal, while `code formatting` indicates a value you enter into a text box or select in the Azure portal. +> :information_source: **Bold text** in the table matches (or is similar to) a UI element in the Microsoft Entra admin center, while `code formatting` indicates a value you enter into a text box or select in the Microsoft Entra admin center. ### 3. Go back to the recently registered web API application diff --git a/web-api/README.md b/web-api/README.md index 04d7e3d..b949847 100644 --- a/web-api/README.md +++ b/web-api/README.md @@ -38,7 +38,7 @@ Use the following settings for your web API's app registration: | **Supported account types** | **Accounts in this organizational directory only (Single tenant)** | Required for this sample.

Tells the identity platform which identities this application supports; affects how security tokens like ID and access tokens are requested, formatted, and issued. | | **Application ID URI** | `api://{APPLICATION_CLIENT_ID}` | Suggested value for this sample.

Replace `{APPLICATION_CLIENT_ID}` with the web API's **Application (client) ID**. | -> :information_source: **Bold text** refers to a UI element in the Azure portal and `code formatting` indicates a value to enter or accept. +> :information_source: **Bold text** refers to a UI element in the Microsoft Entra admin center and `code formatting` indicates a value to enter or accept. ### 2. Add scopes @@ -53,8 +53,8 @@ Add the following scopes by using **Expose an API** in the web API's app registr In the _./appsettings.json_ file, replace these `{PLACEHOLDER}` values with the corresponding values from your web API's app registration: ```json -"ClientId": "Enter the client ID obtained from the Microsoft Entra Admin Center", -"TenantId": "Enter the tenant ID obtained from the Microsoft Entra Admin Center", +"ClientId": "Enter the client ID obtained from the Microsoft Entra admin center", +"TenantId": "Enter the tenant ID obtained from the Microsoft Entra admin center", ``` For example: diff --git a/web-app-aspnet/README.md b/web-app-aspnet/README.md index 812ad4d..ef631f6 100644 --- a/web-app-aspnet/README.md +++ b/web-app-aspnet/README.md @@ -19,19 +19,17 @@ This web app, built with ASP.NET Core 8.0 Razor, has added sign-in features. It ## Quickstart and tutorial guides for this sample -- For a quickstart experience that gets you started fast, see [Quickstart: Sign in users and call the Microsoft Graph API from an ASP.NET Core web app](https://docs.microsoft.com/entra/identity-platform/tutorial-web-app-dotnet-register-app). +- For a quickstart experience that gets you started fast, see [Quickstart: Sign in users and call the Microsoft Graph API from an ASP.NET Core web app](https://learn.microsoft.com/entra/identity-platform/quickstart-web-app-dotnet-core-sign-in). - For a in-depth tutorial that walks you through this sample from start to finish, see [Tutorial: Sign in users and call the Microsoft Graph API from an ASP.NET Core web app](https://docs.microsoft.com/entra/identity-platform/tutorial-web-app-dotnet-register-app). ## Prerequisites - An Azure account with an active subscription. If you don't already have one, [Create an account for free](https://azure.microsoft.com/free/?WT.mc_id=A261C142F). -- [.NET SDK](https://dotnet.microsoft.com/download) +- [.NET 8.0 SDK](https://dotnet.microsoft.com/download) ## Setup - - ### 1. Register the web API application in your Microsoft Entra ID First, complete the steps in [Register an application with the Microsoft identity platform](https://docs.microsoft.com/entra/identity-platform/tutorial-web-app-dotnet-register-app) to register a web application in the Microsoft identity platform. @@ -56,13 +54,13 @@ Use the following settings for your app registration: ```json "Instance": "https://login.microsoftonline.com/", - "TenantId": "Enter the tenant ID obtained from the Microsoft Entra Admin Center", - "ClientId": "Enter the client ID obtained from the Microsoft Entra Admin Center", + "TenantId": "Enter the tenant ID obtained from the Microsoft Entra admin center", + "ClientId": "Enter the client ID obtained from the Microsoft Entra admin center", "ClientCertificates": [ { "SourceType": "StoreWithThumbprint", "CertificateStorePath": "CurrentUser/My", - "CertificateThumbprint": "Enter the certificate thumbprint obtained the Microsoft Entra Admin Center" + "CertificateThumbprint": "Enter the certificate thumbprint obtained the Microsoft Entra admin center" } ], ``` diff --git a/web-app-aspnet/WebApp.csproj b/web-app-aspnet/WebApp.csproj index 1f984ff..19f6bf8 100644 --- a/web-app-aspnet/WebApp.csproj +++ b/web-app-aspnet/WebApp.csproj @@ -3,12 +3,11 @@ net8.0 enable enable - aspnet-sign_in_webapp-B0B85736-C285-4B12-8C9F-8E3C25987A0A sign_in_webapp - + \ No newline at end of file diff --git a/web-app-blazor-server/README.md b/web-app-blazor-server/README.md index 102ad10..2636ad7 100644 --- a/web-app-blazor-server/README.md +++ b/web-app-blazor-server/README.md @@ -44,7 +44,7 @@ Use these settings in your app registration. | **Platform type** | **Web** | Required value for this sample | | **Redirect URIs** | `http://localhost:5000/signin-oidc` | Required value for this sample | -> :information_source: **Bold text** in the tables above matches (or is similar to) a UI element in the Azure portal, while `code formatting` indicates a value you enter into a text box in the Azure portal. +> :information_source: **Bold text** in the tables above matches (or is similar to) a UI element in the Microsoft Entra admin center, while `code formatting` indicates a value you enter into a text box in the Microsoft Entra admin center. ### 2. Open the project in your code editor @@ -55,9 +55,9 @@ Next, open the _Api.csproj_ project under the the sign-in-blazorserver folder in In _appsettings.json_, update each variable with values from the app registration you created earlier. ```json -"TenantId": "[Enter 'common', or 'organizations' or the Tenant ID obtained from the Azure portal]", -"ClientId": "[Enter the Client Id (Application ID) obtained from the Azure portal]", -"ClientSecret": "[Copy the client secret added to the app from the Azure portal]", +"TenantId": "[Enter 'common', or 'organizations' or the Tenant ID obtained from the Microsoft Entra admin center]", +"ClientId": "[Enter the Client Id (Application ID) obtained from the Microsoft Entra admin center]", +"ClientSecret": "[Copy the client secret added to the app from the Microsoft Entra admin center]", ``` ## Run the application diff --git a/web-app-blazor-server/appsettings.json b/web-app-blazor-server/appsettings.json index 4943e71..2d1e1e4 100644 --- a/web-app-blazor-server/appsettings.json +++ b/web-app-blazor-server/appsettings.json @@ -7,9 +7,9 @@ For more info see https://aka.ms/dotnet-template-ms-identity-platform */ "AzureAd": { "Instance": "https://login.microsoftonline.com/", - "TenantId": "[Enter 'common', or 'organizations' or the Tenant ID (Obtained from the Azure portal. Select 'Endpoints' from the 'App registrations' blade and use the GUID in any of the URLs), e.g. da41245a5-11b3-996c-00a8-4d99re19f292]", - "ClientId": "[Enter the Client Id (Application ID obtained from the Azure portal), e.g. ba74781c2-53c2-442a-97c2-3d60re42f403]", - "ClientSecret": "[Copy the client secret added to the app from the Azure portal]", + "TenantId": "[Enter 'common', or 'organizations' or the Tenant ID (Obtained from the Microsoft Entra admin center. Select 'Endpoints' from the 'App registrations' blade and use the GUID in any of the URLs), e.g. da41245a5-11b3-996c-00a8-4d99re19f292]", + "ClientId": "[Enter the Client Id (Application ID obtained from the Microsoft Entra admin center), e.g. ba74781c2-53c2-442a-97c2-3d60re42f403]", + "ClientSecret": "[Copy the client secret added to the app from the Microsoft Entra admin center]", "CallbackPath": "/signin-oidc" }, "GraphApi": { diff --git a/xplat-maui/README.md b/xplat-maui/README.md index c03ca96..40b8bee 100644 --- a/xplat-maui/README.md +++ b/xplat-maui/README.md @@ -52,7 +52,7 @@ Use the following settings for your app registration: | **Platform type** | `Mobile and desktop applications` | Required value for this sample.
Enables the required and optional settings for the app type. | | **Redirect URI** | `https://login.microsoftonline.com/common/oauth2/nativeclient` | Required value for this sample.
You can change that later in your own implementation. | -> :information_source: **Bold text** in the table matches (or is similar to) a UI element in the Azure portal, while `code formatting` indicates a value you enter into a text box or select in the Azure portal. +> :information_source: **Bold text** in the table matches (or is similar to) a UI element in the Microsoft Entra admin center, while `code formatting` indicates a value you enter into a text box or select in the Microsoft Entra admin center. ### 2. Configure the MAUI app