0

I am writing a Powershell script to automate a file upload from a Microsoft Server 2012, but am having difficulty connecting to the Sharepoint site. I am using the SharepointPnPPowershellOnline plug-in to connect to the Sharepoint site, which is hosted by a different organization.

I can get a connection using the following, and entering the login information using the GUI: Connect-PnPOnline -Url "https://linktowebsite.com" -UseWebLogin

below is what I would like to use to connect, or the windows credential manager: Connect-PnPOnline -Url "https://linktowebsite.com" -Credentials $cred

The problem mainly, is that when you attempt to go to the link, you get redirected to the login page, which has two options for authenticating. One is using a simple login , the other is the external companies SSO. I have been provided a simple login to access the page.

Is there any way to automate this option into the script, or directly specify in the credentials which login option to use?

Thanks for any help you can give.

1 Answer 1

0

Register a SharePoint Addin with the appropriate scope of permission, then pass the -ClientId and -ClientSecret switches with Connect-PnPOnline instead of using credentials.

Alternatively, deploy the Data Management Gateway on-premises and create a Power Automate flow to perform the action you need to execute. This will require the user executing the flow (or rather, authenticating in the flow to the on-prem resource) to have at least a Power Automate P1 license.

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.