Yea, you dont want to use that :)
Use the certificate based EXo Module and add it the Exchange Admin Role Group
https://learn.microsoft.com/en-us/powershell/exchange/app-only-auth-powershell-v2?view=exchange-ps
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hello guys,
please help me automate the connection via PS-Session to exchange online.
If you have a better solution, please share it with me.
Set-ExecutionPolicy Unrestricted
Read-Host "Enter Password" -AsSecureString | ConvertFrom-SecureString | Out-File "C:\Temp\Password.txt"
$User = "serviceuser@xxxxxxxxxxxxx "
$File = "C:\Temp\Password.txt"
$MyCredential=New-Object -TypeName System.Management.Automation.PSCredential ` -ArgumentList $User, (Get-Content $File | ConvertTo-SecureString)
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $MyCredential -Authentication Basic -AllowRedirection
Import-PSSession $Session -DisableNameChecking -AllowClobber -WarningAction SilentlyContinue
------------
The Error:---------------
Access Denied
Yea, you dont want to use that :)
Use the certificate based EXo Module and add it the Exchange Admin Role Group
https://learn.microsoft.com/en-us/powershell/exchange/app-only-auth-powershell-v2?view=exchange-ps