I use PowerShell for different tasks when working with M365 and Azure services. To make it easier for myself, I like to have a script where I can load one or multiple modules, and to choose which one just by editing the script with eighter adding or removing a hash-tag in front of the command. Here is my script with a couple of commands for examples:
Get-Module -Name PowerShellGet -ListAvailable | Install-Module -Force
Install-Module -Name Az -Scope CurrentUser -Repository PSGallery -AllowClobber
Install-Module AzureAD
Install-Module ADSync
Install-Module MSOnline
Install-Module ExchangeOnlineManagement
Install-Module Microsoft.Online.SharePoint.PowerShell
Install-Module MicrosoftTeams
Import-Module AzureAD
Import-Module ADSync
Import-Module MSOnline
Import-Module ExchangeOnlineManagement
Import-Module Microsoft.Online.SharePoint.PowerShell
Import-Module MicrosoftTeams
Connect-AzureAD
Connect-ADSync
Connect-MsolService
Connect-ExchangeOnline
Connect-MicrosoftTeams
To install PowerShell 7, run the following command in your "old" PowerShell 5:
iex "& { $(irm https://aka.ms/install-powershell.ps1) } -UseMSI"
In PowerShell 7, you can install a new module for Entra ID:
Install-Module -Name Microsoft.Graph.Entra -Repository PSGallery -Scope CurrentUser -AllowPrerelease –Force
To connect to Entra ID:
Connect-Entra -Scopes 'User.Read.All'
Comments