Migrate existing Users to Azure AD b2c - azure-ad-b2c

I have old users Authentication flow depend on AspnetIdentity and we are planning to move the authentication from our end to use B2C
What is the easiest way to do that
and update AD b2c with the existing users

The link provided by #Chauncy is correct. You can migrate users to Azure AD B2C according to the two migration methods provided in the document.
Migrating from another identity provider to Azure Active Directory B2C
(Azure AD B2C) might also require migrating existing user accounts.
Two migration methods are discussed here, pre migration and seamless
migration. With either approach, you're required to write an
application or script that uses the Microsoft Graph API to create user
accounts in Azure AD B2C.

Related

What approaches are available for allowing Azure AD B2C users to GET and POST data to a M365 environment via Graph API?

Per the docs, there is no 'out of the box' way to enable Azure AD B2C users to interact with the M365 environment associated with the Azure AD tenant that was used to create the Azure AD B2C tenant.
Azure AD B2C can't be used to authenticate users for Microsoft 365.
Source:
Can I use Azure AD B2C to provide social login (Facebook and Google+) into Microsoft 365?
But I still need to be able to provide this functionality, i.e GET and POST requests to M365 via the Graph API.
To be clear, this is what I have achieved so far:
Azure AD B2C users can login
Azure AD users can login and interact with their own M365 environment via Graph API
(to enable this, I added the Azure AD tenant as an identity provider, per this article)
What I have not yet been able to figure out is:
How can the Azure AD B2C users interact with the M365 environment associated with the Azure AD tenant?
(that created the Azure AD B2C tenant)
To illustrate a use case for this requirement:
Company_A wants to enable external contractors to be able to submit compliance documents to them
They set up Azure AD B2C and create accounts for their external contractors
They set up a Node.js/Express web app on Azure
External contractors can now login to a web app and view forms designed to submit data and attachments
How can those forms send data and attachments to a Document Library in Company_A's M365 environment?
I have been pondering this issue for a while and can't conceptualise a mental or technical model of how this can be achieved.
Google searching related phrases doesn't produce any relevant content.
I am hoping someone will have the knowledge and experience to be able to say:
You will need to follow THIS paradigm which is documented HERE and involves doing THIS
Edit:
I am reading articles like these:
Get access without a user
which talks about scenarios where:
apps that have a signed-in user present may also need to call Microsoft Graph under their own identity
and contemplating adding Application Permissions (as opposed to Delegated Permissions) to my Azure AD B2C application registration.
Just to test the idea, I have added Sites.ReadWrite.All as an Application Permission and granted Admin Consent for that permission. How would I define this scope (Sites.ReadWrite.All) to be associated with the 'home' Azure AD tenant (as opposed to the Azure AD B2C tenant)? I am using msal-node which has a method named getAuthCodeURL() where you pass through the scopes required. I am assuming if I just added Sites.ReadWrite.All it would default to being applied to the Azure AD B2C tenant, rather than the desired Azure AD tenant?
M365 doesn’t exist in an Azure AD B2C tenant, you cannot apply a license for Office there. This simply isn’t possible.
For Graph API, you cannot use B2C issued tokens to call it. You must use underlying AAD Tokens to access it. Your server would need to perform Azure AD client credentials flow against the Azure AD endpoint of your AAD B2C tenant and ask for a token to Graph API. https://learn.microsoft.com/en-us/azure/active-directory/develop/v2-oauth2-client-creds-grant-flow
Microsoft service scopes only apply to the underlying Azure AD endpoints of your AAD B2C tenant. They won’t mean anything at the AAD B2C login endpoints. Hence, the differentiation is made by the endpoint used.
An Azure AD B2C tenant has both endpoints:
AAD: login.microsoftonline.com/tenantId
B2C: b2clogin.com/tenantId
Since M365 env does not exist for B2C tenants, the MS Graph API is only useful to R/W user data. But, for this, you could just use the B2C user flows to R/W user profile data, and return user profile data into the B2C token, so you don’t have go call MS Graph API. This is actually the intended usage pattern.

Azure AD B2C profile edit available options

I am new to Azure AD and trying to setup and learn Azure AD B2C. I am able to run built in user flows and created custom policies to update user profiles. But Just wanted to check, if end users of my applications can edit their profile using https://myaccount.microsoft.com ? Or built-in user flows and custom policies in Identity Experience Framework are the only two options?
No, that link is for Azure AD, not B2C.
You have to use the B2C flows.

Could we use Azure Active Directory(AAD) B2B and B2C in single application??? B2B for Microsoft Intune access and B2C for user login/signup

I have an requirement to implement both Azure B2C and B2B in a single application where B2C is used to login/signup, after user's login/signup the B2B is used to get Microsoft Intune Access??? is that possible to implement this flow?? any help will be appreciated.
Yes you can add multiple providers to most applications, for example if you use API's and azure functions or webapps etc, this can done either with EasyAuth or in your own code.
In simple terms you end up adding AAD as one provider and B2C as a second provider, meaning that your application will trust tokens from both services and then you go from there.

Should I migrate complete user store (AspNetRoles, AspNetUserClaims, AspNetUserLogins, etc) to Azure AD B2C? Is this a standard practice?

I have a MVC application and a mobile application which uses Asp.Net Identity for user management and for managing their roles. I'm trying to migrate all the user from our SQL database to Azure AD B2C. I have written a script which will read the users from existing SQL database table (AspNetUsers) to Azure AD B2C via Microsoft Graph API. I'm not sure whether all the attributes from all the Identity tables (AspNetRoles, AspNetUserClaims, AspNetUserLogins, etc) will be moved to Azure AD B2C? Is this a standard practice? If yes, are we going to keep all these attributes via custom user attributes? Or, we need to create different groups in Azure AD B2C and then manage their roles via Groups?
No. The Identity tables (AspNetRoles, AspNetUserClaims, AspNetUserLogins, etc) won't be moved to B2C.
If you need these data (usually we need roles) and you are using built-in user flow, it's recommended to use custom attributes.
Group claim is also supported in this case if you are using custom policy.
See my previous answer for more details.

Can I Use ADConnect to migrate users to Azure B2C

The documentation for Azure Active Directory B2C states ADConnect can’t be used to migrate users. I believe this is referring to the native store.
“No, Azure AD Connect is not designed to work with Azure AD B2C.”
https://learn.microsoft.com/en-us/azure/active-directory-b2c/active-directory-b2c-faqs
But can I use ADConnect if I configure Azure Active Directory as an Identity Provider?
https://learn.microsoft.com/en-us/azure/active-directory-b2c/active-directory-b2c-setup-oidc-azure-active-directory
If you setup sync to an Azure AD from on-prem AD with AAD Connect,
and then connect that AAD as an identity provider to B2C,
it will work.
Note you should use another Azure AD tenant for this, OT the one underneath the B2C tenant.
It also works quite nicely at least based on my short testing that if you have a single IdP in the sign-in policy, the B2C pages don't even show up.
Of course the first time, users will have to "sign up" to the B2C tenant with their AAD account.
Technically the sentence is correct that you can't migrate users to B2C with AAD Connect, but there is this roundabout way of doing it.
Technically the users are not migrated to B2C, but we migrate them to a place where they can be utilized from by B2C.

Resources