Accessing SharePoint team site using Powershell

Catorce, Jaz 1 Reputation point
2022-12-22T13:53:05.403+00:00

Hi,

We are trying to automate importing files from a remote server into Sharepoint List using Powershell. I found some tutorials regarding how to connect to Sharepoint in this site https://learn.microsoft.com/en-us/powershell/sharepoint/sharepoint-online/connect-sharepoint-online?view=sharepoint-ps.

The site indicates using the following command to connect to sharepoint.
Connect-SPOService -Url https://<tenant>-admin.sharepoint.com

Our Sharepoint URL however is in the following format [https://ts.mydomain.com/sites/<site-name>]. When I try to use our URL in the command I'm getting an error indicate below:

Connect-SPOService : Current site is not a tenant administration site.

How can I connect to our Sharepoint site using powershell?
Am I using a different version of Sharepoint?

Thank You

SharePoint Development
SharePoint Development
SharePoint: A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.Development: The process of researching, productizing, and refining new or existing technologies.
3,386 questions
{count} votes

1 answer

Sort by: Most helpful
  1. RaytheonXie_MSFT 39,371 Reputation points Microsoft External Staff
    2022-12-23T02:21:08.273+00:00

    Hi @Catorce, Jaz
    You could get your admin center url by following steps

    1. Go to the Office 365 Admin center, https://admin.microsoft.com/.
    2. From the left navigation, click on Show All >> Expand Admin centers, and then select SharePoint
      275984-273501-image.png
    3. Then you will go to your SharePoint admin center and you can get the url of your tenant. The following pic is the admin center of which format is https://<tenant>.sharepoint.com. Yours might be different. And you can Connect-SPOService with the url in your admin center.
      275977-273487-image.png

    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


    3 people found this answer helpful.

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.