Why Azure B2C app registration owned app not appearing in Enterprise Applications? - azure

I've registered the B2C SAML app with the help from https://learn.microsoft.com/en-us/azure/active-directory-b2c/saml-service-provider?tabs=windows&pivots=b2c-custom-policy
I'd like to try Idp initiated sign-in using myapplications.onmicrosoft.com, but I could not find the my SAML app on myapplications list. I guess the reason being that "App registration" based SAML application is not displaying under B2C tenant active directory "Enterprise Applications" blade. In Idp Initiated myapplications.onmicrosoft.com will only shows the apps icons of enterprise applications list?
My question here,
Why Azure AD B2C "App registrations" - owned SAML application is not listing under B2C tenant enterprise applications? Is this expected behaviour?
If I need to use Idp initiated sign-in page for my B2C SAML application, what would be the correct approach?
I appreciate if you can shed any light on this.
Thanks.

Yes that is expected.
The federation style app registration(Saml or ws-Federation) is intended to provide Idp for old Apps(Saml or ws-Federation) living in other realm. As they has nothing to do with the AAD B2c, Enterprise application (local representation or service principal of the app) is not needed. Also they are pretty old protocol comparing to oath2/openid connect.
So in AAD world, you want to register you app using the default app registration, where you can choice single tenant(an enterprise application will be automatically created in the same tenant) or multiple tenant(manually create enterprise application in each tenant) and you use oath2/openid connect to initiate login.
https://learn.microsoft.com/en-us/aspnet/core/security/authentication/azure-ad-b2c?view=aspnetcore-5.0
.

To answer the second question, it's described here.
You need to set:
<Item Key="IdpInitiatedProfileEnabled">true</Item>
and the URL is of the form:
https://<tenant-name>.b2clogin.com/<tenant-name>.onmicrosoft.com/<policy-name>/generic/login?EntityId=app-identifier-uri

Related

Azure AD B2C Authentication - Restrict to only certain customer users

I have an ASP.Net core web application and integrated authentication using the Azure AD B2C Tenant/Application. I'm able to authenticate and get the user claims in my web application.
But what I additionally want is to allow only certain customer users access the web application. I want to do this at the B2C Tenant itself. Right now any B2C customer user can sign in. Any help, ideas, insight will be appreciated.
You may know there is an Manage user assignment for an app feature in Azure Active Directory. But it's not available in Azure B2C.
Currently the recommended way to control the access in Azure B2C is defining custom attributes and check the claims in token.
If the expected claim is included, you allow the user to continue.

How to implement SSO in Node.JS Azure AD B2C

I have 4 Node.JS Application frontend angular with different domains, I have implemented Azure AD B2C
I need to implement SSO or Single Sign On in my applications
How can I set it up, what is the recommended way.
I checked https://github.com/AzureAD/passport-azure-ad
but there is no documentation on setting up SSO for Node.JS applications or sample codes.
Go to Azure AD B2C->User flows(policies)->find your sign in policy->properties->you will find the single sign-on configuration.
The default setting is tenant which allows multiple applications and user flows in your B2C tenant to share the same user session. For example, once a user signs into an application, the user can also seamlessly sign into another one.
Reference:
Configure session behavior in Azure Active Directory B2C

What is the Distinction Between Registered Apps That Can And Cannot Authenticate Using B2C?

Some of the applications registered in my Azure AD B2C directory display this message on their overview page:
You can use this application to authenticate against Azure Active Directory, but not Azure AD B2C
Many others do not.
Since my code will rely on B2C authentication using client ID's from these registrations I need to know whether I can "fix" these application registrations or whether I need to create new ones.
What's the difference between these applications? Is it the way in which they were created, or is it setting(s) that can be adjusted to permit B2C authentication?
Clicking on the message itself only links to the Azure B2C overview page, which is not very specific help.
To test the concept, I'm using msal 1.1.3 and a simple client side configuration. But as this message appears on the azure portal dashboard I don't think that's at issue:
const msalConfig = {
auth: {
clientId: `${MyClientId}`,
authority: `${MyAuthorityURL}`,
redirectURI: `${MyRedirect}`
},
cache: {
cacheLocation: "localStorage",
storeAuthStateInCookie: true
}
};
const msalApplication = new Msal.UserAgentApplication(msalConfig);
B2C does not support Daemons/server-side applications, Web API chains (on-behalf-of flow), or faulted apps (i.e. apps edited on other application portals such as the application registration portal; apps edited via Graph API; or apps edited via Powershell). Was the app ever edited in one of these places? If that is the case you will need to delete and recreate the application. This document describes the kinds of apps supported and not supported within B2C.
Also, of course make sure that the application is registered in b2c and not just in the regular AAD. https://learn.microsoft.com/en-us/azure/active-directory-b2c/tutorial-register-applications?tabs=applications
Since the message in the screenshot does not appear to be documented I have reached out to the product team to ask for a more detailed explanation of that message and its context. I will update this thread as soon as I have that.
Since my code will rely on B2C authentication using client ID's from
these registrations I need to know whether I can "fix" these
application registrations or whether I need to create new ones.
You need to create new applications under Azure AD B2C.
If you created the application under Azure Active Directory and open it under Azure AD B2C, you will see that warning.
What's the difference between these applications? Is it the way in
which they were created, or is it setting(s) that can be adjusted to
permit B2C authentication?
One is used for Azure AD, and the other one is used for Azure AD B2C. Yes, it is in the way they were created.
I have answered this question here - microsoft graph rest api beta: application created by api in azure ad b2c is not valid
For an application to successfully work in AAD B2C(get a token), it has following requirements
It needs to have a service principal
Consent to openid and offline_access scope on Microsoft Graph service principal in the tenant
Azure Active Directory does not have these requirements but Azure Active Directory B2C does.
The reason is that consent experience cannot be shown to the enduser in Azure Active Directory B2C while in Azure Active Directory, it is shown to the user.

Azure AD B2C and ADFS as SAML IdP. Code example?

I want users of my application authenticated in a couple of on-premises ADFS servers.
I setup Azure B2C working together with ADFS as SAML identity provider.
The setup process is described here in MS official docs https://learn.microsoft.com/en-us/azure/active-directory-b2c/active-directory-b2c-custom-setup-adfs2016-idp
That was complicated, but now my custom policy B2C_1A_SignUpOrSignIn works, in meaning that it redirects to B2C login page with buttons first, then I click a button and system redirects to ADFS login page, where asks users for login and passwords.
But how to integrate it with a .NET or Node.js application?
Any code examples?
Samples for different platforms can be found at Azure Active Directory B2C code samples.
If a sample application references a built-in policy, such as "B2C_1_SignUpOrSignIn", then you must replace this with your custom policy.

ADFS SSO in UWP App

I am facing a hopefully simple problem:
I need to create a wrapper app that contains a WebViewer control and should display a page in Azure portal.
I am developing the app in VS 2017 on a virtual machine which belongs to the domain 'DEV'. I would like to achieve that if a user from 'PROD' domain starts the app on their computer in the 'PROD' domain, they will be authenticated to AAD/Office 365 via SSO and can view the page in Azure (not a site in azurewebsites.net, but a site that needs you to be authenticated - i.e. portal.azure.com!).
I was not yet able to test the app on 'PROD' domain, but according to the answer below it would work, wouldn't it?
https://stackoverflow.com/a/9593258
If not can I go through the steps in the white paper mentioned and SSO the user manually (chapter 5.3, I assume)?
EDIT
Took me while, but here it is - I got SSO working, sort of...
In the end it seems that using a WebViewer control allows SSO but it still requires you to at least once enter your user name (user#tenant.com, for example) but you don't need a password. This might not be an optimal solution, nevertheless it is OK.
Thank you Wayne Yang for your support.
For your sceanrio, the user can SSO in PROD domain if the device has AAD joined.
But this should SSO to the joined AAD tenant. I also assume that you want to SSO to Azure portal with the ADFS. So, it also needs integrate ADFS with the AAD.
Why?
First, if your application try to sign in Azure portal via pop-up a broswer, and it needs SSO. AAD join can achieve this. If a device joined AAD, it will obtain a refresh token to your device. For windows 10 , IE and Edge can use the refresh token to SSO AAD endpoint.
Second, If you want to use ADFS, you must integrate ADFS with Azure AD. In this way, AAD authentication endpoint will redirect to your ADFS to approach SSO with your local domain.
Reference:
How to configure hybrid Azure Active Directory joined devices
Federate multiple instances of Azure AD with single instance of AD FS
Azure AD Connect and federation
Hope this helps!

Resources