I am trying to execute B2C user creation on our company's Azure Directory. As reference, I use this site from Microsoft, and the .DotNet example in it.
I thoroughly follow the example, and I get to the point where I get authenticated, and I am able to extract the AD users in the directory. Here is the sample request I generated.
GET https ://graph.windows.net/mycompany/users?api-version=beta
But when I get to the part of creating a sample user in the directory, I get the error response "One or more properties contains invalid values".
POST https ://graph.windows.net/mycompany/users?api-version=beta
Here is the payload, I used, which is the exact same payload used in the site's example for user creation. This is in JSON format.
{"accountEnabled": true,"alternativeSignInNamesInfo": [{"type": "emailAddress", "value": "joeconsumer@gmail.com"}],"creationType": "NameCoexistence", "displayName": "Joe Consumer", "mailNickname": "joec","passwordProfile": {"password": "P@ssword!","forceChangePasswordNextLogin": false},"passwordPolicies": "DisablePasswordExpiration"}
This payload conforms with the requirements based on the User Creation requirements from Microsoft, also, it is the exact same payload in the site's example, which is why it is strange that I am receiving the a message that one of the properties has invalid values. The worse thing is, the response does not explicitly state which value is the source of the problem.
Any help would be appreciated.
I got this error when trying to create a user with a sign in name where the type was set to userName and the value was actually an email address. I thought username would allow any arbitrary string, but apparently if you want to use an email as a username the type must be set to emailAddress before it will pass Microsoft's validation.
I don't think this is possible on your company's Active Directory, you need to create a seperate B2C Active Directory.
Follow this tutorial to create a B2C directory: https://azure.microsoft.com/en-us/documentation/articles/active-directory-b2c-get-started/
Do you have B2C tenant created and it has application that is created in Azure AD.
Can you please try this payload, it works fine for me.