
Lead Image © vska, 123RF.com
PowerShell scripts for managing Microsoft 365 components
Master Key for the Cloud
Different components of Microsoft 365 use different portals for managing services such as Teams, SharePoint, and Exchange, making administration difficult. With an arsenal of scripts and the appropriate PowerShell modules, however, many recurring activities can be conveniently controlled from the command line.
Many companies use Microsoft Teams when it comes to enterprise collaboration. The system relies on Microsoft 365 Groups to assign permissions in Exchange, SharePoint, and in itself and to control its functions. Microsoft 365 Groups are stored in Azure AD and are managed there – including the memberships for internal and external users. It's a good idea to start with Groups.
Controlling Microsoft 365 Groups
A new Microsoft 365 group can act as a team in different ways. You can either take the Exchange PowerShell approach with
Connect-ExchangeOnline -userPrincipalName <user@example.com> New-UnifiedGroup -DisplayName "<groupname>" -Alias "<groupalias>" -Owner <user@example.com>
or use the Azure AD PowerShell modules:
Connect-AzureAD New-AzureADMSGroup -DisplayName "<groupname>" -MailNickname "<groupalias>" -GroupTypes "Unified" -MailEnabled $true-SecurityEnabled $true
The Unified
group type identifies the Microsoft 365 groups that are used for Teams and Yammer, as well as permissions and mailing. Azure AD PowerShell distinguishes between the New-AzureADGroup
and New-AzureADMSGroup
cmdlets for traditional and Microsoft 365 groups, respectively.
If you have not installed the Exchange Online PowerShell cmdlets, do so in a PowerShell session as administrator and import the module as a normal user:
Install-Module ExchangeOnlineManagement Import-Module...
Buy this article as PDF
(incl. VAT)