none
Error in Connecting to SharePoint Online through Powershell

    Question

  • Hi,

    I get below error when I try to connect to SharePoint online through the Connect-SPOService command

    Command: Connect-SPOService -Url https://<tenant>-admin.sharepoint.com

    Error:

    Connect-SPOService : Could not connect to SharePoint Online.
    At line:1 char:1
    + Connect-SPOService -Url https://<tenant>-admin.sharepoint.com
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : NotSpecified: (:) [Connect-SPOService], InvalidOperationException
        + FullyQualifiedErrorId : System.InvalidOperationException,Microsoft.Online.SharePoint.PowerShell.ConnectSPOServi 
       ce

    Please Note: I type correct username and password and I have checked many msdn blogs but no luck yet. All blogs say that check the command or check credentials. I have checked carefully. There is no issue with either command or with credentials. It has been 2 days I am stuck on this issue. Operating System is Windows Server 2008 R2 SP1

    Any help is much appreciated!


    • Edited by VJSCloud Wednesday, April 26, 2017 11:37 AM
    Wednesday, April 26, 2017 9:42 AM

All replies

  • Have you rules out firewall/proxy related issues? The easiest test is to simply try to login from another location, a home PC for example. Also, does your account have any form of multi-factor authentication configured?
    Thursday, April 27, 2017 8:42 AM
  • Hi Vijjoo,

    Try running the following commands before “Connect-SPOService” command if you are behind a proxy server.

    $cred = [System.Net.CredentialCache]::DefaultCredentials
    
    [System.Net.WebRequest]::DefaultWebProxy.Credentials = $cred

    Best Regards,

    Linda Zhang


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com

    Thursday, April 27, 2017 11:35 AM
  • Hi Linda,

    I have figured out the issue. You are right that it is a proxy issue, however, the above commands did not help us. We are trying some other solutions

    Thanks for the help

    Vijay Sharma

    Tuesday, May 2, 2017 5:18 AM
  • Have you found the solution to this? i have same issue. It gives me a timeout error
    Tuesday, October 10, 2017 3:23 PM
  • Hi Vijjoo,

    Are you trying to run with Administrative privileges the PowerShell?

    You must be a SharePoint Online global administrator to run the cmdlet.

    Best regards.



    EP!! Blog: https://keepcalmlovesharepoint.wordpress.com/ MCP SharePoint 2013 | Exchange Admin | Office 365


    Wednesday, October 11, 2017 6:32 PM