title: Identity in SPA on ASP.NET MVC Core on Azure AppService
body: <p>I'm exploring options I have when it comes to implementing user authentication and authorization in Angular app with ASP.NET Core 3.1 backend that will be deployed to Azure AppService.</p>
  
  <p>Only selected, invited users will be allowed to use application. There will be no "Create account" page accessible to everyone. There is a possibility that subset of those users will be our company users so leveraging their Active Directory identity and allowing SSO would be great. Application will be multi-tenant. Multi factor authentication might be needed for selected tenants/users (based on role for example). We don't want to allow logging in with 3rd party Identity Providers like FB, Google and so on.</p>
  
  <p>Based on my explorations on I have 2 (4?) options.</p>
  
  <ol>
  <li><strong>ASP.NET Core Identity</strong> - simple, builtin, well known. But probably won't allow me to to implement SSO and users will need another login/pass. I'm not sure if it supports inviting users (out of the box) or is this something I would need to implement myself. Same with password resets. It allows me to add custom properties to stored user entity (TenantId) to allow me to implement multitenancy, but I need to deploy SQL Server database and manage it myself.</li>
  <li><strong>Azure AD (B2B, B2C)</strong> - this is new to me. How I understand it is that with Azure AD Connect I could synchronize users between AD and Azure AD and this would allow me to implement SSO for our company users. Only selected OU's could be synchronized and based on groups in AD they could be assigned different roles in our app. Then assigning roles is responsibility of people which are already managing those users in <em>AD</em>. If person is released and their account is removed/locked in AD they lose access to our app. If they're removed from specific group they lose access to our app. And probably all our company users are already in Azure AD - I see myself and my colleagues in it when I use my work e-mail to login to Azure portal. When it comes to supporting users which are not in our <em>AD</em> I tested that I can add "Guest users". At first I thought this is something I would need <em>Azure AD B2C</em> for but looks like it's not the case. Then what is <em>Azure B2B</em> and <em>B2C</em> for? In this case I don't need to manage SQL database and have user managment for free. Both on <em>AD</em> and <em>Azure Portal</em> site. I don't know if I can add custom properties to users (TenantId).</li>
  </ol>
  
  <p>Which one of those options is better? Maybe there are other options?</p>