Dear Team,
You will need to run the Enable to TLS 1.2
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
.
Here is the script:
# Set TLS 1.2
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
# Import module
Import-Module ExchangeOnlineManagement -RequiredVersion 3.6.0
# Connect to Exchange Online
try {
Connect-ExchangeOnline -AppId "<ClientID>" -CertificateThumbprint "<Thumbprint>" -Organization "<Tenant>.onmicrosoft.com" -Verbose
Write-Host "Connected successfully!"
# Test a command
Get-EXOMailbox -ResultSize 1
} catch {
Write-Host "Error: $_"
} finally {
Disconnect-ExchangeOnline -Confirm:$false
}