3
votes

When you adding a user to Azure Active Directory via the old portal you see this screen: enter image description here It allows you to add a user with an existing microsoft account.

I need to import many users with existing microsoft accounts. I'm planning on writing a powershell script to achive that.

How do I add an exising microsoft account to Azure AD with a powershell script?

New-AzureADUser complains that "userPrincipalName" is invalid, as can be seen in this question. Is there another way?

3

3 Answers

1
votes

Unfortunately, Azure PowerShell modules do not support adding Microsoft accounts to Azure Active Directory. The only way to utilize this feature is to use the old Azure Portal https://manage.windowsazure.com/

1
votes

This works using New-AzureADMSInvitation.

> Install-Module AzureAD
> Import-Module AzureAD
> Connect-AzureAD
> New-AzureADMSInvitation -InvitedUserEmailAddress 'test@test.com' -InviteRedirectUrl 'https://portal.azure.com'

Your output will contain an InviteRedeemUrl that the invitee should open in a browser which is already logged in with their Microsoft Account. There are other optional parameters that can be passed to New-AzureADMSInvitation. See the documentation here.

0
votes

Are you sure you want to import all of the accounts? Azure Active Directory supports B2B model.

B2B is based on invitation model which lets you enable access to your corporate applications from partner-managed identities. You can provide email along with the applications you want to share and send invitation to your partners, customers or anyone else who have account in Azure Active Directory. Azure AD sends them an email invite with a link. The partner user follows the link and is prompted to sign in using their Azure AD account or sign up for a new Azure AD account.

In my opinion you don't have to import users. More info here: https://azure.microsoft.com/en-us/documentation/articles/active-directory-b2b-collaboration-overview/