Forum Discussion

TomWechsler's avatar
Sep 11, 2023

Part 7 - Manage Azure and Microsoft 365 with the Microsoft Graph PowerShell SDK!

 

Dear Microsoft Azure and Microsoft 365 Friends,

 

This article continues with the topic Microsoft Graph PowerShell SDK. Part 1 to 6 can be found here:

 

https://techcommunity.microsoft.com/t5/windows-powershell/part-1-manage-azure-and-microsoft-365-with-the-microsoft-graph/m-p/3300352

 

https://techcommunity.microsoft.com/t5/windows-powershell/part-2-manage-azure-and-microsoft-365-with-the-microsoft-graph/m-p/3302366

 

https://techcommunity.microsoft.com/t5/windows-powershell/part-3-manage-azure-and-microsoft-365-with-the-microsoft-graph/m-p/3339696

 

https://techcommunity.microsoft.com/t5/windows-powershell/part-4-manage-azure-and-microsoft-365-with-the-microsoft-graph/m-p/3409310

 

https://techcommunity.microsoft.com/t5/windows-powershell/part-5-manage-azure-and-microsoft-365-with-the-microsoft-graph/m-p/3442453

 

https://techcommunity.microsoft.com/t5/windows-powershell/part-6-manage-azure-and-microsoft-365-with-the-microsoft-graph/m-p/3923379

 

This article is about connecting to Microsoft Teams. Remember: Connections to the Microsoft Graph are protected by one or more permission scopes.

 

Service Scopes:

 

Exchange Online
Mail and Calendar

 

SharePoint Online
Files and Sites

 

Microsoft Teams (Focus in this article)
Teams, Settings, Tabs and Members


Teams Delegated Permissions:

 

Team.ReadBasic.All
Read the names and descriptions of teams, on behalf of the signed-in user

 

Team.Create
Create teams, on behalf of the signed-in user


Teams Application Permissions:

 

Team.ReadBasic.All
Get a list of all teams, without a signed-in user

 

Team.Create
Create teams, without a signed-in user

 

Teamwork.Migrate.All
Creating and managing resources for migration to Microsoft Teams


Team Delegated Settings Permissions:

 

TeamSettings.Read.All
Read team settings, on behalf of the signed-in user

 

TeamSettings.ReadWrite.All
Read and change all team settings, on behalf of the signed-in user


Team Application Settings Permissions:

 

TeamSettings.Read.All
Read team settings, without a signed-in user

 

TeamSettings.ReadWrite.All
Read and change all team settings, without a signed-in user


Team Delegated Tabs Permissions:

 

TeamsTab.Read.All
Allows reading Teams apps that are installed for the signed-in user, and in all teams the user is a member of

 

TeamsTab.ReadWrite.All
Allows reading, installing, upgrading, and uninstallation of Teams apps, on behalf of the signed-in user and for teams the user is a member of

 

TeamsTab.Create
Allows creation of tabs in any team in Microsoft Teams, on behalf of the signed-in user


Team Application Tabs Permissions:

 

TeamsTab.Read.All
Read the names and settings of tabs inside any team in Microsoft Teams, without a signed-in user

 

TeamsTab.ReadWrite.All
Read and write tabs in any team in Microsoft Teams, without a signed-in user

 

TeamsTab.Create
Allows creation of tabs in any team in Microsoft Teams, without a signed-in user


Team Delegated Member Permissions:

 

TeamMember.Read.All
Read the members of teams, on behalf of the signed-in user

 

TeamMember.ReadWrite.All
Add and remove members from teams, on behalf of the signed-in user


Team Application Member Permissions:

 

TeamMember.Read.All
Read the members of all teams, without a signed-in user

 

TeamMember.ReadWrite.All
Add and remove members from all teams, without a signed-in user

 

Connecting to Microsoft Teams:

 

#Install into the Current User Scope
Install-Module Microsoft.Graph -Scope CurrentUser

 

#Verify the Installation
Get-InstalledModule Microsoft.Graph

 

#If needed
Import-Module Microsoft.Graph

 

#Connection for Creating a Team
$scopes = @("Team.Create")
Connect-MgGraph -Scopes $scopes

 

#Connection for Configuring Team Settings
$scopes = @("TeamSettings.ReadWrite.All")
Connect-MgGraph -Scopes $scopes

 

#Connection for Configuring Team Tabs
$scopes = @("TeamsTab.Create","TeamsTab.ReadWrite.All")
Connect-MgGraph -Scopes $scopes

 

#Connection for Managing Team Members
$scopes = @("TeamMember.ReadWrite.All")
Connect-MgGraph -Scopes $scopes

 

#Core Connection for Managing Teams
$scopes = @(
"Team.Create"
"TeamSettings.ReadWrite.All"
"TeamsTab.ReadWrite.All"
"TeamsTab.Create"
"TeamMember.ReadWrite.All"
"Group.ReadWrite.All"
"GroupMember.ReadWrite.All"
)
Connect-MgGraph -Scopes $scopes

 

#Did it work?
$group = Get-MgGroup -Filter "DisplayName eq 'Cardano'"

Get-MgTeam -TeamId $group.Id


So that's it again for part 7, we'll see you again in the next part! A little preview, in the next part we'll perform some online tasks with the Microsoft Graph. See you soon.

 

I hope this article was useful. Thank you for taking the time to read the article.

 

Best regards, Tom Wechsler

 

P.S. All scripts (#PowerShell, Azure CLI, #Terraform, #ARM) that I use can be found on Github! https://github.com/tomwechsler

No RepliesBe the first to reply

Resources