PowerShell Connections to SharePoint with OKTA

Copper Contributor

Greetings,

 

Background-

I have a PS script that provisions sites. For the most part, I'm using PnP cmdlets and everything worked just fine until OKTA was enabled. Non-MFA service acco8unts are not an option right now; different topic.

 

In my code, I provision a new site then go into a loop trying to connect to the new site. This is because the site creation cmdlet returns immediately and the site takes some time to actually be provisioned. The problem now is, every time through the loop the user is prompted to authenticate.

 

Question-

How can I make a single connection then reuse that same connection when polling for the site to have been created?

 

Thank you!

0 Replies