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 is invalid. You must use one of the verified domain names in your organization.” There must be a parameter to switch from an internal or federated user to an external one, but I’ve been unable to find it. Any help you can offer would be appreciated! Here is my script:
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 is invalid. You must use one of the verified domain names in your organization.” There must be a parameter to switch from an internal or federated user to an external one, but I’ve been unable to find it. Any help you can offer would be appreciated! Here is my script: $NewUsers = Import-Csv $NewCSVPathForEach($NewUser in $NewUsers){ $TestTheUser = $null $TestTheUser = (Get-MGUser -UserId $NewUser.UserPrincipalName -ErrorAction SilentlyContinue).Id IF ($TestTheUser) { Continue } else { $PasswordProfile = @{ Password = “Ninja%67#Dangerous” ForceChangePasswordNextSignIn = $false } $UserParams = @{ DisplayName = $NewUser.DisplayName UserPrincipalName = $NewUser.UserPrincipalName PasswordProfile = $PasswordProfile AccountEnabled = $true MailNickname = $NewUser.MailNickname identities = @( @{ signInType = “emailAddress” issuer = “<MyTenant>.onmicrosoft.com” issuerAssignedId = $NewUser.UserPrincipalName } ) passwordPolicies = “DisablePasswordExpiration” } New-MgUser @UserParams }} Read More