Get a Head Start Developing Multitenant SaaS Cloud Applications Using ASP.NET Core and Microsoft Azure | Syncfusion Blogs
Live Chat Icon For mobile
Live Chat Icon
Popular Categories.NET  (175).NET Core  (29).NET MAUI  (208)Angular  (109)ASP.NET  (51)ASP.NET Core  (82)ASP.NET MVC  (89)Azure  (41)Black Friday Deal  (1)Blazor  (220)BoldSign  (14)DocIO  (24)Essential JS 2  (107)Essential Studio  (200)File Formats  (66)Flutter  (133)JavaScript  (221)Microsoft  (119)PDF  (81)Python  (1)React  (101)Streamlit  (1)Succinctly series  (131)Syncfusion  (919)TypeScript  (33)Uno Platform  (3)UWP  (4)Vue  (45)Webinar  (51)Windows Forms  (61)WinUI  (68)WPF  (159)Xamarin  (161)XlsIO  (36)Other CategoriesBarcode  (5)BI  (29)Bold BI  (8)Bold Reports  (2)Build conference  (8)Business intelligence  (55)Button  (4)C#  (150)Chart  (132)Cloud  (15)Company  (443)Dashboard  (8)Data Science  (3)Data Validation  (8)DataGrid  (63)Development  (633)Doc  (8)DockingManager  (1)eBook  (99)Enterprise  (22)Entity Framework  (5)Essential Tools  (14)Excel  (40)Extensions  (22)File Manager  (7)Gantt  (18)Gauge  (12)Git  (5)Grid  (31)HTML  (13)Installer  (2)Knockout  (2)Language  (1)LINQPad  (1)Linux  (2)M-Commerce  (1)Metro Studio  (11)Mobile  (508)Mobile MVC  (9)OLAP server  (1)Open source  (1)Orubase  (12)Partners  (21)PDF viewer  (43)Performance  (12)PHP  (2)PivotGrid  (4)Predictive Analytics  (6)Report Server  (3)Reporting  (10)Reporting / Back Office  (11)Rich Text Editor  (12)Road Map  (12)Scheduler  (52)Security  (3)SfDataGrid  (9)Silverlight  (21)Sneak Peek  (31)Solution Services  (4)Spreadsheet  (11)SQL  (11)Stock Chart  (1)Surface  (4)Tablets  (5)Theme  (12)Tips and Tricks  (112)UI  (387)Uncategorized  (68)Unix  (2)User interface  (68)Visual State Manager  (2)Visual Studio  (31)Visual Studio Code  (19)Web  (597)What's new  (333)Windows 8  (19)Windows App  (2)Windows Phone  (15)Windows Phone 7  (9)WinRT  (26)
Multitenant SaaS application

Get a Head Start Developing Multitenant SaaS Cloud Applications Using ASP.NET Core and Microsoft Azure

The next revolution in the software industry will be SaaS cloud-based applications. In 2020, you will see many SaaS applications coming out on the market. Nowadays, there are many technologies available that make building SaaS applications easier. The recent release of the cross-platform ASP.NET Core 3.1, which is battle-tested and performs on par with other technologies, is an ideal choice to build a SaaS application if you are already familiar with .NET.

In this post, you will find some useful tips and libraries that will help you get a head start on your SaaS application using ASP.NET Core and Azure.

Setting up a project structure

First, to start your application, set up a project structure. There are some good projects and architectural references that I listed in my previous blog. Some top project templates to look at when starting a project are:

Also, I suggest watching this video on clean architecture by Jason Taylor.


The next important step in building a SaaS application is to handle multitenancy, the serving of multiple tenants using a single instance of an application. To handle multitenancy, there are several open-source libraries available that will provide boilerplate code. Some of the top libraries in this category are:

You can also check out blog posts on multitenancy by Ben Foster or Gunnar Peipman. These blogs will help you in setting up multitenancy in your project.

Error logging

Error logging is also one of the important things to include in your project. There are several open-source libraries available, some of the top libraries in this category are:

Health checks

Health checks are used to monitor an application. When you are developing a system with microservice architecture, this is one of the important things to consider. ASP.NET Core provides inbuilt health check options, and if you need a UI for monitoring the health of your microservices, then check out this library AspNetCore.Diagnostics.HealthChecks.


ASP.NET Core now ships with IdenityServer4. This library provides most authentication-related functionalities. Check out this project, JPProject.IdentityServer4.AdminUI, which demonstrates many features of an identity server. Also, you can check out blog posts by Scott Brady, as he writes useful, informative posts about Identity Server.


Authorization is important in an application. There are different types of authorization techniques:

  • Role-based authorization
  • Policy-based authorization

Based on your application, select the one that best suits your needs. I recommend you check out this blog post on a better way to handle authorization in ASP.NET Core.

Feature management

In a SaaS application, you may have different pricing plans for products. Depending on the pricing plan, some features will be shown or hidden. Microsoft Feature Management is handy for implementing pricing plan-based features. Check out blogs by Andrew Lock related to Microsoft.FeatureManagement.


Web applications are prone to vulnerabilities, so you must pay attention to the security of your application by adding strong authentication, authorization, encryption, and security headers. Some informative posts and resources related to security are:


ASP.NET Core provides built-in attribute-based validations. But if you need a cleaner way to write validation, then do check out the  Fluent Validation library.


Caching helps in improving the performance of an application and is one of the areas that need to be considered, especially in a multitenant application. There are two types of caching:

  • In-memory caching
  • Distributed caching—Redis is preferred for SaaS applications

If you are using Redis for caching, then this library will help you: StackExchange.Redis.

Microservice communication

In microservices, there needs to be reliable intercommunication among APIs. There are two types of communication:

  • HTTP-based
  • gRPC

If you are using HTTP-based communication, then check out the Polly library.

API gateway and reverse proxy

In microservice applications, you will need an API gateway to serve as a front-end for the back-end. Two popular libraries are:

You can also use Ngnix or the Azure API gateway for this purpose.


There are several libraries available for documentation. Some of the top open-source libraries in this category are:


To run background jobs for your application, there are some good libraries:

You can also build background jobs using .NET Core Worker services and host in Azure as a Web Jobs.


Automated testing is one of the important areas to consider. There are different types of automated testing available:

In Entity Framework Core, an in-memory database was introduced that helps make testing for database logics easier without the overhead of actual database operations.

There are some good libraries available that will help you in writing unit testing:

A few more useful libraries:

Code quality analyzers and linting

Code quality static analyzers tools help in writing code with proper standards and in maintaining quality. There are several open-source analyzers available in .NET Core. You can find the top 10 analyzers in this article. This process can be integrated into continuous integration using Cake Script.


Three popular front-end frameworks are Angular, React, and Vue. There is a long-running debate on which is better. In my opinion, Angular is good for building enterprise applications, even though it has a steep learning curve. Angular is a complete framework that has several functionalities built into its framework, unlike React or Vue. As I said, superiority is debatable based on your expertise and needs. You can choose any one of them and do well.


There are two popular databases available in Azure

  • MS SQL—Elastic Pool
  • Cosmo DB—NoSQL database

If you are going to use database-per-tenant architecture, then MS SQL Elastic Pool is a better choice. You can add up to 500 databases in one elastic pool, so it’s cost-effective. There are other storage models as well in SaaS, and which you choose depends on your application needs. A reference for other models can be found on this Microsoft page.


For the deployment of an application, there are several options available. The best option is to deploy on the cloud, which allows you to scale, monitor, and load-balance your application. There are several ways to do this

  • Deploy app in Azure App Service for Linux, containers, or Windows.
  • Deploy app in Azure Kubernetes or Google Kubernetes.
  • Deploy in VMs.

The simplest of all these is to deploy in the Azure App Service. You can find a guide on how to do that in this article. Azure App Service supports scaling up to 20 instances with its Traffic Manager. If your app needs more scaling options, then Kubernetes is best.

Azure service

There are several Azure services available for SaaS application development. Some of the most commonly used services are:

  • App Service: Managed hosting platform for deploying and scaling applications.
  • Azure SQL Database: Managed SQL database as a service.
  • Azure Cosmos DB: Globally distributed, multimodel database service for any scale. It also provides single-digit millisecond latency for read and write.
  • Azure Cache for Redis: Managed Redis cache.
  • Azure Functions: A managed service to run serverless, event-driven or trigger-based workloads.
  • Service Bus: Scalable managed service providing reliable queuing and a publish/subscribe messaging service. Useful for handling loads at scale in distributed systems.
  • Event Grid: Managed event routing service using publish/subscribe model. Useful for event-driven microservices.
  • Azure Blob Storage: For all kinds of file storage needs.
  • Logic Apps: Out-of-the-box logic connectors for integration. Can be integrated with Event Grid or Service Bus for logical routing of messages.
  • Application Gateway: A load balancer supporting SSL termination, cookie-based authentication, and a round-robin load balancer.
  • Azure Kubernetes Service: An orchestrator for containerized applications.
  • Azure Search: Full text search service.
  • Azure Synapse Analytics: Data warehouse to process complex queries.
  • Azure DevOps: A cloud service for continuous integration and deployment.

A directory of Azure Services can be found on the Azure site.


I hope these tips and libraries will help you get a head start on your SaaS application. You can also check out the Azure Application Architecture Guide.

Syncfusion also provides several controls for Angular, React, Vue, and ASP.NET Core that will further ease your development of a SaaS application. For example, Syncfusion provides 70+ high-performance, lightweight, modular, and responsive ASP.NET Core UI controls such as DataGrid, Charts, and Scheduler. You can use them to improve your application development.

Please share your feedback in the comments section. You can also contact us through our support forum, Direct-Trac, or feedback portal. We are waiting to hear your feedback!


Share this post:

Comments (11)

So, in other words, in order to develop multitenant applications, we need to know about 40 different frameworks, plugins, or technologies.

HI David,

It is not necessary to know about 40 different frameworks, plugins, or technologies. It depends on what you are developing and your application use case. I have listed above some popular framework, libraries and technologies which will help you in building application.


Was wondering how to manage User interface for Tenant users and Saas Admin.
We will have different roles for saas owners like Adminsitrators, Helpdesk, Account Manager so The SAAS owner may need to have multiple users who will acess the application and do their job.

HelpDesk: If a tenant put up a ticket, helpdesk team shall be able to view and solve.

Account management: Account Managers may need to access the payment information of the tenants for following up the tenants.

ServiceManagers: To perform maintenance and upgrades etc.

In this case

Do we need to have different UI for “Saas owner” and “Tenants” or is it better to manage it with permissions and roles?

Hi Sreekanth,

My suggestion would be to use two separate UIs.

1.Tenant Management Site
It may be a separate site decoupled form actual application for Managing Billing, Feature Plan, Users based pricing etc., This approach will also benefit you if you have more than one SaaS application.

SaaS owner roles can be maintained here

2. Actual application
Inside application, you can have Roles and Permission. This roles and permissions should be specific to application.

In your case HelpDesk, ServiceManagers since this role will have access to app specific functionalities.


Thanks for the reply. So i concluded that we should go for separate Ui for tennt management and Tenant Application with a super admin.

Thanks for the reply.

Thanks for the reply Barath. Will discuss with team regarding your advise.

How to handle validation? each tenant may have different validation? so how do we use same code base for all tenants?
example : Tenant A need DOB as required field but Tenant B doesn’t need that field. How can we handle using fluent validation in web api?
Can you share me your thoughts please.

Hi Revathi,

For custom field/custom configuration for fields per tenant, I would suggest storing the field configuration(required/not required) for each tenant in the Database/Redis cache, for example in field_configuration table.

Now application side you should read those configurations defined for tenant and validate fields.

Fluent Validation for this dynamic validation scenario would be complicated to use, I suggest avoiding using fluent validation for this specific scenario. For fixed validation requirements you can still use fluent validations.


Thank You Bharat for your reply.
In our requirement, we need to check few more validation like regex pattern, min length and max length. Do I need to include all those configurations in the table? for few tenants, min length and max length is not required so I cannot go for fixed model(fixed columns). so in this case,
going for jsondocument (in postgress DB -{required:”y”,MaxLength:10,MinLength:5}) is good approach or
keeping all possible validation columns in Db , and making irrelevant/unnecessary validations column(min length,max length) to null for the specific tenant ?

Hi Revathi,

If you are using Postgres, then using a table with jsonb column for storing configuration for fields would be an appropriate choice. Case 1 as you said above.

1. Data retrieval will be faster as a single column will store all config in contrast to multiple columns for each type of config.
2, Flexibility of storing unstructured configs – Textbox may require max length, Date field might not require, so using jsonb you may not require to set unwanted fields to null, just can store what is required.
3. In the future no changes in DB schema required to add additional configuration for the field, but if you use a fixed column then adding additional config might require DB schema change

In this config, you can additionally cache using the In-memory cache of ASP.NET Core or using redis. To further speed up application performance


Thank You Bharat!!

Comments are closed.

Popular Now

Be the first to get updates

Subscribe RSS feed

Be the first to get updates

Subscribe RSS feed