0
votes

I have deployed a function app which includes an azure function that connects to msolservice. But this is producing a Authentication Error recently. script I am using:

$username = 'xxx' 
$password = 'xxx' 
$cred = New-Object -TypeName System.Management.Automation.PSCredential -argumentlist $username, $(convertto-securestring $password -asplaintext -force)
Connect-MsolService -Credential $cred

Error it produced: Connect-MsolService : Authentication Error: Unexpected authentication failure.

Function App details Function runtime: Powershell runtime version: 3.8.2.0

The user is not MFA enabled. And I am able to connect it from my local powershell. Any help regarding this issue can be helpful