Using PowerShell in Visual Studio Code on MacOS

If you day to day life revolves around MacOS and Visual Studio Code but the rest of your team is working on Windows, you might see that many of them are using PowerShell. You don't have to be the odd-person-out, and besides that, PowerShell is an amazing shell in general, providing a scripting environment that is very hard to beat by other shells. So, a few things to do: Install PowerShell Navigate to https://github.com/PowerShell/PowerShell/blob/master/docs/installation/macos.md and follow the instructions. It's pretty straightforward. Make sure that PowerShell works by launching a terminal...

Automatic Context Switching in PnP PowerShell

PnP PowerShell does something we call 'context switching'. Let me show you how this is making your life a tiny bit easier: Connect-PnPOnline https://contoso.sharepoint.com Get-PnPList Get-PnPTenantSite This will connect first to your root site collection in your tenant, return all the lists in the site, and then the next cmdlet will show you all the (classic) site collections in your tenant. Normally you would have to connect (if you're a developer, you have to create a new ClientContext) to your tenant admin site first in order to do this. However, already for quite some time we made...

Getting started with the PnP Provisioning Engine and PnP PowerShell

Two of the most popular cmdlets in the PnP PowerShell module are Get-PnPProvisioningTemplate and its sibling Apply-PnPProvisioningTemplate. Follow me in this post where I dive into using them and show how make the most of them in your provisioning flow. Creating a Template Okay, so while it's totally possible to start creating a template by hand from scratch, it's a daunting task for sure. The PnP Provisioning Engine supports so many artifacts and each artifact has so many properties, you'll end up browsing the schema documentation for hours to come. Lets do it easier: create a site collection, modern, classic,...

The hidden gem in PnP PowerShell

There is something 'hidden in plain sight' in PnP PowerShell for SharePoint Online, and it's been there already for a few years. Let me show you the command: Connect-PnPOnline -Url https://contoso.sharepoint.com -CreateDrive Notice that last parameter? -CreateDrive. It does exactly what it says it does. It creates a drive that you can navigate into. And you are effectively navigating into your site. How cool is that? By default it creates a drive called SPO:. So: Connect-PnPOnline -Url https://contoso.sharepoint.com -CreateDrive cd SPO:\ cd SitePages dir Folder: \SitePages Name Type Items/Size Last Modified ---- ----...

PnP PowerShell and multi-factor authentication

If you use PnP PowerShell, you might be aware of the fact that there many many ways to authenticate towards your SharePoint Online Tenant. If you have multi-factor authentication enabled on your tenant, basically the only way for you to connect to your tenant was by using the -UseWebLogin method. The way it worked is that we launched a browser window, you authenticated, and we captured the authentication cookie that was returned by the browser. We then dress up every CSOM call made by the cmdlets with that cookie. Effectively authenticating you. Now we have added another option as of...