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: 4-WebApp-your-API/4-1-MyOrg/README.md
+13-40Lines changed: 13 additions & 40 deletions
Original file line number
Diff line number
Diff line change
@@ -18,14 +18,13 @@ description: This sample demonstrates an ASP.NET Core Web App signing-in a user
18
18
19
19
*[Overview](#overview)
20
20
*[Scenario](#scenario)
21
-
*[Contents](#contents)
22
21
*[Prerequisites](#prerequisites)
23
22
*[Setup the sample](#setup-the-sample)
24
23
*[Explore the sample](#explore-the-sample)
25
24
*[Troubleshooting](#troubleshooting)
26
25
*[About the code](#about-the-code)
27
26
*[How the code was created](#how-the-code-was-created)
28
-
*[How to deploy this sample to Azure](#how-to-deploy-this-sample-to-azure)
27
+
*[Deploy the sample](#deploy-the-sample)
29
28
*[Next Steps](#next-steps)
30
29
*[Contributing](#contributing)
31
30
*[Learn More](#learn-more)
@@ -118,6 +117,7 @@ To manually register the apps, as a first step you'll need to:
118
117
1. Under **Supported account types**, select **Accounts in this organizational directory only**
119
118
1. Select **Register** to create the application.
120
119
1. In the **Overview** blade, find and note the **Application (client) ID**. You use this value in your app's configuration file(s) later in your code.
120
+
121
121
1. In the app's registration screen, select the **Expose an API** blade to the left to open the page where you can publish the permission as an API for which client applications can obtain [access tokens](https://aka.ms/access-tokens) for. The first thing that we need to do is to declare the unique [resource](https://docs.microsoft.com/azure/active-directory/develop/v2-oauth2-auth-code-flow) URI that the clients will be using to obtain access tokens for this API. To declare an resource URI(Application ID URI), follow the following steps:
122
122
1. Select **Set** next to the **Application ID URI** to generate a URI that is unique for this app.
123
123
1. For this sample, accept the proposed Application ID URI (`api://{clientId}`) by selecting **Save**. Read more about Application ID URI at [Validation differences by supported account types \(signInAudience\)](https://docs.microsoft.com/azure/active-directory/develop/supported-accounts-validation).
@@ -193,7 +193,9 @@ Open the project in your IDE (like Visual Studio or Visual Studio Code) to confi
193
193
1. Select one of the available key durations (**6 months**, **12 months** or **Custom**) as per your security posture.
194
194
1. The generated key value will be displayed when you select the **Add** button. Copy and save the generated value for use in later steps.
195
195
1. You'll need this key later in your code's configuration files. This key value will not be displayed again, and is not retrievable by any other means, so make sure to note it from the Azure portal before navigating to any other screen or blade.
196
-
> :bulb: For enhanced security, instead of using client secrets, consider [using certificates](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-node/docs/certificate-credentials.md) and [Azure KeyVault](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-node/docs/key-vault-managed-identity.md).1. Since this app signs-in users, we will now proceed to select **delegated permissions**, which is is required by apps signing-in users.
196
+
> :bulb: For enhanced security, instead of using client secrets, consider [using certificates](./README-use-certificate.md) and [Azure KeyVault](https://azure.microsoft.com/services/key-vault/#product-overview).
197
+
198
+
1. Since this app signs-in users, we will now proceed to select **delegated permissions**, which is is required by apps signing-in users.
197
199
1. In the app's registration screen, select the **API permissions** blade in the left to open the page where we add access to the APIs that your application needs:
198
200
1. Select the **Add a permission** button and then,
There is one web API in this sample. To deploy it to **Azure App Services**, you'll need to:
@@ -514,28 +513,17 @@ There is one web API in this sample. To deploy it to **Azure App Services**, you
514
513
515
514
##### Publish using Visual Studio
516
515
517
-
Follow the link to [Publish with Visual Studio](https://docs.microsoft.com/visualstudio/deployment/quickstart-deploy-to-azure?view=vs-2019).
516
+
Follow the link to [Publish with Visual Studio](https://docs.microsoft.com/visualstudio/deployment/quickstart-deploy-to-azure).
518
517
519
518
##### Publish using Visual Studio Code
520
519
521
-
1. Install the VS Code extension [Azure App Service](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-azureappservice).
522
-
1. Sign-in to App Service using Azure AD Account.
523
-
1. Open the TodoListService-aspnetcore-webapi project folder.
524
-
1. Choose View > Terminal from the main menu.
525
-
1. The terminal opens in the TodoListService-aspnetcore-webapi folder.
526
-
1. Run the following command:
527
-
528
-
```console
529
-
dotnet publish --configuration Release
530
-
```
531
-
532
-
1. Publish folder is created under path `bin/Release/<Enter_Framework_FolderName>`.
533
-
1. Right Click on **Publish** folder and select **Deploy to Web App**.
534
-
1. Select **Create New Web App**, enter unique name for the app.
535
-
1. Select **Windows** as the *OS*. Press **Enter**.
520
+
1. Install the Visual Studio Code extension [Azure App Service](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-azureappservice).
521
+
1. Follow the link to [Publish with Visual Studio Code](https://docs.microsoft.com/aspnet/core/tutorials/publish-to-azure-webapp-using-vscode?view=aspnetcore-6.0)
> :warning: the following steps are required only if you want your web API to be consumed by a single-page application (SPA). Learn more on [cross-origin resource sharing](https://developer.mozilla.org/docs/Web/HTTP/CORS).
526
+
539
527
1. Go to [Azure portal](https://portal.azure.com), and locate your project there.
540
528
- On the API tab, select **CORS**. Check the box **Enable Access-Control-Allow-Credentials**.
541
529
- Under **Allowed origins**, add the site URL of your published website **that will call this web API**.
@@ -556,22 +544,8 @@ Follow the link to [Publish with Visual Studio](https://docs.microsoft.com/visua
556
544
557
545
##### Publish using Visual Studio Code
558
546
559
-
1. Install the VS Code extension [Azure App Service](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-azureappservice).
560
-
1. Sign-in to App Service using Azure AD Account.
561
-
1. Open the TodoListClient-aspnetcore-webapi project folder.
562
-
1. Choose **View** > **Terminal** from the main menu.
563
-
1. The terminal opens in the TodoListClient-aspnetcore-webapi folder.
564
-
1. Run the following command:
565
-
566
-
```console
567
-
dotnet publish --configuration Release
568
-
```
569
-
570
-
1. Publish folder is created under path `bin/Release/<Enter_Framework_FolderName>`.
571
-
1. Right Click on **Publish** folder and select **Deploy to Web App**.
572
-
1. Select **Create New Web App**, enter a unique name for the app.
573
-
1. Select **Windows** as the *OS*. Press **Enter**.
574
-
1. Browse your website. If you see the default web page of the project, then the publication was successful.
547
+
1. Install the Visual Studio Code extension [Azure App Service](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-azureappservice).
548
+
1. Follow the link to [Publish with Visual Studio Code](https://docs.microsoft.com/aspnet/core/tutorials/publish-to-azure-webapp-using-vscode?view=aspnetcore-6.0)
575
549
576
550
#### Update the Azure AD app registration (TodoListClient-aspnetcore-webapi)
577
551
@@ -591,7 +565,6 @@ In the left-hand navigation pane, select the **Azure Active Directory** service,
591
565
592
566
> :warning: If your app is using an *in-memory* storage, **Azure App Services** will spin down your web site if it is inactive, and any records that your app was keeping will emptied. In addition, if you increase the instance count of your website, requests will be distributed among the instances. Your app's records, therefore, will not be the same on each instance.
0 commit comments