Integrating Identity in an Existing MVC 5 project having 3 different projects in one solution - asp.net-mvc-5

I'm working on a MVC project My solution it has 3 separate projects.
Currently it does not have identity integrated previously it was using DB-first approach but i have recently shifted it to Code First. Three different projects contains three different logics
ERP_Data contains all the models and context class
ERP service Contains the business Logic which is (Basic Crud Operations for all the models). ERP-Web contains rest of the functionality problem about integrating Identity is
in which project it should be installed as for the identity we need configuration file in app start folder Identity Models in Models Folder and reference in web.config file.
Need initial guidance how do i divide the identity configuration among these.

Related

How to create ASP.NET Core web application for existing Azure database with identity tables

I have an existing Xamarin mobile application hooked to a backend that is a .NET Framework 4.7.1 web application hosted in Azure. It only contains the logic and links to push notifications hubs in azure, and also does the new user registration and login authentication for the mobile app.
I researched and realized it would not be a good idea (or cannot even) upgrade the .NET Framework 4.7.1 existing Web API to a .NET Core 3.1 / Net 6 Web API.
I am thinking to create a new .NET Core 3.1/ Net 6 project that will ALSO hook up to the existing database and keep adding functionality for the mobile in this new project, such as a password reset feature, more modern and easy to maintain. Both web apis will be operational (so I can avoid updating the mobile azure notfication packages and hub, which would result if i modified the original backend project)
The multi-part questions:
Is this approach a good approach? If not, what is the alternative?
The existing database has Microsoft Identity tables, so when I create the new NET Core 3.1 / Net 6 project, do I select Authentication with Microsoft Identity as an option? When scaffolding the azure existing db connection string, will this hook the authentication logic automatically for me into the new project with the existing tables (even though the users tables has a slightly modified custom name and added some columns in previous project when created)?
Posting as an answer (because too long for a comment)
First of all, you can upgrade from .NET 4.7 to NETCore, I have done that recently (4.7.2 to NetCore5).
Provided that you are not using a library or package that has not been yet ported to NetCore.
e.g. My project was targeting EF6, i had to first migrate the entire project to EFCore5. Then change the code in DbContext, recreate the DB Migrations, fix some of the Queries (especially the GroupBy queries) etc. Then finally I could upgrade to NetCore5.
Regarding the 2nd part of your question, I don't think it is bad idea to have separate API for some of your functionality, but personally I would avoid if upgrading the existing project is feasible. (Maybe start fresh and port of the rest of the code gradually?)
A thing to also keep in mind, is that maybe AspnetCore Identity schema is different to Aspnet Identity schema (just a thought, not sure)
I have recently migrated a Custom Users and authentication system to AspnetCore Identity, I used IdentityServer4 alongside AspnetCore Identity.
I am not sure how you are authenticating the users etc. but I was already using IdentityServer4, when I scaffold it with the AspnetCore Identity UI/Authentication it created the UIs/Business logic for authentication (I had to tweak it a bit, and had to customise some of it to keep working with our Mobile Apps)
Also, I had to manually migrate our users from Custom Users table to the new Identity.Users table. I created a Utility App (Console Application) which read the users from existing Users table and created them under the Microsoft --> Identity tables.
I think it took me about a month to upgrade from
1 - EF6 --> EfCore
2 - Net471 --> NetCore5
3 - Custom Users --> AspnetCore Identity

Azure Custom Vision Project

I am creating an azure custom vision project in python, every time i run the code, it creates new projects and my project count keeps increasing.
How can i delete an existing project before creating a new one?
First you're going to want to check which projects you have, which you can check with the GetProjects API. This will give you have a list of projects with their project ids. Once you have project ids for the projects you want to delete, then you can just call the DeleteProject API, passing in the project id. You can also managed you projects via the Custom Vision Service portal at www.customvision.ai, just be sure to sign in with your account.

AzureDevOps - Creating generic team

In Azure DevOps, a default project team will be created when we create a new project in a given collection. We can then add/invite members to this team and assign their level of permission. So far it is clear to me.
However, in my case, I have multiple projects and in each project there shall mostly be static set of developers.
Question:
a) Is it possible to create a default team at collection level (rather than project level) and assign users to it?
b) If srl (a) is possible, how would we instruct Azure DevOps to assign this default team as project team for all projects those shall be created under project collection ?
For example: Within a collection called Services, I have projects with users like below
Service A will have developers x, y
Service B will have developers x, y
Service C will have developers x, y, z
I prefer a default team with users (x, y); and this team will be assigned to all projects those are created under Services collection.
Exception: Service C has an extra developer Z. This is fine since we can visit project and explicitly add this developer.
a) Is it possible to create a default team at collection level (rather
than project level) and assign users to it?
No, it's impossible. In Azure DevOps, we provide collection-project-team structure.
Within a project, you can add teams
You could take a look at our official doc here-- About projects and scaling your organization and then decide if you need to create multiple projects or teams in your scenario.
As the above doc mentioned, we would suggest you handle a single project. Can a user account belong to more than one team?
Yes. When you add user accounts to a project, you can add them as members of the project, or you can add them to one or more teams added to the project.
Besides, you are also be able to structure hierarchical teams. Although there's no concept of subteams, you can create teams whose area paths are under another team, which effectively creates a hierarchy of teams. To learn more, see Add another team.
afaik it is not possible to create teams on collection level. you could, for example, create an Active Directory Group and use/reuse it in your projects.

In azure can multiple web apps perform CRUD operations on the same data

In azure I have a few web apps running using the same database.
But the data never clashes or anything; it's like azure has partitioned the database somehow.
I would like two web apps under different domains to access the same data with a separate api project.
What is the best way to configure this project in azure?
And in visual studio? Can I have them all in the same solution and publish them to the right place?
In Azure, you should setup one Azure SQL Database and multiple API Apps / Web Apps that all use the same connection string pointing to that database.
In Visual Studio, the best way to configure it depends on a couple of things.
If the WebAPIs are exactly the same just with a different domain
You can setup multiple publish profiles for a single Web Application Project. These publish profiles can tie to different release configurations which can transform things in your web.config to account for the differing domains. This is particularly important when using SSL, authentication or something like that.
If the WebAPIs are different for each domain
In this case, you will likely have different projects for each distinct WebAPI. You can have them all in one solution or separate solutions. It might be easier to setup different solutions if you want to enable automated build using Visual Studio Online or something as the Visual Studio build task keys off the *.sln file and if you have multiple Web Application projects in one solution your build outputs will be mixed up which can cause some issues when deploying.

Independent deployment of separate layers to Azure

Lets say I have an application, that is separated into various layers (Presentation, Business, Data Access). How to deploy those layers to Azure independently? The question is about Azure configuration, not about the architecture of application.
An app is usually divided up into various roles, each role being Windows Server 2008 R2 with a defined size and number of instances. You'd typically break your app up into roles for scaling and management purposes. It's often simplest to deploy an app within a single deployment.
On to your scenario: If, say, you want to push up a Web Services layer that lives independently of your app (or maybe it serves multiple apps of yours), then you would put that Web Services layer (in a Web Role, let's say) in its own deployment. You'd need to manage authentication / authorization, since the Web Services would then be using a public endpoint for communication (or you could use Service Bus).
In your example: you could push your Presentation tier (e.g. website) to one deployment with a set of Web Roles, along with supporting services such as Cache. You'd have your Business Layer in another deployment, maybe running with web Services as in my example above. Then your data layer could be SQL Azure (Database-as-a-Service) or maybe a standalone database like MongoDB, running in its own deployment.
Each deployment would have its own project, and you'd deploy and manage each one separately. There's no configuration that spans all deployments.

Resources