SharePoint Online

How to connect SharePoint Online with PowerShell?

Installation of SharePoint Online Management Shell

Before you start connecting PowerShell with SharePoint Online you must be sure to have the SharePoint Online Management Shell installed on your computer. This SharePoint Online Management Shell support you with the Windows PowerShell module.

You have to download the SharePoint Online Management Shell and install it on your computer. This must be done only once and you can skip this step if you already installed the SharePoint Management Shell.

Using user name and password for Office 365 account

  1. Please fill in the variables $userName and $orgName. Your Office 365 account must be a member of the Office 365 role SharePoint Online Administrator or Global Administrator. The name of your organization you will easily find in the URL by visiting the the Central Administration page of SharePoint Online: https://orgName-admin.sharepoint.com/. After you have filled the variables you can run this commands:
    $userName = <the email address of a SharePoint Online / Global Administrator>
    $orgName = <name of your Office 365 organization>
    $userCred = Get-Credential -UserName $userName -Message "Credentials for SharePoint Online"
    Connect-SPOService -Url https://$orgName-admin.sharepoint.com -Credential $userCred
  2. By running the 3rd command line you will getting a dialog box for entering the password. The user name is already typed in because of setting the variable. Please type in the password of the chosen user.
  3. You are now connected to SharePoint Online of your tenant and you can start with executing your commands.

Multifactor authentication for Office 365 account

  1. Please fill in the variable $orgName. You will find out your organization name as described above. Then you can run these commands:
    $orgName = <name of your Office 365 organization>
    Connect-SPOService -Url https://$orgName-admin.sharepoint.com
  2. By running the 2nd line you will get the dialog box for typing in your user name and password. Please type in the credentials of an Office 365 account who is member of the role SharePoint Online Administrator or Global Administrator, and then click Sign in.
  3. Follow the instruction of the dialog box to add the additional authentication information.
  4. You are now connected to SharePoint Online of your tenant and you can start with executing your commands.

Reference

0 Kommentare zu “How to connect SharePoint Online with PowerShell?

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert.

%d Bloggern gefällt das: