Quantcast
Channel: Powershell – TheITBros
Viewing all articles
Browse latest Browse all 91

How to Create a New Office 365 Account?

$
0
0
Create a New Office 365 User Account

To use Office 365 resources, you must create a user. You can create a new user via the Microsoft 365 admin center or using PowerShell.

Creating a New Office 365 Account via Admin Center

  1. Browse and login to the Azure admin center at https://admin.microsoft.com;
  2. Go to UsersActive users, and click Add a user;
    create new office 365 email account
  3. Fill in the fields: Name, Domain, Password settings. You can create a password manually or automatically generate it. It is advisable to enable the option Require this user to change their password when they first sign I;
    create a new office 365 account
  4. Next, you need to select the user’s location and assign a license to the user (this step can be skipped);
    create new user office 365
  5. Next, you need to assign roles to the user. If this is a non-admin user, only the User: no administrator access option should be left.
    create new office 365 user account

Using PowerShell to Create a New User in Office 365

You can also create an Office 365 user using PowerShell.

First you need to connect to your Office 365 tenant from the PowerShell console. You can use the AzureAD module or MSOnline.

In order to connect your Azure tenant you can use the Azure Active Directory PowerShell for Graph module.

Install AzureAD module on your computer:

Install-Module -Name AzureAD

Hint. For more info check our post.

Authenticate on your Azure tenant with your Office 365 admin account

Now you can create a password profile variable:

$PasswordProfile=New-Object -TypeName Microsoft.Open.AzureAD.Model.PasswordProfile

$PasswordProfile.Password="$tr0ngP@ss0rd"

To create new Office 365 user, the New-AzureADUser cmdlet is used:

New-AzureADUser -DisplayName "Brian Jackson" -GivenName "Brian" -SurName "Jackson" -UserPrincipalName b.jackson@theitbros.onmicrosoft.com -UsageLocation UK -MailNickName b.jackson -PasswordProfile $PasswordProfile -AccountEnabled $true

Also, you can use the Azure Active Directory Module for Windows PowerShell.

Install the MSOnline module:

Install-Module MSOnline

Save your Office 365 admin credentials:

$MSOCred = Get-Credential

office 365 add new user

Connect to your subscription with saved credentials

Connect-MsolService -Credential $MSOCred

Now you can use the New-MsolUser cmdlet to create a new user:

New-MsolUser -DisplayName "Brian Jackson" -FirstName Brian -LastName Jackson -UserPrincipalName b.jackson@theitbros.onmicrosoft.com -UsageLocation UK -LicenseAssignment theitbros:ENTERPRISEPACK

Hint. If you don’t want to assign an Office 365 license to user, you can skip the–LicenseAssignment option.

Also you can create user accounts in bulk. Create a plain CSV file that contains a list of user you want create to:

UserPrincipalName,FirstName,LastName,DisplayName,UsageLocation,AccountSkuId
b.jackson1@theitbros.onmicrosoft.com,Brian1,Jackson1,Brian Jackson1,UK,contoso:ENTERPRISEPACK

b.jackson2@theitbros.onmicrosoft.com,Brian2,Jackson2,Brian Jackson2,UK,contoso:ENTERPRISEPACK

Now you can import these CSV file and create all user account specified:

Import-Csv -Path "C:\PS\NewOffice365Accounts.csv" | foreach {New-MsolUser -DisplayName $_.DisplayName -FirstName $_.FirstName -LastName $_.LastName -UserPrincipalName $_.UserPrincipalName -UsageLocation $_.UsageLocation -LicenseAssignment $_.AccountSkuId}

You can use the Get-MsolUser cmdlet to view Office 365 user details.

Once you have created an Office 365 user, you can assign a license, create mailboxes, etc. In previous article, we showed how to manage Office 365 users with PowerShell.

The post How to Create a New Office 365 Account? appeared first on TheITBros.


Viewing all articles
Browse latest Browse all 91

Trending Articles