-
Notifications
You must be signed in to change notification settings - Fork 217
Web App Template
- You can create applications with the project templates provided by Microsoft Identity Web. This is explained in this article
- Then you can configure your applications using msidentity-app-sync which is a dotnet global tool that creates/updates Azure AD or Azure AD B2C apps and updates your code configuration.
You have two ways of installing the templates:
- either from NuGet
- or build them from the repository
You can download the Microsoft.Identity.Web.ProjectTemplates-1.15.2 NuGet package from NuGet.org. The following command will install the templates from NuGet.org (or anything referenced as .NET sources, for instance in NuGet.config)
dotnet new -i Microsoft.Identity.Web.ProjectTemplates::1.15.2
Alternatively if you want to build it yourself clone the Microsoft.Identity.Web repo, and then
dotnet pack /p:ClientSemVer=1.15.2
cd ProjectTemplates
cd bin
cd Debug
dotnet new -i Microsoft.Identity.Web.ProjectTemplates.1.15.2.nupkg
Web MVC app (Microsoft identity platform, Single Org)
mkdir mvcwebapp
cd mvcwebapp
dotnet new mvc2 --auth SingleOrg
Web MVC app (Microsoft identity platform, Multiple Orgs)
mkdir mvcwebapp-multi-org
cd mvcwebapp-multi-org
dotnet new mvc2 --auth MultiOrg
Web MVC app (Azure AD B2C)
mkdir mvcwebapp-b2c
cd mvcwebapp-b2c
dotnet new mvc2 --auth IndividualB2C
Web MVC app calling Microsoft Graph
mkdir mvcwebapp-graph
cd mvcwebapp-graph
dotnet new mvc2 --auth SingleOrg --calls-graph
Web MVC app calling a web API
mkdir mvcwebapp-calls-api
cd mvcwebapp-calls-api
dotnet new mvc2 --auth SingleOrg --called-api-url "https://localhost:12345" --called-api-scopes "api://{someguid}/access_as_user"
Razor Web app (Microsoft identity platform, Single Org)
mkdir webapp
cd webapp
dotnet new webapp2 --auth SingleOrg
Razor Web app (Microsoft identity platform, Multiple Orgs)"
mkdir webapp-multi-org
cd webapp-multi-org
dotnet new webapp2 --auth MultiOrg
Razor Web app Azure AD B2C
mkdir webapp-b2c
cd webapp-b2c
dotnet new webapp2 --auth IndividualB2C
Web Razor app calling Microsoft Graph
mkdir webapp-graph
cd webapp-graph
dotnet new webapp2 --auth SingleOrg --calls-graph
Web Razor app calling a web API
mkdir webapp-calls-api
cd webapp-calls-api
dotnet new webapp2--auth SingleOrg --called-api-url "https://localhost:12345" --called-api-scopes "api://{someguid}/access_as_user"
Blazor server web app (Microsoft identity platform, Single Org)
mkdir blazorserver
cd blazorserver
dotnet new blazorserver2 --auth SingleOrg
Blazor server web app (Microsoft identity platform, Multiple Orgs)
mkdir blazorserver-multi-org
cd blazorserver-multi-org
dotnet new blazorserver2 --auth MultiOrg
Blazor server Web app Azure AD B2C
mkdir blazorserver-b2c
cd blazorserver-b2c
dotnet new blazorserver2 --auth IndividualB2C
Blazor server web app calling Microsoft Graph
mkdir blazorserver-graph
cd blazorserver-graph
dotnet new blazorserver2 --auth SingleOrg --calls-graph
Blazor server web app calling a web API
mkdir blazorserver2 -calls-api
cd blazorserver2 -calls-api
dotnet new blazorserver2 --auth SingleOrg --called-api-url "https://localhost:12345" --called-api-scopes "api://{someguid}/access_as_user"
Blazor web assembly - single-org
mkdir blazorwasm2-singleorg
cd blazorwasm2-singleorg
dotnet new blazorwasm2 --auth SingleOrg
Blazor web assembly single-org, calling Microsoft graph"
mkdir blazorwasm2-singleorg-callsgraph
cd blazorwasm2-singleorg-callsgraph
dotnet new blazorwasm2 --auth SingleOrg --calls-graph
Blazor web assembly single-org, calling a downstream web API"
mkdir blazorwasm2-singleorg-callswebapi
cd blazorwasm2-singleorg-callswebapi
dotnet new blazorwasm2 --auth SingleOrg --called-api-url "https://graph.microsoft.com/beta/me" --called-api-scopes "user.read"
Blazor web assembly, single-org, with hosted Blazor web server web API
mkdir blazorwasm2-singleorg-hosted
cd blazorwasm2-singleorg-hosted
dotnet new blazorwasm2 --auth SingleOrg --hosted
Blazor web assembly, single-org, with hosted Blazor web server web API calling microsoft graph"
mkdir blazorwasm2-singleorg-callsgraph-hosted
cd blazorwasm2-singleorg-callsgraph-hosted
dotnet new blazorwasm2 --auth SingleOrg --calls-graph --hosted
Blazor web assembly, single-org, with hosted Blazor web server web API calling a downstream web api
mkdir blazorwasm2-singleorg-callswebapi-hosted
cd blazorwasm2-singleorg-callswebapi-hosted
dotnet new blazorwasm2 --auth SingleOrg --called-api-url "https://graph.microsoft.com/beta/me" --called-api-scopes "user.read" --hosted
Blazor web assembly, B2C
mkdir blazorwasm2-b2c
cd blazorwasm2-b2c
dotnet new blazorwasm2 --auth IndividualB2C
Blazor web assembly, B2C, with hosted Blazor web server B2C web API
mkdir blazorwasm2-b2c-hosted
cd blazorwasm2-b2c-hosted
dotnet new blazorwasm2 --auth IndividualB2C --hosted
-
Create the app
dotnet new webapp2 --auth IndividualB2C --aad-b2c-instance "https://fabrikamb2c.b2clogin.com" --client-id "90c0fe63-bcf2-44d5-8fb7-b8bbc0b29dc6" --domain "fabrikamb2c.onmicrosoft.com" --susi-policy-id "b2c_1_susi" --reset-password-policy-id "b2c_1_reset" --edit-profile-policy-id "b2c_1_edit_profile"
-
In the launchSettings.json, change the sslPort to 44316
-
run the Web app:
dotnet run
-
navigate to
https://localhost:44316
and sign-in to the application
Navigate back to ProjectTemplates\bin\Debug
and run:
dotnet new -u Microsoft.Identity.Web.ProjectTemplates
First un-install:
Navigate back to ProjectTemplates\bin\Debug
and run:
dotnet new -u Microsoft.Identity.Web.ProjectTemplates
Then install the new templates:
dotnet new -i Microsoft.Identity.Web.ProjectTemplates.1.9.1.nupkg
- 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