'Parsing WS-Trust response failed' error_Connecting to Azure from PowerShell

Hello,

I'm seeing below error when I connect Azure AD. Using 'Connect-AzureAD -Credential $credObj' from PowerShell ISE.

Could anyone please help me here.

Connect-AzureAD : One or more errors occurred.: parsing_wstrust_response_failed: Parsing WS-Trust response failed
At C:\Users\kkumar\Desktop\Testing Scripts\Test.ps1:7 char:2
+ Connect-AzureAD -Credential $credObj
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : AuthenticationError: (:) [Connect-AzureAD], AadAuthenticationFailedException
+ FullyQualifiedErrorId : Connect-AzureAD,Microsoft.Open.Azure.AD.CommonLibrary.ConnectAzureAD

Connect-AzureAD : One or more errors occurred.
At C:\Users\kkumar\Desktop\Testing Scripts\Test.ps1:7 char:2
+ Connect-AzureAD -Credential $credObj
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : AuthenticationError: (:) [Connect-AzureAD], AggregateException
+ FullyQualifiedErrorId : Connect-AzureAD,Microsoft.Open.Azure.AD.CommonLibrary.ConnectAzureAD

Connect-AzureAD : parsing_wstrust_response_failed: Parsing WS-Trust response failed
At C:\Users\kkumar\Desktop\Testing Scripts\Test.ps1:7 char:2
+ Connect-AzureAD -Credential $credObj
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : AuthenticationError: (:) [Connect-AzureAD], AdalException
+ FullyQualifiedErrorId : Connect-AzureAD,Microsoft.Open.Azure.AD.CommonLibrary.ConnectAzureAD

Connect-AzureAD : One or more errors occurred.: parsing_wstrust_response_failed: Parsing WS-Trust response failed
At C:\Users\kkumar\Desktop\Testing Scripts\Test.ps1:7 char:2
+ Connect-AzureAD -Credential $credObj
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Connect-AzureAD], AadAuthenticationFailedException
+ FullyQualifiedErrorId : Microsoft.Open.Azure.AD.CommonLibrary.AadAuthenticationFailedException,Microsoft.Open.Azure.AD.CommonLibrary.ConnectAzureAD

Parents Reply
  • Thanks for response.

    Here is the code I've used.

    [string]$username = "username@test.com"
    [string]$pwd = "password"

    [securestring]$secPwd = ConvertTo-SecureString $pwd -AsPlainText -Force

    [pscredential]$credObj = New-Object System.Management.Automation.PSCredential($username, $secPwd)

Children