Reader small image

You're reading from  Microsoft Office 365 Administration Cookbook

Product typeBook
Published inSep 2020
PublisherPackt
ISBN-139781838551230
Edition1st Edition
Right arrow
Author (1)
Nate Chamberlain
Nate Chamberlain
author image
Nate Chamberlain

Nate Chamberlain is a technical content creator, solution architect, and trainer, recognized as a 5-year Microsoft MVP. With a background in business analysis and systems administration, Nate has authored seven books and manages his blog. He holds an array of certifications, including M365 Enterprise Administrator Expert and Microsoft Power Platform App Maker Associate, and is a frequent speaker at user groups and conferences.
Read more about Nate Chamberlain

Right arrow

Adding/removing users via PowerShell in AAD

This recipe should begin to get you thinking about how you could potentially automate regular processes in your organization by utilizing PowerShell as part of your automated job. While we'll manually add a user to Azure AD in this recipe, you could have the same PowerShell script run based on a trigger from your HR system, by way of an example. For now, we'll start with the basics – running the script itself manually to add a user.

Getting ready

You must be a global administrator to complete the steps in this recipe.

How to do it…

  1. Open Windows PowerShell (or your PowerShell client of choice) as the administrator.
  2. Connect to Azure AD using Connect-AzureAD.
  3. Use a script such as the following, replacing the user's specific info where appropriate.
    $PasswordProfile = New-Object -TypeName Microsoft.Open.AzureAD.Model.PasswordProfile
    $PasswordProfile.Password = "aBc123!ndc"
    New-AzureADUser...
lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Microsoft Office 365 Administration Cookbook
Published in: Sep 2020Publisher: PacktISBN-13: 9781838551230

Author (1)

author image
Nate Chamberlain

Nate Chamberlain is a technical content creator, solution architect, and trainer, recognized as a 5-year Microsoft MVP. With a background in business analysis and systems administration, Nate has authored seven books and manages his blog. He holds an array of certifications, including M365 Enterprise Administrator Expert and Microsoft Power Platform App Maker Associate, and is a frequent speaker at user groups and conferences.
Read more about Nate Chamberlain