-
Notifications
You must be signed in to change notification settings - Fork 218
new web app
To create a new ASP.NET Core web app you can either use the command line, or the Visual Studio wizard.
You can create a web app that sign-in users. You can also add the capability for your web app to call Microsoft Graph, or any downstream API. Based on what you want to have, use the following commands, from a developer prompt.
Add web app | calls graph | call downstream API | |
---|---|---|---|
Entra ID or Entra External IDs | dotnet new webapp --auth SingleOrg |
--calls-graph |
--called-api-scopes <scopes> --called-api-url <url> |
Azure AD B2C | dotnet new webapp --auth IndividualB2C |
N/A | --called-api-scopes <scopes> --called-api-url <url> |
ex: The following command creates a new web app that calls Microsoft graph
dotnet new webapp --auth SingleOrg --calls-graph
The following command creates a new web app that calls a downstream API located at https://localhost:12345/
accepting a scope https://myapp.mydomain.com/read
dotnet new webapp --auth SingleOrg --called-api-scopes https://myapp.mydomain.com/read --called-api-url https://localhost:12345/
You can also replace webapp
by:
-
mvc
to have controllers and views instead of razor pages -
razor
(which is the same as webapp) -
blazorserver
to have a web app with blazor pages. From the authentication point of view things will be the same.
AFter the command line runs, you 'll have the code for your web app. You now need to map the configuration of this code (in the appsettings.json file) to a app registration in Azure AD (new or existing). For this, check out the msidentity-app-sync tool
-
In Visual Studio, choose Create a new project
-
In the Create a new project dialog, choose ASP.NET Core web app, and press Next
-
Provide a project name, a location, and a solution name, and press next
-
in the next dialog, in the Authentication type drop down, choose "Microsoft identity platform"
then click Create
-
Once the code is generated, the 'Connected services' page automatically opens in Visual Studio, and proposes you to install the donet msidentity tool, that will handle the app registration for you. Click Next
-
Choose a tenant where to create an application. Depending on the tenant type (AAD or B2C), your code will be updated to be an AAD or an Azure AD B2C application.
-
Create a new app, or pick an existing app in the tenant.
-
Choose if you want to call Microsoft Graph or not. The code for your application will be updated accordingly
-
If you chose to call an API, the wizard will also provide you with options to store the application secret.
- Home
- Why use Microsoft Identity Web?
- Web apps
- Web APIs
- Using certificates
- Minimal support for .NET FW Classic
- Logging
- Azure AD B2C limitations
- Samples
- Web apps
- Web app samples
- Web app template
- Call an API from a web app
- Managing incremental consent and conditional access
- Web app troubleshooting
- Deploy to App Services Linux containers or with proxies
- SameSite cookies
- Hybrid SPA
- Web APIs
- Web API samples
- Web API template
- Call an API from a web API
- Token Decryption
- Web API troubleshooting
- web API protected by ACLs instead of app roles
- gRPC apps
- Azure Functions
- Long running processes in web APIs
- Authorization policies
- Generic API
- Customization
- Logging
- Calling graph with specific scopes/tenant
- Multiple Authentication Schemes
- Utility classes
- Setting FIC+MSI
- Mixing web app and web API
- Deploying to Azure App Services
- Azure AD B2C issuer claim support
- Performance
- specify Microsoft Graph scopes and app-permissions
- Integrate with Azure App Services authentication
- Ajax calls and incremental consent and conditional access
- Back channel proxys
- Client capabilities