In following the instructions currently listed under "Connect using an existing service principal and client-secret", I hit a roadblock.
$authName = <tenant>.onmicrosoft.com
$clientId = <clientId>
$resourceId = "https://outlook.office365.com"
$username = <username>
$password = <password>
$token = Get-ADALAccessToken -AuthorityName $authName -ClientId $clientId -ResourceId $resourceId -UserName $username -Password $password
$token = ConvertTo-SecureString -String $token -AsPlainText -Force
$AppCredential = New-Object System.Management.Automation.PSCredential($username, $token)
Connect-ExchangeOnline -Credential $AppCredential
Error response:
New-ExoPSSession : AADSTS50052: The password entered exceeds the maximum length of '256'.
Am I doing something wrong or does the 2.0.3-Preview prerelease not currently support this method as the documentation purports?
FYI - Many are having the same issue. Either the module should be fixed or the doc amended to remove this currently supported functionality: https://github.com/MicrosoftDocs/office-docs-powershell/issues?q=AADSTS50052