• Download our FREE True Price of Office 365 Whitepaper
  • Give us a call: 877-788-1617

    Stay in the know with the MessageOps newsletter:

    Office 365 Tech Tip: Creating a User in Powershell and Assigning a Role to a User

    One of the great things about using Windows Powershell is the ability to assign a role to a user. When you’re TechTips-by-MessageOps Creating a User in Powershell and Assigning a Role to a Userorganized, things generally run much smoother. Having the ability to create a users and assign roles to them ensures that users are held responsible, and accountable, for tasks assigned to them.

    After reading this tech tip, you will be able to create a new user, assign a role and set a password in Windows Powershell.

    Scenario:
    An Administrator wants to create a new user using the Windows Azure Powershell module and wants to assign certain roles to the user. In the example below, I am creating a user in Powershell, assigning Global Administrative permissions and also setting a password.

    Solution:Tech Tips Avatar Message Ops Creating a User in Powershell and Assigning a Role to a User
    1) Connect to Exchange Online using Remote Powershell.

    2) Run the following command to create the user
    Command: New-MsolUser -UserPrincipalName csg@ur-tenant.onmicrosoft.com -DisplayName “CSG” -FirstName “CSG” -LastName “CSG”

    3) Once the user is created decide which role you want to assign to the user.
    Command: Add-MsolRoleMember -RoleName “Company Administrator” –RoleMemberEmailAddress  csg@ur-tenant.onmicrosoft.com

    3) Set a password to the newly created user
    Command: Set-MsolUserPassword -userPrincipalName csg@ur-tenant.onmicrosoft.com -NewPassword “Abcd1234” -ForceChangePassword $false

    Below is a list of the roles that can be assigned to a user.
    Tech_Tip_MessageOps_Creating_a_User_in_PowerShell_

    For more information on creating a user and assigning roles in Powershell, check out:

    Connect to Exchange Online Using Remote PowerShell
    Assigning Administrator Roles

     

    Ready to get started? Contact us today to learn more.

    CONTACT US