Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Convert Azure Active Directory AAD User from Member to B2B Member. Associated blogpost https://blog.darrenjrobinson.com/convert-azure-ad-users-from-members-to-b2b-members/
# Invite User Request
$inviteDetails = @{
"invitedUserEmailAddress" = $externalEmail.otherMails[0]
"invitedUser" = @{"id" = $updatedUser.id }
"sendInvitationMessage" = $true
"inviteRedirectUrl" = "https://myapps.microsoft.com?ResourceTenantName.com"
"invitedUserMessageInfo" = @{
"messageLanguage" = "en-AU"
"customizedMessageBody" = "Hi $($updatedUser.displayName), Your user account '$($updatedUser.userPrincipalName)' in the Contoso Azure Tenant has been migrated to a Guest account federated to your Fabrikam '$($updatedUser.otherMails[0])' account. After selecting 'Get Started' below you will be able to access Contoso using your Fabrikam account and credentials. All you access and privilages remain intact. Regards, Contoso IT"
}
}
$inviteBody = $inviteDetails | ConvertTo-Json
$invite = Invoke-RestMethod -Headers @{Authorization = "Bearer $($accessToken.AccessToken)"; "content-type" = "application/json" } `
-Uri "https://graph.microsoft.com/v1.0/invitations" `
-Method Post `
-body $inviteBody
$invite
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.