Run IdentityServer4 Admin UI local and Azure
Beam me up, Scotty!
Introduction
On April 26, 2021, developer Jan Škoruba released IdentityServer4 Admin UI version 2.0.1 which supports ASP.NET CORE v5. In this tutorial, I will share the steps to deploy the Admin UI to Azure Cloud from Visual Studio 2019.
One of the most prevailing features of IdentityServer4 is it’s ability to provide a single, centralized Identity and Access Management (IAM) solution across multiple applications. The Skoruba.IdentityServer4.Admin template provides Admin UI to streamline the configuration of oAuth2 client applications and API resources. Developers can focus on writing code for new software features and less on cross-cutting code for authentication and authorization.
As a developer of Angular and ASP.NET CORE REST API, I need a Secure Token Service server to protect SPA applications. What would it take to deploy Secure Token Service to the cloud? It’s easy. In this tutorial, I will provide a step-by-step on how to do it.
This write-up is an extension to my previous publication on Medium in which I did a deep dive into the Skoruba.IdentityServer4.Admin opensource project. To learn more about Admin UI to secure ASP.NET CORE REST APIs and clients (ex. SPA, MVC, mobile), please visit IdentityServer4 Admin UI from Skoruba.IdentityServer4.Admin Template.
Open Source Project Highlights
To develop this story, I have reviewed and integrated tools and techniques from the following high-quality opensource projects.
- IdentityServer4 — this project has 7.9K stars on Github. It is the #1 opensource project for securing enterprise ASP.NET WebAPI by Brock Allen.
- IdentityServer4.Admin — this project has 2.7K stars on GitHub. It is the best Admin UI of the IdentityServer4 and Asp.Net Core Identity by Jan Škoruba.
One way you can show your appreciation to open-source project developers is by giving them a “star” on Github.
Tutorial Content
The tutorial has three parts:
Part 1: Scaffolding an Admin UI solution Use Net Core CLI to generate IdentityServer4 Admin UI project based on Skoruba.IdentityServer4.Admin template v2.0.1.
Part 2: Infrastructure setup in Azure to run Admin UI Set up App Service websites and SqlAzure database. Customize the IdentifyServer4 seed data file to work with websites in the cloud.
Part 3: Publishing Admin UI solution to Azure Deploy three web projects to Azure App Service from Visual Studio 2019 using Azure App Service Publishing Profile.
At the end of the tutorial part, I include a complementary screencast, so you can see how it was done on my desktop. Grab a drink and relax while watching the video!
Prerequisites
The following tools/skills are recommended.
- Visual Studio 2019 Community — free editor for ASP.NET Core WebAPI C#.
- Knowledge of Azure App Service and SQLAzure
Let’s get started!
Part I — Scaffolding an Admin UI solution
The dotnet command is used to download and run the Skoruba.IdentityServer4.Admin template.
Task 1.1 — Download the template
The template can be downloaded and installed via the dotnet new command with parameter -i (for install). For example, open the command prompt and enter the command below to download the Skoruba template version 2.0.1
dotnet new -i Skoruba.IdentityServer4.Admin.Templates::2.0.1Task 1.2 — Run the template to generate the Visual Studio solution
To generate the Visual Studio solution, run the dotnet new, specify the template name and template parameters. Suppose you want to generate the source code for a project named TokenProject and place the project source code in the folder C:\apps\devkit\TokenService\v2, follow the instruction below
- Create folder C:\apps\devkit\TokenService\v2
- Open a command prompt and navigate to folder C:\apps\devkit\TokenService\v2
- Run the script donet new script below to generate the project
dotnet new skoruba.is4admin --name TokenProject --title TokenProject --adminemail "[email protected]" --adminpassword "Pa$$word123" --adminrole MyRole --adminclientid MyClientId --adminclientsecret MyClientSecret --dockersupport trueOnce the script is completed, you will find the source code in C:\apps\devkit\TokenService\v2\TokenProject as shown in Figure 1.

Launch Visual Studio and open the solution file TokenProject.AdminUI.sln. You should see the solution projects as shown in Figure 2.

In the Solution Explorer, right mouse click on the solution name, select Properties, and set “Multiple startup projects” to three projects
- TokenProject.Admin
- TokenProject.Admin.Api
- TokenProject.STS.Identity
See Figure 3 for a screenshot of enabling Multiple startup projects in Visual Studio.

To run the solution, hit F5 or click on Start (as shown in Figure 4).

Your development workstation will launch three instances of the web browsers. Locate the one with the login screen as shown in Figure 5, and log in with the account (admin, Pa$$word123). The password is set in the parameter “adminpassword” when ran the template earlier to generate VS Solution. Notice that the localhost port number is 44303 for the login server.

After login, the Admin UI dashboard is shown in Figure 6. Notice that the localhost port number is 44303.

You should also see an instance of the browser displaying in the Admin UI REST API in swagger as shown in Figure 7. Notice that the localhost port number of the REST API is 44302.

Screencast of Part 1
The complementary Youtube video is a record of the steps in this part of the tutorial.











