Using a certificate thumbprint with a certificate already imported within Azure
# Set the needed settings to connect to EOL with a service account
$EOLSettings = @{
CertificateThumbPrint = $env:CertificateThumbprint
AppID = $env:ClientID
Organization = "OregonStateUniversity.onmicrosoft.com"
ShowBanner = $false
}
# Use "Splatting" to use the settings as the input for the command to connect to EOL
Connect-ExchangeOnline @EOLSettings
Using a certificate and the plaintext password to connect
$EOLSettings = @{
# Set the needed settings to connect to EOL with a service account
CertificateFilePath = ".\EXAMPLE.pfx"
CertificatePassword = (ConvertTo-SecureString -String $env:CertificatePassword -AsPlainText -Force)
AppID = $env:ClientID
Organization = "OregonStateUniversity.onmicrosoft.com"
ShowBanner = $false
}
# Use "Splatting" to use the settings as the input for the command to connect to EOL
Connect-ExchangeOnline @EOLSettings
Currently the Connect-ExchangeOnline function technically supports these features but only works on 'Desktop' versions of PowerShell.
We should stop using basic authentication and start using certificates instead when Microsoft fixes this command to work with PowerShell "Core" versions.
The code attached above can be used for testing and the final replacement to basic authentication.
This issue can be disregarded If Microsoft provides a new Graph API that allows for changing the visibility setting in the GAL rather than using PowerShell.
Using a certificate thumbprint with a certificate already imported within Azure
Using a certificate and the plaintext password to connect