Chapter 10: Microsoft Teams PowerShell – a Tool for Automation – Hands-On Microsoft Teams

Chapter 10: Microsoft Teams PowerShell – a Tool for Automation

In this chapter, we will cover the PowerShell modules available to manage Microsoft Teams. This is the most advanced chapter of the book and will teach you how you can optimize administrative tasks while managing Teams.

The PowerShell modules can be very handy and save you a lot of time while managing teams, channels, users’ apps, or even policies. In this chapter, you will cover the following topics:

  • What is PowerShell and how can you use it?
  • Installing Microsoft Teams PowerShell
  • What are the available cmdlets in the Microsoft Teams module?
  • Installing the Skype for Business PowerShell module
  • What are the available cmdlets in the Skype for Business module?
  • Learning how to use PowerShell from examples

What is PowerShell and how can you use it?

PowerShell is a command-line shell that gives you access to a framework to automate and configure processes on Windows.

First released in 2006, it is mainly used on Windows due to the technical architecture that was used in the earlier versions of PowerShell. It recently became available for other platforms, such as Linux and macOS, but most of the modules available do not support these operating systems.

Instructions on PowerShell are done through the use of cmdlets, where each cmdlet is responsible for the execution of a specific operation. Cmdlets can be combined into PowerShell scripts to automate scenarios, as we will see in this chapter.

A PowerShell script works like a programming language and you can create variables, conditions, or loops depending on the scenarios you want to automate. Scripts have the ps1 file extension and can be written with any text editor.

Note

This chapter assumes that the reader has a basic knowledge of development concepts and command line usage. If you are not familiar with programming concepts, you will find a nice book that explain all the basic concepts here: https://www.packtpub.com/application-development/introduction-programming

How to use PowerShell

In Microsoft Windows, if you open the start menu and type PowerShell, you will see that the system has multiple applications to work with PowerShell installed by default, as illustrated in the following diagram:

Figure 10.1: Opening PowerShell

Windows PowerShell is the console that allows you to execute single cmdlets, and the Windows PowerShell ISE is the editor that allows you to write automation scripts and test them.

To execute a PowerShell cmdlet, open the Windows PowerShell command line and type an instruction. Here's an example:

Get-Host | Select-Object Version

The following screenshot demonstrates how the instruction is run:

Figure 10.2: Executing PowerShell cmdlets

The execution of this cmdlet will print in the console the current version of PowerShell that is running on the operating system.

To build a script that executes several cmdlets, open the Windows PowerShell ISE and type your commands. Note that you can combine them with programming logic to format the outputs. The following script gets the version of PowerShell, and the version of Windows, and writes both on the screen:

Figure 10.3: Windows PowerShell ISE

While writing your script, you can use the editor to test it. If you click on the play button, this will execute the code and will give you the result or the execution error in the console.

To execute a script that you have built and saved previously, you must open the Windows PowerShell command line. Once open, you need to navigate to the folder where the script is located and execute it using the following syntax:

./scriptName.ps1

The following screenshot displays the script execution and the results printed in the console:

Figure 10.4: Script execution

In summary, we can say that PowerShell is a tool that allows the automation of repetitive tasks and has support for pretty much everything Microsoft-related. Now that you have been introduced to PowerShell, it’s time to install the Microsoft Teams module.

Installing Microsoft Teams PowerShell

The PowerShell module for Microsoft Teams is not installed by default on Windows, so it needs to be added to the operating system.

Most of the official modules available can be found in the PowerShell gallery, a site where you can find a description for the module, installation instructions, and also the change log of each version. The PowerShell gallery is available at https://www.powershellgallery.com/.

To get the Microsoft Teams module installed in your system, perform the following steps:

  1. On your computer, open the PowerShell command line with administrator permissions. To do so, search for Windows PowerShell on Windows and then select the option to Run as Administrator, as highlighted in the following screenshot:

    Figure 10.5: Run as Administrator

  2. On the command line, execute the following command:

    Install-Module -Name MicrosoftTeams

  3. Type Y followed by Enter to trust and enter the repository:

    Figure 10.6: Installing the Microsoft Teams PowerShell module

  4. Keep the console open while the download and installation are in progress.

Now that you have the Microsoft Teams module installed in your system, you are ready to start using it, but before doing so, you must know what cmdlets are available.

What are the available cmdlets in the Microsoft Teams module?

The cmdlets explained in this section are based on Microsoft Teams module 1.0.3 and they are divided into six different groups:

  • Connection cmdlets
  • Get cmdlets
  • Set cmdlets
  • New cmdlets
  • Add cmdlets
  • Remove cmdlets

In the following sections, you will find the name of the cmdlet, a description of it, and all the parameters you can use. The parameters are not explained in detail as the name is self-explanatory. Each parameter is followed by the data type it receives.

Data types

To better understand the cmdlets described in this section, check the data types used by PowerShell:

String: A string is used to represent text. In PowerShell, a string can be represented in the following format: This is a string.

Boolean: A Boolean is used to represent true or false. In PowerShell, Boolean values are represented in the following format: $true or $false.

While working with PowerShell, you can use the cmdlet Show-Command that will allow you to introduce the parameters through a graphical user interface. Show-Command is a very handy tool when you are still learning a PowerShell module, or you simply don’t know what parameters a cmdlet receives. Show-Command is used in the following format:

Show-Command –name “Get-Team”

Figure 10.7: Show-command cmdlet

Connection cmdlets

The descriptions and parameters of the connection cmdlets are as follows:

  • Connect-MicrosoftTeams: This is the first cmdlet you need to execute in order to get access to the Microsoft Teams context of your tenant:

    (a) -TenantId <String>

    (b) -AccountId <String>

    (c) -TeamsEnvironmentName <String>

  • Disconnect-MicrosoftTeams: After executing your cmdlets, you can close the connection to your tenant using this cmdlet.

To know the ID of your tenant, you can use the Connect cmdlet without passing any parameter. On the login popup, provide your organizational credentials and, after a few seconds, you will get the information pertaining to your tenant, as shown in the following screenshot:

Figure 10.8: Tenant ID

Get cmdlets

The descriptions and parameters of the get cmdlets are as follows:

  • Get-Team: This is used to get information about teams. It can get all the teams, archived teams, or even all the teams to which a user belongs:

    (a) -GroupId <String>

    (b) -User <String>

    (c) -Archived <Boolean>

    (d) -Visibility <String>

    (e) -DisplayName <String>

    (f) -MailNickName <String>

  • Get-TeamChannel: This retrieves all the channels in the team:

    (a) -GroupId <String>

  • Get-TeamChannelUser: This retrieves all the users of a channel, and it allows you to pre-filter users by role, that is, either Owner or Member:

    (a) -GroupId <String>

    (b) -DisplayName <String>

    (c) -Role <String>

  • Get-TeamsApp: This returns the information pertaining to the apps installed in your tenant. The distribution method accepts as a parameter Global (apps from the store) or Organization (custom apps):

    (a) -Id <String>

    (b) -ExternalId <String>

    (c) -DisplayName <String>

    (d) -DistributionMethod <String>

  • Get-TeamUser: This retrieves the user information from a team. It allows you to pre-filter users by role, that is, either Owner or Member:

    (a) -GroupId <String>

    (b) -Role <String>

Most of the Microsoft Teams cmdlets need to get the group ID as a parameter. This is the unique identifier from the Office group associated with the team. If you need to get the group ID of your team, execute the following cmdlet using the team name:

Get-Team -DisplayName “Project X”

From the result data, you will get the group ID as shown in the following screenshot:


Figure 10.9: Team details

Set cmdlets

The descriptions and parameters of the set cmdlets are as follows:

  • Set-Team: This allows you to modify the settings of an existing team:

    (a) -GroupId <String>

    (b) -DisplayName <String>

    (c) -Description <String>

    (d) -MailNickName <String>

    (e) -Classification <String>

    (f) -Visibility <String>

    (g) -AllowGiphy <Boolean>

    (h) -GiphyContentRating <String>

    (i) -AllowStickersAndMemes <Boolean>

    (j) -AllowCustomMemes <Boolean>

    (k) -AllowGuestCreateUpdateChannels <Boolean>

    (l) -AllowGuestDeleteChannels <Boolean>

    (m) -AllowCreateUpdateChannels <Boolean>

    (n) -AllowDeleteChannels <Boolean>

    (o) -AllowAddRemoveApps <Boolean>

    (p) -AllowCreateUpdateRemoveTabs <Boolean>

    (q) -AllowCreateUpdateRemoveConnectors <Boolean>

    (r) -AllowUserEditMessages <Boolean>

    (s) -AllowUserDeleteMessages <Boolean>

    (t) -AllowOwnerDeleteMessages <Boolean>

    (u) -AllowTeamMentions <Boolean>

    (v) -AllowChannelMentions <Boolean>

    (w) -ShowInTeamsSearchAndSuggestions <Boolean>

  • Set-TeamArchivedState: This archives or unarchives a team. It can also make the SharePoint site read-only for members:

    (a) -GroupId <False>

    (b) -Archived <Boolean>

    (c) -SetSpoSiteReadOnlyForMembers <Boolean>

  • Set-TeamChannel: This allows you to modify the settings of an existing channel:

    (a) -GroupId <String>

    (b) -CurrentDisplayName <String>

    (c) -NewDisplayName <String>

    (d) -Description <String>

  • Set-TeamPicture: This allows you to define the team picture for a team. The image path is the physical location of the image on your computer:

    (a) -GroupId <String>

    (b) -CurrentDisplayName <String>

    (c) -NewDisplayName <String>

    (d) -Description <String>

  • Set-TeamsApp: This allows you to update a custom app already installed in your tenant. The path is the physical location of the app package on your computer, and the ID is the unique identifier of your app:

    (a) -Id <String>

    (b) -Path <String>

New cmdlets

The descriptions and parameters of the new cmdlets are as follows:

  • New-Team: This allows you to create a new team and fill all the settings to apply by default with a single instruction:

    (a) -DisplayName <String>

    (b) -Description <String>

    (c) -MailNickName <String>

    (d) -Classification <String>

    (e) -Visibility <String>

    (f) -Template <String>

    (g) -Owner <String>

    (h) -AllowGiphy <Boolean>

    (i) -GiphyContentRating <Boolean>

    (j) -AllowStickersAndMemes <Boolean>

    (k) -AllowCustomMemes <Boolean>

    (l) -AllowGuestCreateUpdateChannels <Boolean>

    (m) -AllowGuestDeleteChannels <Boolean>

    (n) -AllowCreateUpdateChannels <Boolean>

    (o) -AllowDeleteChannels <Boolean>

    (p) -AllowAddRemoveApps <Boolean>

    (q) -AllowCreateUpdateRemoveTabs <Boolean>

    (r) -AllowCreateUpdateRemoveConnectors <Boolean>

    (s) -AllowUserEditMessages <Boolean>

    (t) -AllowUserDeleteMessages <Boolean>

    (u) -AllowOwnerDeleteMessages <Boolean>

    (v) -AllowTeamMentions <Boolean>

    (w) -AllowChannelMentions <Boolean>

    (x) -ShowInTeamsSearchAndSuggestions <Boolean>

  • New-TeamChannel: This allows you to create a new channel and fill the default settings. The membership type is the parameter where you define whether the channel is Public or Private:

    (a) -GroupId <String>

    (b) -DisplayName <String>

    (c) -Description <String>

    (d) -MembershipType <String>

    (e) -Owner <String>

  • New-TeamsApp: This allows you to install a custom app. The path is the physical location of the app package on your computer:

    (a) -DistributionMethod <String>

    (b) -Path <String>

Add cmdlets

The descriptions and parameters of the add cmdlets are as follows:

  • Add-TeamUser: This adds a user to a team as a Member or Owner:

    (a) -GroupId<String>

    (b) -User <String>

    (c) –Role <String>

  • Add-TeamChannelUser: This adds a user to a private channel as a Member or Owner:

    (a) -GroupId <String>

    (b) -DisplayName <String>

    (c) -User <String>

    (d) –Role <String>

Remove cmdlets

The descriptions and parameters of the remove cmdlets are as follows:

  • Remove-Team: This removes a team and all its associated assets, including the SharePoint site collection and the Office group:

    (a) –GroupId <String>

  • Remove-TeamChannel: This removes a channel from a team. The use of this cmdlet will not delete any of the documents relating to the channel. They will continue to exist in the team SharePoint site collection:

    (a) –GroupId <String>

    (b) –DisplayName <String>

  • Remove-TeamChannelUser: This removes a user from a private channel:

    (a) -GroupId <String>

    (b) -DisplayName <String>

    (c) -User <String>

  • Remove-TeamsApp: This removes an app from a team:

    (a) -Id <String>

  • Remove-TeamUser: This removes a user from a team:

    (a) -GroupId <String>

    (b) -User <String>

    (c) -Role <String>

Even though Microsoft Teams provides its own PowerShell module, due to the legacy of the platform, there are things such as policies that are available through the use of the Skype for Business module, as we will see in the following section.

Installing the Skype for Business PowerShell Module

As mentioned several times during the book, operations related to policies need to be performed in batches of 20 users or through the use of PowerShell. The cmdlets included in the Microsoft Teams module do not support tasks related to policies. Those operations, however, can be executed using the Skype for Business PowerShell module.

The Skype for Business module is not available in the PowerShell gallery, which means it needs to be downloaded and installed manually. To do this, perform the following steps:

  1. Open the Skype for Business download page: https://www.microsoft.com/en-us/download/details.aspx?id=39366.
  2. Click on the Download button and select the location to save it on your computer.
  3. Open the .exe file, agree with the terms and conditions, and then click on Install:

    Figure 10.10: Installing the Skype for Business module

  4. If you have a PowerShell session already opened, you need to close and restart it before using the module

What are the available cmdlets in the Skype for Business module?

The cmdlets included in the Skype for Business module have a different syntax to the ones included in the Microsoft Teams module. You can easily identify a Skype cmdlet by the Cs prefix in the name.

This module was not built specifically for Microsoft Teams, which means that most of the cmdlets are not supported by the application. In the following sections, you can find all the related cmdlets that allow you to work with Microsoft Teams policies.

Note: List of cmdlets

The Skype for Business PowerShell module includes more cmdlets than the ones described in this section. You can take a closer look at the entire list of cmdlets at the following address: https://docs.microsoft.com/en-us/powershell/module/skype/?view=skype-ps.

Get cmdlets

A description of each of the get cmdlets is as follows:

  • Get-CsTeamsAppSetupPolicy: This gets all the app setup policies in the tenant with the IDs of the pinned apps.
  • Get-CsTeamsCallingPolicy: This gets all the calling policies in the tenant with all the associated settings.
  • Get-CsTeamsChannelsPolicy: This gets all the policies defined for the channels.
  • Get-CsTeamsMeetingPolicy: This gets all the meeting policies and their settings.
  • Get-CsTeamsMessagingPolicy: This gets all the messaging policies and their settings.

Grant cmdlets

A description of each of the grant cmdlets is as follows:

  • Grant-CsTeamsAppPermissionPolicy: This applies an app permission policy to a single user:

    (a) -Identity <String>

    (b) -PolicyName <String>

    (c) -PassThru <SwitchParameter>

    (d) -WhatIf <SwitchParameter>

  • Grant-CsTeamsAppSetupPolicy: This applies an app setup policy to a single user:

    (a) -Identity <String>

    (b) -PolicyName <String>

    (c) -PassThru <SwitchParameter>

    (d) -WhatIf <SwitchParameter>

  • Grant-CsTeamsCallingPolicy: This applies a calling permission policy to a single user:

    (a) -Identity <String>

    (b) -PolicyName <String>

    (c) -PassThru <SwitchParameter>

    (d) -WhatIf <SwitchParameter>

  • Grant-CsTeamsChannelsPolicy: This applies a channel policy to a single user:

    (a) -Identity <String>

    (b) -PolicyName <String>

    (c) -PassThru <SwitchParameter>

    (d) -WhatIf <SwitchParameter>

  • Grant-CsTeamsMeetingPolicy: This applies a meeting policy to a single user:

    (a) -Identity <String>

    (b) -PolicyName <String>

    (c) -PassThru <SwitchParameter>

    (d) -WhatIf <SwitchParameter>

  • Grant-CsTeamsMessagingPolicy: This applies a messaging policy to a single user:

    (a) -Identity <String>

    (b) -PolicyName <String>

    (c) -PassThru <SwitchParameter>

    (d) -WhatIf <SwitchParameter>

New cmdlets

A description of each of the new cmdlets is as follows:

  • New-CsTeamsChannelsPolicy: This creates a new channel policy:

    (a) -Identity <String>

    (b) -AllowOrgWideTeamCreation <Boolean>

    (c) -AllowPrivateTeamDiscovery <Boolean>

    (d) -AllowPrivateChannelCreation <Boolean>

  • New-CsTeamsMeetingPolicy: This creates a new meeting policy:

    (a) -Identity <String>

    (b) -Description <String>

    (c) -AllowChannelMeetingScheduling <Boolean>

    (d) -AllowMeetNow <Boolean>

    (e) -AllowIPVideo <Boolean>

    (f) -AllowAnonymousUsersToDialOut <Boolean>

    (g) -AllowAnonymousUsersToStartMeeting <Boolean>

    (h) -AllowPrivateMeetingScheduling <Boolean>

    (i) -AutoAdmittedUsers <String>

    (j) -AllowCloudRecording <Boolean>

    (k) -AllowOutlookAddIn <Boolean>

    (l) -AllowPowerPointSharing <Boolean>

    (m) -AllowParticipantGiveRequestControl <Boolean>

    (n) -AllowExternalParticipantGiveRequestControl <Boolean>

    (o) -AllowSharedNotes <Boolean>

    (p) -AllowWhiteboard <Boolean>

    (q) -AllowTranscription <Boolean>

    (r) -MediaBitRateKb <UInt32>

    (s) -ScreenSharingMode <String>

  • New-CsTeamsMessagingPolicy: This creates a new messaging policy:

    (a) -Identity <String>

    (b) -AllowOwnerDeleteMessage <Boolean>

    (c) -Description <String>

    (d) -AllowUserChat <Boolean>

    (e) -AllowStickers <Boolean>

    (f) -AllowUrlPreviews <Boolean>

    (g) -AllowImmersiveReader <Boolean>

    (h) -AllowUserTranslation <Boolean>

    (i) -AllowUserEditMessage <Boolean>

    (j) -AllowRemoveUser <Boolean>

    (k) -ReadReceiptsEnabledType <String>

    (l) -AllowMemes <Boolean>

    (m) -AllowPriorityMessages <Boolean>

    (n) -GiphyRatingType <String>

    (o) -AllowGiphy <Boolean>

Remove cmdlets

A description of each of the remove cmdlets is as follows:

  • Remove-CsTeamsAppPermissionPolicy: This removes an app permission policy:

    (a) -Tenant <String>

    (b) -Identity <String>

  • Remove-CsTeamsAppSetupPolicy: This removes an app setup policy:

    (a) -Tenant <String>

    (b) -Identity <String>

  • Remove-CsTeamsChannelsPolicy: This removes a channel permission policy:

    (a) -Tenant <String>

    (b) -Identity <String>

  • Remove-CsTeamsMeetingPolicy: This removes a meeting policy:

    (a) -Tenant <String>

    (b) -Identity <String>

  • Remove-CsTeamsMessagingPolicy: This removes a messaging policy:

    (a) -Tenant <String>

    (b) -Identity <String>

Combining Microsoft Teams and Skype for Business PowerShell modules allows you to automate pretty much all the administrative tasks you will have to implement with Microsoft Teams. In the following section, you will learn from examples how to build your own scripts.

Learning how to use PowerShell from examples

In this section of the book, you will find four examples of how PowerShell can be used to automate tasks within Microsoft Teams and the script used to solve each of the scenarios.

The code includes comments so that you can follow along with what is happening. Comments are identified by a hashtag (#). For better readability of the code, the comments only include a number, while the comment description is provided after the code section.

Example 1: Victor

Victor is the IT guy in his company and oftentimes, his colleagues ask him to create teams according to internal policies and conventions. To avoid doing this task manually over and over again, Victor has created a PowerShell script. This includes the following:

  1. Team settings.
  2. Team default channels.
  3. Team default members.
  4. Establishing a connection to Microsoft Teams: Using this cmdlet without parameters will open a login popup and will authenticate you in your organization tenant.
  5. Team creation: The result is saved to a variable to use the group ID in the following instructions.
  6. Channel creation: This loops through the channel list to create the channel. The group ID was saved in the New-Team instruction.
  7. Adding default members to the team: This loops through the array of users and adds them to the team as members.

The following script and corresponding numbers show how Victor would do this:

#1

$teamName= ”Project Y”

$teamDescription= ”The new generation of electric skateboards”

$teamOwner= ”joao@funskating.com”

$teamVisibility= ”Private”

$teamEditMessagesPolicy= $false

$teamDeliteMessagesPolicy= $false

#2

$teamChannels= @(“Procedures”, “Legal”)

#3

$teamMembers= @(“josh@funskating.com”, “adele@funskating.com”)

#4

Connect-MicrosoftTeams

#5

$teamDetails=New-Team -DisplayName $teamName -Description $teamDescription -Owner $teamOwner -Visibility $teamVisibility -AllowUserEditMessages $teamEditMessagesPolicy -AllowOwnerDeleteMessages $teamDeliteMessagesPolicy

#6

for ($i=0; $i-lt$teamChannels.length; $i++) {

New-TeamChannel -GroupId $teamDetails.GroupId -DisplayName $teamChannels[$i]

}

#7

for ($i=0; $i-lt$teamMembers.length; $i++) {

Add-TeamUser -GroupId$teamDetails.GroupId -User$teamMembers[$i] -role”Member”

}

Disconnect-MicrosoftTeams

Example 2: John

John is heading up several projects in his company that are spread across the globe. Each project is assigned to a country and has its own team on Microsoft Teams. John wants to create a channel in each one of his teams where he can communicate the procedures for each country and where people can communicate about this topic. The script includes the following:

  1. Establishing a team owner and a new channel name definition.
  2. Connecting to Microsoft Teams and getting all the teams to which the user belongs. This will include those teams where the user is an owner and member.
  3. Looping through all the teams
  4. Getting the current team group ID and the list of owners.
  5. Looping through the owners of the team.
  6. Comparing the current owner of the team with the email defined at the top of the script. If the condition is true, this means that the current team is owned by John and a new channel is then created on it.

The following script and corresponding numbers show how John would do this:

#1

$teamOwnerEmail= ”john@funskating.com”

$channelName= ”Projects”

#2

Connect-MicrosoftTeams

$teamsWhereIam = Get-Team –User $teamOwner

#3

for ($i=0; $i-lt $teamsWhereIam.length; $i++) {

#4

$groupId= $teamsWhereIam[$i].GroupId

$teamOwners=Get-TeamUser –GroupId $groupId –Role Owner

#5

for ($j=0; $j-lt$teamOwners.length; $j++) {

#6

if($teamOwners[$j].User –eq $teamOwnerEmail){

New-TeamChannel –GroupId $groupId –DisplayName $channelName

}

}

}

Disconnect-MicrosoftTeams

Example 3: The Funny Company

The Funny Company has a very informal culture and wants to make sure that this is reflected on Microsoft Teams. From now on, all teams should have all the fun settings on. The script will do the following:

  1. Connect to Microsoft Teams.
  2. Get all teams.
  3. Loop through all teams.
  4. Get each team group ID and define the fun settings.

The following script and corresponding numbers show how the Funny Company would do this:

#1

Connect-MicrosoftTeams

#2

$allTeams= Get-Team

#3

for ($i=0; $i-lt$allTeams.length; $i++) {

#4

$groupId=$allTeams[$i].GroupId

Set-Team –GroupId $groupId –AllowGiphy $true –GiphyContentRating moderate –AllowStickersAndMemes $true –AllowCustomMemes $true

}

Disconnect-MicrosoftTeams

Example 4: Hugh

Hugh is the Microsoft Teams administrator at his company and is responsible for managing all policies. Recently, he has installed a global app where all the company news and announcements are published. Even though the adoption of Microsoft Teams is great, users are not using the new app, mainly because it is hidden in the More apps menu. To increase adoption of the app, Hugh wants to apply a new policy to all users where the company app is the first one listed in the app bar. The script will include the following:

  1. Authentication using the Skype for Business PowerShell module. This process will open a windows authentication popup where you must insert your credentials:

    Figure 10.11: Authentication window

  2. User definitions: This is the list of users to whom the new app setup policy will be applied.
  3. Looping thorough the list of users and applying the company app policy.

The following script and corresponding numbers show how Hugh would do this:

#1

Import-ModuleSkypeOnlineConnector

$credentials= Get-Credential

$sfbSession= New-CsOnlineSession -Credential $credentials

Import-PSSession $sfbSession

#2

$usersEmails= @(“peter@funskating.com”,”maria@funskating.com”)

#3

for ($i=0; $i-lt$usersEmails.length; $i++) {

Grant-CsTeamsAppSetupPolicy -identity $usersEmails[$i] -PolicyName “Company App”

}

You can use these simple scenarios as a starting point for automating tasks on Microsoft Teams. This will save you a lot of time while ensuring consistency across all your teams and policies.

Summary

In this chapter, you have learned how you can automate processes on Microsoft Teams using the PowerShell modules. After this chapter, you should be able to build your PowerShell scripts to automate the administrative tasks you need to perform in your organization.

This book gave you a global overview of what Microsoft Teams is by covering all the basic features and concepts.

As you progressed into the book, it became more technical and gave you an overview of how things can be configured as an end user or as an admin. Finally, you learned how to achieve more by extending Teams and automating processes.

Now, you should be the real hero of Microsoft Teams in your organization and you are ready to empower others to achieve more using this awesome platform.

Thank you,

João Ferreira