1

anyone knows a solution for Connect-SPOService on SharePoint Online PowerShell.

So I need to use Set-SPOSite and before I can use that I need to do Connect-SPOService first.

PS C:\WINDOWS\system32> Connect-SPOService
>>

cmdlet Connect-SPOService at command pipeline position 1
Supply values for the following parameters:
Url: https://test.sharepoint.com/sites/test/
Connect-SPOService : Could not authenticate to SharePoint Online https://test.sharepoint.com/sites/test/
using OAuth 2.0
At line:1 char:1
+ Connect-SPOService
+ ~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Connect-SPOService], AuthenticationException
    + FullyQualifiedErrorId : Microsoft.Online.SharePoint.PowerShell.AuthenticationException,Microsoft.Online.SharePoi
   nt.PowerShell.ConnectSPOService

The URL is not real, I login normally and did my 2FA with SMS but when I submit my 2FA it always fail. I tried it like 5 times just to be sure I was not putting the wrong code. I also tried using my App Password but it won't let me login with it.

Any known solution for this? My end goal is to edit my site to allow pages to be editted using SharePoint Designer. Would be a lot faster on editting ItemStyles for CQWP later

Set-SPOSite -Identity https://test.sharepoint.com/sites/test/ -DenyAddAndCustomizePages 0
1

Have you tried connecting to the '-admin' Url?

https://docs.microsoft.com/en-us/powershell/module/sharepoint-online/connect-sposervice?view=sharepoint-ps

Connect-SPOService -Url https://contoso-admin.sharepoint.com -credential admin@contoso.com

2
  • I tried that, now I'm getting Connect-SPOService : Current site is not a tenant administration site. which is weird cause I know I am a tenant administrator. – Franz Justin Buenaventura Jun 18 '18 at 18:13
  • You are tenant admin but may be the site url you are providing is a not a tenant admin site. – Deepmala Jun 19 '18 at 3:19
1

It seems credentials you are providing are somehow not working.Try below:

$username = "admin@contoso.sharepoint.com"
$password = "password"
$cred = New-Object -TypeName System.Management.Automation.PSCredential - 
argumentlist $userName, $(convertto-securestring $Password -asplaintext -force)
Connect-SPOService -Url https://contoso-admin.sharepoint.com/ -Credential 
$cred

 Connect-PnPOnline -Url $siteURL -Credentials $cred 
1
  • i find it a little odd that you have to connect to the admin site before connecting to any other site / object. does anyone have some background on this logic? – Taco_Buffet Aug 14 '19 at 16:46
0

Just remove '/' at the end of url after test

https://test.sharepoint.com/sites/test/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.