How to create a service account via Microsoft PowerShell

Connect to Microsoft Online using PowerShell and execute the following, where <UserPrincipalName> and <Password> are the username and temporary password (that you will be forced to change upon logging on for the first time) for the AskCody service account:

New-MSolUser -DisplayName "Service Account for AskCody" -UserPrincipalName <UserPrincipalName> -Password <Password> -PasswordNeverExpires $true

Then create a new role group, where <GroupName> is the name of the group and <UserPrincipalName> is the username of the AskCody service account:

New-RoleGroup -Name "<GroupName>" -Roles ApplicationImpersonation -Members "<UserPrincipalName>"

(If you are in Office 365, and your tenant has not yet been hydrated, you must run the Enable-OrganizationCustomization PowerShell cmdlet before you can use role-based access control features.)

Finally, log on to http://portal.microsoftonline.com/ using the service account and set the actual password that will be used.

Was this article helpful?

Comments

0 comments

Please sign in to leave a comment.