Azure AD - Identity Experience Framework - Custom Policy - azure

I want to implement custom policy in the Identity Experience Framework to authenticate Azure AD users. I have successfully uploaded the XML files for local and Azure AD users.
When I run the sample application and try to log n using the Azure AD account, I got the following error.
Error message:
AADB2C90240: The provided id_token is malformed and could not be parsed. Please provide another token and try again
so, someone can help to solve this. Thanks in Advance.

The error usually occurs if there is issue with the ID token as mentioned in this MsDoc.
I agree with Markus Meyer, to resolve the error try generating the token with symmetric keys.
Create a shared key and add Azure AD B2C add the signing key like below:
Go to Azure Portal -> Azure AD B2C -> Policies -> Identity Experience Framework -> Policy Keys -> Manual
Use IdTokenHintKey for Name and enter the sign-in key in the secret box.
Use encryption for usage and create.
Create a technical profile which validates the token.
Create a policy
To know how to do it in detail, please refer below link:
Define an ID token hint technical profile in a custom policy - Azure AD B2C | Microsoft Docs

Related

azure functions and AD B2C integration

I have SPA made by react.
And user authentication is done with Azure AD B2C.
Right now, we are trying to figure out a mechanism to get an access token to access the backend after a user logs in.
The backend is Azure functions.
I think it is set up through "Application Registration" in Azure AD B2C, but I don't know the details.
I see that there is an azure functions URL
http://[yourapp].azurewebsites.net/api/[funcname]?code=[functionkey]
but where should I set it?
Please tell me...
No, functionkey is an authorization at the function level, it has no relationship with Azure AD B2C. You need to add some code to send the received bearer token against Azure AD to validate it.
There's a full sample about how to do it in here: https://medium.com/cheranga/azure-functions-validate-azure-active-directory-tokens-using-your-own-custom-binding-4b4ff648d8ac

Unable to have Azure AD B2C issue a token and redirect it to https://jwt.ms

Back in a few months ago, I registered an app in Azure AD B2C, defined identity experience policies and had the token decoded by https://jwt.ms successfully. I followed the steps outlines in this document, this one and also this document and it led me to success.
I needed to create another Azure AD B2C directory for a client and repeated the same steps in those articles to at least get the tokens decoded by https://jwt.ms but no luck at all! I am really baffled by why I keep getting the following screen when trying to run the policy despite I defined https://jwt.ms as a reply URL:
Could you please guide me what I am missing in this configuration?
It only happens if you don’t have an AAD B2C application registration created in the directory.
Follow this
https://learn.microsoft.com/en-us/azure/active-directory-b2c/tutorial-register-applications?tabs=app-reg-ga
The key step is this
Under Supported account types, select Accounts in any identity provider or organizational directory (for authenticating users with user flows).

VSO scope in Azure AD identity provider

I am building a bot which will be calling Azure DevOps to update the work item (scope required - vso.work_write Update Work item ). For this I want to have the user authenticate itself using OAuth. Following Authentication doc I created the bot channel registration followed by identity provider and then registering the identity provider in my bot. Now when I go to my identity provider under API permission -> Add a permission -> Azure Devops all I see is a "user_impersonation" permission whereas my requirement is to add a vso.work_write permission to modify ado work items.
How can I add a vso.work_write permission to my identity provider so that my bot picks up the required scope while building the token ? Or is there any method to manually enter the scope in the bot code ?
Note :- I tried giving "user_impersonation" scope and generating the token with that scope but I still get a 401.
Edit 1 :-
I am able to generate a jwt token but using that token I am not able to hit ado endpoint that's why I am suspecting it to be a scope issue only.
You could try the following steps:
You could use the URL: https://token.botframework.com/.auth/web/redirect to create an App registration.
Grant the user_impersonation to the APP and generate the secret.
Go to Bot service -> Settings -> OAuth Connection Settings -> Add Setting
Select the Azure Active Directory and input the info.
Scopes: openid, email, profile, and offline_access. You could select openid
Based on your description, the vso.work_write scope exists in the Outh Token and PAT (Personal Access token).
You can also refer to the doc to generate the Azure Devops outh token and use it in the Bot Service settings.
Here is a ticket with the similar issue, you could refer to it.

Programmatically switch 'local' IdentityProvider to Username via MS Graph API in Azure AD B2C

I'm trying to script a B2C tenant and need to switch the Local Accounts Identity Provider to be Username based instead of email as per below picture.
MS Graph API returns an empty list for the path GET https://graph.microsoft.com/beta/{tenantid}/identityproviders.
Is it possible to switch this programmatically?
I can migrate to the trustframework policy xml upload method if necessary but it seems like overkill.
The scene you described should be for Azure AD B2C instead of Azure AD B2B.
It has a limitation in Microsoft Graph currently.
When we try to List identityProviders, local account identity Provider won't be listed in the response. See reference here.
The supported types for identityProviders are:
Microsoft
Google
Amazon
LinkedIn
Facebook
GitHub
Twitter
Weibo
QQ
WeChat
So I'm afraid that we can't update the local account identity Provider via Microsoft Graph API.
If you are using user flow, I think the easiest way is to change it in Azure Portal.
If you can use custom policy, modify the configuration in custom policy is necessary.

Azure AD B2C multi step page in custom policy

Is It possible to create a multi step sign up custom policy in azure ad b2c ?
I mean I need to capture personal details and verify them against my database if valid? Then second page to create a username and password and store them in azure active directory.
Since I already have a design implemented for these pages I don't want to change this by using ad b2c.
Please help.
Yes, this is possible, see the Wingtip sample for Azure AD B2C custom policies which contains a sign-up or sign-in policy that includes multiple orchestration steps.
You will have to validate the personal details via a REST API.

Resources