1 post tagged with "powershell"

View All Tags

ALWAYS use Disconnect-PnPOnline

Mike Homol

Mike Homol

Principal Consultant @ ThreeWill

I learned a valuable lesson in the use of Disconnect-PnPOnline : ALWAYS use it!

I had a provisioning script that first connected to the tenant admin to create a new site, then switched contexts to provision files, including a newly laid out home page, onto the newly created site.

I had a connection issue midway through one particular run, where it successfully connected to the tenant admin but didn't successfully connect to the new site, but the script kept running successfully because, hey, it still had a context - to the tenant admin site.

Essentially, I was able to change the Home page of the Sharepoint Admin Center. Thankfully, I was also able to use Set-PnPHomePage to set it back to _layouts/15/online/AdminHome.aspx#/home. But my heart was skipping a few beats there for a bit.

If I had just used Disconnect-PnPOnline in between switching contexts then everything would have just stopped. So you've now been warned.