Powershell connect MSOLService fails most of the time RRS feed

  • Question

  • Hi Everyone ,

    I am using below command

    Connect-MSOLService -Credential $cred -ErrorAction Continue

    Sometimes it is getting connected most of the time it is failing . (using same credentials everytime)

    How to resolve this ?

    You cannot vote on your own post                    

    Below is the error only when it fails .   

    Connect-MSOLService : Authentication Error: Unexpected authentication failure.
    At E:\myfolder.ps1:50 char:1
    + Connect-MSOLService -Credential $adminCredential -ErrorAction Continue
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : OperationStopped: (:) [Connect-MsolService], Exception
        + FullyQualifiedErrorId : System.Exception,Microsoft.Online.Administration.Automation.ConnectMsolService

    Monday, November 13, 2017 3:06 PM

All replies

  • The account you are using must be assigned the role of Global Administrator (GA) in Azure Active Directory.
    Do click on "Mark as Answer" on the post that helps you and vote it as helpful, this can be beneficial to other community members.
    Tuesday, November 14, 2017 7:28 AM
  • are you using a proxy server ?

    Tuesday, November 14, 2017 1:41 PM
  •  Yes I am using Proxy server .

    Suppose I ran the script for 10 times it may connect 4 times or less .

    Some times it gets connected on the first time itself or I have to run the script until it gets connected .

    • Edited by MeRagZ Tuesday, November 14, 2017 5:38 PM
    Tuesday, November 14, 2017 3:22 PM