End of Exchange Online Classic Authentication

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.

https://docs.microsoft.com/en-us/powershell/exchange/exchange-online/connect-to-exchange-online-powershell/mfa-connect-to-exchange-online-powershell

Microsoft has now released the version 2 of the module which they call as EXO v2.

https://docs.microsoft.com/en-us/powershell/exchange/exchange-online/exchange-online-powershell-v2/exchange-online-powershell-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

https://techwizard.cloud

https://www.syscloudpro.com/

PowerShell Cheat Book

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s