Open Amysno opened 4 years ago
Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible.
LegacyAuthProtocolsEnabled must be true on your tenant. Run the command “Get-SPOTenant”. Check the property “LegacyAuthProtocolsEnabled”. If this is set to true then Legacy Authentication is enabled else disabled.
This method has been working for me. I have the user and password stored in environment variables to keep them out of source control.
$SecurePass = $Env:SharepointPassword | ConvertTo-SecureString -AsPlainText -Force
Add-PnPStoredCredential -Name MyUser -Username $Env:SharepointUser -Password $SecurePass
Connect-PnPOnline -Url $SiteUrl -Credentials 'MyUser'
It is honestly better to set up Application Authentication for a scheduled task. https://docs.microsoft.com/en-us/sharepoint/dev/solution-guidance/security-apponly-azureacs Follow these instructions then you can connect using
Connect-PnPOnline -Url "https://tenant.sharepoint.com/sites/mysite" -AppId "AppId" -AppSecret "AppSecret"
Reporting an Issue
I am having trouble with the cmdlet Connect-PnPOnline all of a sudden. I was using Windows autentication manager with a generic autentication : Label : "MyOrg', email : "myaccount@myorg.onmicrosoft.com", password : "MyPassWord" So I call
Connect-PnPOnline -Url 'https://myorg.sharepoint.com/sites/MySite' -Credentials MyOrg
but this leads to an error. I then tried several things :I do not want to use Web Login, because the script will be stored as a scheduled task, so no human will enter some creds.
The different code I used are in the Steps to reproduce.
Expected behavior
Connecting to the URL given in parameters, so I can perform some actions.
Actual behavior
Does not connect to given URL. Throws an error :![image](https://user-images.githubusercontent.com/5112089/66380011-dd70fd00-e9b6-11e9-9b3d-20d0837ff337.png)
Steps to reproduce behavior
Here is the code I used :
Which version of the PnP-PowerShell Cmdlets are you using?
What is the version of the Cmdlet module you are running?
SharePointPnPPowerShellOnline v 3.10.1906.0
How did you install the PnP-PowerShell Cmdlets?
Please help me with this, I don't know what to do, it worked like a charm before last week.