Skip to main content

Important Changes to PnP PowerShell

Key Insights You Won't Want to Overlook About PnP PowerShell Changes

There's a big upgrade that can impact your scripts and automation processes if you use PnP PowerShell. What you should know is as follows.

What’s Changing?

The PnP Management Shell was a multi-tenant app registration that was previously used to access Microsoft 365. This made it possible for you to provide your scripts the permissions they need.

On September 9, 2024, however, the multi-tenant app registration was removed. Scripts that rely on it are no longer functional after this date.

Why the Change?

This change aims to enhance security by encouraging users to switch to single-tenant app registrations. These registrations allow you to specify only the permissions you need, reducing potential security risks.

Handle this change by following these simple steps:

Register an App in Azure to use PnP PowerShell

Thanks to recent enhancements in the PnP PowerShell Module, creating an app registration specific to a tenant is now really simple.  PowerShell 7 or later version must be used because it is the only version of PnP PowerShell that is currently supported.
Registration of app can be done using the PnP command or one can follow the manual approach.

The user executing this action needs to have Global Administrator permission because we are creating the Entra ID application and the user needs to provide consent.

Steps to update are as follow:
1. Update the PnP PowerShell to latest version. Use the command mentioned below:
Update-Module PnP.PowerShell
2.   After PnP PowerShell has been updated, we need to do the pnp powershell azure app registration, run the following command to create the tenant-specific application:

Register-PnPEntraIDApp -ApplicationName “PnP PowerShell Application Registration” -Tenant  {yourtenantname}.onmicrosoft.com -Interactive
 Change the application name to suit your needs and replace "{yourtenantname}" with your tenant name.
3. A consent prompt with the default permissions will show up when you execute this command. Your application will be finalized upon your acceptance. Following that, the ClientId/ApplicationId will be output by the command; be sure to copy this ID because you'll need it for the following procedures.
PnP PowerShell Changes


In the previous steps, we've successfully completed the registration process. Now, it’s time to update your existing scripts and connections. Make sure to keep the ClientId/ApplicationId generated earlier.

Current connection command/method might be like this :
Connect-PnPOnline -Url https://{yourtenantname}.sharepoint.com -Interactive
replace this command/method with the following command:
Connect-PnPOnline -Url https://{yourtenantname}.sharepoint.com -ClientId [ClientId] -Interactive

Please comment if you have any questions. Sharing is helpful!

Reference:

Comments

Popular posts from this blog

SPFx Interview Questions With Answers

In this article, we are going to discuss interview questions related to the SPFx (SharePoint Framework Development ). It will help you to prepare for the interview and in getting clarity on the core concepts of SPFx development. What is SPFx? SPFx, short for SharePoint Framework,  SPFx  allows us for client-side SharePoint development, we can easily connect with SharePoint data and it also supports for open source tools. What is the major difference between SPFx web part and the SharePoint app? Both the development model supports client-side development but the major difference between these two is that the SharePoint app(add-in) runs on the iframe. What you can build with SPFx? Using SPFx framework we can customize the SharePoint pages. We can build things mentioned below using the SharePoint Framework(SPFx). Web parts, Extensions, Adaptive Card, Library Component How many types of extensions we can create using SPFx? SPFx has three extension types: Application Customizers: U...

How to Upgrade SharePoint Web Parts to the Newest Version

Updating the SharePoint/SPFx web parts or other solution is very common requirement, Webparts we can add from the SharePoint store or can be uploaded by our organization. To update a SharePoint web part to the latest version, start by uploading the updated SPFx package to the App Catalog. Then, make sure to upgrade the web part on the site where it’s being used. In this blog will be discussing ways to upgrade both package from the SharePoint app store or the the custom uploaded from the organization Update the web part added from the SharePoint app store: Go to the tenant level app catalog site. Select the app which you want to upgrade. Once you select the app, go the top ribbon and select file and click on the "Upgrade Store App", updated version will be added on the appcatalog if the new version is available on the store. Note: If you built the custom webpart then upload it to the app catalog. Install the upgraded solution: Navigate to the site collection where you have ins...

SharePoint Image column behaves differently

We all are aware of the Image/Thumbnail column present in the SharePoint list. Whenever we want to store the image, we use this column, but recently I found that SharePoint image/thumbnail columns are behaving differently. What's happening : Previously, when we were saving the items in the list and when we fetched items using the code, it was giving a response like this: '{"type":"thumbnail","fileName":"MyPhoto.jpg","nativeFile":{},"fieldName":"ProfilePicture","serverUrl":"https://techrobbers.sharepoint.com","fieldId":"id","serverRelativeUrl":"/sites/SIteName/SiteAssets/Lists/ListID/MyPhoto.jpg","id":"ID"}' But now it is returning data in the below format: "{"fileName":"Reserved_ImageAttachment_[14][Photo][7][content][2]_[10].jpg"}" Also one catch here is that it's working fine for all the ex...