How to assign Microsoft Teams policies with PowerShell


Microsoft Teams is a popular platform for video, chat, and telephony services for many organizations, and due to its ubiquitous nature, it requires strict management by administrators.

Microsoft Teams integrates with Office 365 services, including SharePoint Online, Exchange Online, and Planner. The first concern is security when deploying services for video calls, instant messaging chats, and meetings. Many organizations will limit deployment from the early days of deployment as they determine the security controls and policies needed to ensure everything is protected.

Microsoft Teams uses policies to control or limit specific features or components by user or by group. Organizations monitor feature sets as needed to limit potential security issues. Policies are not specifically security controls, such as multi-factor authentication or conditional access policies, but used to limit end user actions.

What are the policies of Microsoft Teams?

Microsoft Teams policies can control many tasks across multiple areas such as messaging, meetings, and apps. Some policies allow users to schedule meetings in a team’s channel, edit sent messages, and control whether users can pin apps to the Teams app bar. IT manages policies in the Microsoft Teams admin center or through PowerShell.

What types of Microsoft Teams policies can organizations create?

There are five main Microsoft Teams policies: policy package, meeting policy, voice and calling policy, app policy, and messaging policy.

  • Policy packages in Microsoft Teams are a collection of predefined policies and settings assigned to users with similar roles.
  • Meeting policies control what features are available for meeting participants scheduled by users in your organization.
  • Voice and call policies control emergency calls, call routing, and caller ID.
  • App policies control apps in Microsoft Teams. Organizations can allow or block apps that users can install, pin apps to a user’s Teams app bar, and install an app on behalf of users.
  • Email policies control the availability of chat and channel features.

How to assign Microsoft Teams policies to end users

There are several ways to assign Microsoft Teams policies to users. Organizations can set a policy directly for end users, either individually or for the assigned security group. Global policies apply to the greatest number of users in the organization. It is best to assign policies only to users who require specific policies.

The Microsoft Teams admin center or the Teams PowerShell module is used to assign policies to individual users, security groups, user batches, or even a policy package.

Why use PowerShell to manage Microsoft Teams policies?

For deployment or configuration tasks in Microsoft 365 / Office 365, PowerShell is always a primary option for admins. PowerShell is a great automation tool used to create repeatable and reusable functions and code.

PowerShell is the perfect tool to ensure that objects deploy consistently across multiple tenants. PowerShell also offers better error handling and better logging compared to the Teams admin center.

How to work with Microsoft Teams policies in PowerShell

Originally, the PowerShell commands used to manage Microsoft Teams belonged to the Skype for Business Online connector. Microsoft retired Skype for Business Online on July 31; organizations should upgrade from Skype for Business Online Connector and use the latest version of Microsoft Teams PowerShell module instead.

To get started, install the Microsoft Teams module using PowerShell. The system must be running Windows PowerShell version 5.1 or higher and have .NET Framework 4.7.2 or higher installed. Install PowerShellGet with the following command:

Install-Module -Name PowerShellGet -Force -AllowClobber

Next, install the Microsoft Teams module.

Install-Module -Name MicrosoftTeams -Force -AllowClobber

If that fails, import the module into the current PowerShell session with the following command:

Import-Module MicrosoftTeams

Then sign in to Microsoft Teams by specifying an authentication object or by using the modern authentication browser approach.

# Setting credential approach
$credential = Get-Credential
Connect-MicrosoftTeams -Credential $credential
# Modern authentication browser approach Connect-MicrosoftTeams
Sign in to an authenticated account to use the Microsoft Teams PowerShell module.

Once logged in, commands are available to set up and configure Microsoft Teams policies. For example, to view a list of all email policies, run the following command:

Get-CsTeamsMessagingPolicy

Each configured policy type will be returned with its property name and current value.

To create an email policy, use the New-CsTeamsMessagingPolicy order. The following example denies the user access to post giphys and memes.

New-CsTeamsMessagingPolicy `
      -Identity DemoMessagingPolicy `
      -AllowGiphy $false `
      -AllowMemes $false

To update an existing policy, use the Set-CsTeamsMessagingPolicy command for the corresponding policy type. For example, use the following command to update a policy named DemoMessagingPolitics to restrict the use of stickers:

Set-CsTeamsMessagingPolicy `
      -Identity DemoMessagingPolicy `
      -AllowStickers $false

The PowerShell commands for creating policies are similar in syntax and usage. Microsoft provides more information about each Teams policy command in its Skype for Business documentation:

How to assign Microsoft Teams policies with PowerShell

Policy assignment uses the Grant-CsTeamsMessagingPolicy command for the specified type of policy. The cmdlet runs for a specific user passed as an argument or for a list of users from a value passed in PowerShell.

# Assign a single specified user
Grant-CsTeamsMessagingPolicy `
      -Identity "[email protected]" `
      -PolicyName DemoMessagingPolicy
# Assign all Teams users filtered to a department Get-CsOnlineUser -Filter { Department -eq 'Sales' } | ` Grant-CsTeamsMessagingPolicy ` -PolicyName "DemoMessagingPolicy"

The results of these PowerShell commands will appear in the Teams admin center, usually after several minutes.

Microsoft Teams policies in the admin center
Policies created with Microsoft Teams PowerShell commands appear in the Teams admin center.

Choose between PowerShell and the Microsoft Teams admin center

The Teams admin center is a good choice for managing all aspects of Microsoft Teams. Every component, like policies, is available in the browser. All policies can be created in the admin center, assigned to users, updated and deleted. However, the Admin Center, especially when performing batch updates such as group assignments, does not provide detailed feedback, information, or error handling.

PowerShell provides a higher level of detail by running commands encapsulated in the code and handling standard PowerShell errors. When administrators deploy to multiple tenants, manage the tenant from a remote machine, write other Microsoft 365 / Office 365 functionality, or use one of the CLI functionality in Microsoft 365 and Azure, PowerShell is the best way to manage Microsoft Teams.


Source link

Previous WhatsApp bids farewell to one of the features it launched during the pandemic
Next custom backgrounds, emoji and more

No Comment

Leave a reply

Your email address will not be published. Required fields are marked *