5

Is there a way to Create a context in powershell using Client Id and Client Secret ?

Currently I am using $context.Credentials in my code.

5

You can use PnP PowerShell to connect to SharePoint using client id as below:

Connect-PnPOnline -Url <url> -AppId <clientid> -AppSecret <clientsecret>
$context = Get-PnPContext

Reference - Connect-PnPOnline

Download - PnP PowerShell releases

If you have PowerShellGet installed, you can directly install it using Install-Module SharePointPnPPowerShellOnline

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.