As most of you admins are already aware that Microsoft is killing Basic authentication for Exchange Online services for PowerShell, EWS, POP, IMAP and EAS.
SMTP authentication is still supported.(changes will not affect it)
Microsoft already released the Exchange online MFA Powershell previously but it lacked the capability to be used in scripts.
Microsoft has now released the version 2 of the module which they call as EXO v2.
You can install it from PowerShell gallery
https://www.powershellgallery.com/packages/ExchangeOnlineManagement
Install-Module -Name ExchangeOnlineManagement
This new module solves the issue for automated scripts and works seamlessly.
For all those admins/users that use my scripts that call Exchange online, you can install this module and then just update the LaunchEOL function code inside the script as below:
I will be updating my ALL in one office 365 connect in upcoming post.
############################If using a script that use password from file#####################
Function LaunchEOL {
param
(
$Credential
)
Import-Module ExchangeOnlineManagement -Prefix “EOL” -Verbose
Connect-ExchangeOnline -Prefix “EOL” -Credential $Credential
}
Function RemoveEOL {
$Session = Get-PSSession | where {$_.ComputerName -like “outlook.office365.com”}
Remove-PSSession $Session
}
#####################################################################################
######################If using a script that prompts for Credentials#####################
Function LaunchEOL {
Import-Module ExchangeOnlineManagement -Prefix “EOL” -Verbose
Connect-ExchangeOnline -Prefix “EOL”
}
Function RemoveEOL {
$Session = Get-PSSession | where {$_.ComputerName -like “outlook.office365.com”}
Remove-PSSession $Session
}
#####################################################################################
See above in bold you can easily pass user-credentials to this module. (Connect-ExchangeOnline -Prefix “EOL” -Credential $Credential)
Lets connect now to Exchange Online from my machine after installing the v2 module.
This module has some updated list of cmdlets (older ones still works with the module) which by default fetches fewer properties and you need to use the keyword -Properties to get other attributes.
Example:
Older cmdlet
get-mailbox User| Select litigationholdenabled,LitigationHoldDuration,RecipientTypeDetails,PersistedCapabilities,RetentionHoldEnabled,RetentionPolicy,UserPrincipalName,Name
Newer cmdlet
get-exomailbox user -Properties litigationholdenabled,LitigationHoldDuration,RecipientTypeDetails,PersistedCapabilities,RetentionHoldEnabled,RetentionPolicy
If you will not use properties then values will not be displayed.
Start updating your scripts and automation else you will find your self in great trouble once Microsoft blocks it.
You can check Azure AD Signin report to see how you are connecting.
Before using this module: (Classic Auth)
After utilizing this module: (See below it is now REST API based Powershell) – ModernAuth – Client APP changed from other clients to Mobile Apps and Desktop clients.
Thanks for reading …
Tech Wizard