Community
54 TopicsWelcome to the Windows PowerShell Community!
By popular demand we have created a Windows PowerShell community on the Microsoft Tech Community! Please post questions, best practices and answer questions posted here! Make sure you use labels suggested in each post to help people find your posts. We are looking for suggestions on new spaces to create here so let us know if you have recommendations on what we can do here to make this community a great place for everyone to learn more about Windows PowerShell.5.2KViews15likes13CommentsPart 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/tomwechsler1KViews1like0CommentsPart 1 - Manage Azure and Microsoft 365 with the Microsoft Graph PowerShell SDK!
Dear Microsoft Azure and Microsoft 365 Friends, PowerShell can be used to manage a wide variety of cloud services from Microsoft. This starts with the Azure Active Directory, Teams up to SharePoint Online. So why should I bother with the Microsoft Graph PowerShell SDK? Very briefly, it is the one-stop shop for managing Microsoft cloud services with PowerShell. What Is the Microsoft Graph PowerShell SDK? - Application Programming Interface (API) wrapper for the Microsoft Graph APIs - Contains PowerShell commands for automation at scale - Allows connecting to single or multiple Microsoft 365 and Azure Active Directory services Microsoft Graph PowerShell SDK Features: - Provides access to all the Microsoft Graph APIs - Supports PowerShell 7 and above and cross-platform - Support for modern authentication Microsoft Graph PowerShell SDK supports PowerShell 7 and is Cross-platform: - Microsoft Graph PowerShell module works with PowerShell 7 and later - Cross-platform support for Windows, macOS, and Linux - Compatible with Windows PowerShell 5.1 Microsoft Graph API: - Published Version (v1.0) - Beta Version Let's compare it once the work with PowerShell, once "Normal" and once with the Microsoft Graph. On the left you can see that we need to install the modules for each Microsoft Cloud service. On the right, we install the Microsoft Graph and then we can manage the different services. Do not pay attention to the code, it is not complete. The point of this comparison is that on the left we have to install several modules including the different connections to the cloud services. Installing the Microsoft GraphPowerShell SDK. Installation Prerequisites: - Installed a compatible version of PowerShell - Execute on a supported operating system, either Windows, macOS, and Linux - Install the NuGet provider to interact with the PowerShell Gallery - If using Windows platforms, set the execution policy to remote signed or less restrictive You can use the following cmdlets to perform the installation (# are comments) : #Install the NuGet Provider Install-PackageProvider -Name NuGet -Force #Set the Execution Policy (Windows) Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser #Install into the Current User Scope Install-Module Microsoft.Graph -Scope CurrentUser or #Install into the All-User Scope Install-Module Microsoft.Graph -Scope AllUsers -Force -Verbose #Verify the Installation Get-InstalledModule Microsoft.Graph #Updating the Module Update-Module Microsoft.Graph Installing the main "Microsoft.Graph" module, will install additional sub modules. Installation Considerations: - Always install the "Microsoft.Graph.Authentication" modulethis is needed to establish the connection. - Only install necessary modules if necessary. - Installing the Microsoft Graph PowerShell SDK in one version of PowerShell does not install it for other That's it for the first part. In the second part we will talk about the scopes and connect to Microsoft 365. 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/tomwechsler4.8KViews1like0CommentsUnable to Connect to ExchangeOnline
So we have MFA enabled on our Office 365 accounts. From my Windows 10 computer, I can connect to the ExchangeOnlineManagement module without issue. However, on my DC I installed Powershell 7.0.3, then successfully installed the ExchangeOnlineManagement module. I can successfully import the module, however when I attempt to connect to it I get the below error. Any ideas? PS C:\Windows\System32> Connect-ExchangeOnline -UserPrincipalName MyUsername-ShowProgress $true ---------------------------------------------------------------------------- The module allows access to all existing remote PowerShell (V1) cmdlets in addit ion to the 9 new, faster, and more reliable cmdlets. |--------------------------------------------------------------------------| | Old Cmdlets | New/Reliable/Faster Cmdlets | |--------------------------------------------------------------------------| | Get-CASMailbox | Get-EXOCASMailbox | | Get-Mailbox | Get-EXOMailbox | | Get-MailboxFolderPermission | Get-EXOMailboxFolderPermission | | Get-MailboxFolderStatistics | Get-EXOMailboxFolderStatistics | | Get-MailboxPermission | Get-EXOMailboxPermission | | Get-MailboxStatistics | Get-EXOMailboxStatistics | | Get-MobileDeviceStatistics | Get-EXOMobileDeviceStatistics | | Get-Recipient | Get-EXORecipient | | Get-RecipientPermission | Get-EXORecipientPermission | |--------------------------------------------------------------------------| To get additional information, run: Get-Help Connect-ExchangeOnline or check htt ps://aka.ms/exops-docs Send your product improvement suggestions and feedback to exocmdletpreview@servi ce.microsoft.com. For issues related to the module, contact Microsoft support. D on't use the feedback alias for problems or support issues. ---------------------------------------------------------------------------- New-ExoPSSession: C:\Users\jwcitadmin\Documents\PowerShell\Modules\ExchangeOnlin eManagement\2.0.3\ExchangeOnlineManagement.psm1:426 Line | 426 | . PSSession = New-ExoPSSession -ExchangeEnvironmentName $ExchangeEnviro . | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | Could not load type 'System.Security.Cryptography.SHA256Cng' from | assembly 'System.Core, Version=4.0.0.0, Culture=neutral, | PublicKeyToken=b77a5c561934e089'..28KViews1like10Comments