Skip to content

Instantly share code, notes, and snippets.

@soulhakr
Created November 21, 2022 16:27
Show Gist options
  • Save soulhakr/a0e096be763ee8178e0404d7f87661aa to your computer and use it in GitHub Desktop.
Save soulhakr/a0e096be763ee8178e0404d7f87661aa to your computer and use it in GitHub Desktop.
[Template: Connect to M365 services (Powershell)] description #powershell #m365
$EXOSession = New-ExoPSSession
Import-PSSession $EXOSession | Out-Null
Write-Host 'Connecting to Microsoft 365...'
Connect-MsolService
<#
#Write-Host 'Connecting to ExchangeOnline...'
#Connect-ExchangeOnline
#Write-Host 'Connecting to Azure AD...'
#Connect-AzureAD
#Write-Host 'Connecting to Security & Compliance...'
#Connect-IPPSSession
#Import-Module azurerm #-RequiredVersion 6.10.0
#Connect-AzureRmAccount
#>
# do the thing!
# disconnect session
Get-PSSession | Remove-PSSession
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment