Forum Discussion
bstroot
Sep 24, 2024Copper Contributor
New external/local user in B2C tenant
Hello, I'm trying to use Microsoft Graph API in PowerShell to create external/local users in our B2C tenant, but I receive the following error: "The domain portion of the userPrincipalName property ...
bstroot
Sep 26, 2024Copper Contributor
Thank you for your reply. For anyone finding this in the future, my problem was that I was trying to specify the user principal name. My script works fine if I do not specify the user principal name.
balasubramanim
Sep 26, 2024Iron Contributor
the issue arose because you were explicitly specifying the UserPrincipalName. In Azure AD B2C, it's better to exclude the UserPrincipalName for external/local users and let the system handle it through the identities field.
For anyone facing a similar issue, the key solution is:
Do not manually specify the UserPrincipalName when creating external or local users in an Azure AD B2C tenant. Instead, focus on defining the user identity using the identities parameter to ensure the user is correctly recognized as an external user.
By exclude the UserPrincipalName, the system can handle the user creation process correctly.