|
| 1 | +# Updating from PnP PowerShell 1.x to 2.x |
| 2 | + |
| 3 | +The 2.x version of PnP PowerShell is based exclusively on .NET 6.0, which means that it will not work on older PowerShell editions like PowerShell 5.1 or ISE. |
| 4 | + |
| 5 | +- The 1.x version of PnP PowerShell was based on .NET Framework 4.6.2 and .NET 3.1. |
| 6 | + |
| 7 | +- We had to update the module to .NET 6.0 because Microsoft removed support for .NET 3.1 in early December 2022. |
| 8 | + |
| 9 | +- We decided to drop support for .NET Framework it is not actively developed, doesn't work across-platforms and only receives maintainence and security updates. So, it would add additional code complexity and maintainabilty issues for us going forward in the future. |
| 10 | + |
| 11 | +- The 2.x version of PnP PowerShell will work only on PowerShell 7.2.x or later versions. |
| 12 | + |
| 13 | +## Steps to update from 1.x to 2.x |
| 14 | + |
| 15 | +- Download and install the PowerShell version from [this GitHub releases link](https://aka.ms/powershell-release?tag=lts) |
| 16 | + |
| 17 | +Or |
| 18 | + |
| 19 | +- For Windows environments, please use [this link](https://learn.microsoft.com/en-us/powershell/scripting/install/installing-powershell-on-windows?view=powershell-7.2) |
| 20 | + |
| 21 | +- For Linux based environments, please use [this link](https://learn.microsoft.com/en-us/powershell/scripting/install/installing-powershell-on-linux?view=powershell-7.2) |
| 22 | + |
| 23 | +- For Mac OS envoronments, please use [this link](https://learn.microsoft.com/en-us/powershell/scripting/install/installing-powershell-on-macos?view=powershell-7.2) |
| 24 | + |
| 25 | +Once the PowerShell 7.2.x or later is downloaded and installed in the environment, you can install the PnP PowerShell module like you normally do. |
| 26 | + |
| 27 | +```powershell |
| 28 | +Install-Module -Name "PnP.PowerShell" |
| 29 | +``` |
| 30 | + |
| 31 | +If you want to install or update to the latest nightly built prerelease of PnP PowerShell, run: |
| 32 | + |
| 33 | +```powershell |
| 34 | +Install-Module -Name "PnP.PowerShell" -AllowPrerelease |
| 35 | +``` |
| 36 | + |
| 37 | +## Changes needed in Azure DevOps/GitHub Actions/Pipelines |
| 38 | + |
| 39 | +If you are using PnP PowerShell in Azure Devops, GitHub Actions or other pipeline infrastructure, you will have to update your PowerShell version from v5 to v7.2.x or later. |
| 40 | + |
| 41 | +Recommend referring to these 2 links: |
| 42 | + |
| 43 | +- [DevOps Snack: Change PowerShell version in YAML](https://microsoft-bitools.blogspot.com/2021/02/devops-snack-change-powershell-version.html) |
| 44 | +- [How to enable PowerShell core in Azure Pipeline?](https://theautomationcode.com/how-to-enable-powershell-core-in-azure-pipeline/) |
| 45 | + |
| 46 | +## Changes needed in Azure Functions |
| 47 | + |
| 48 | +Using PnP PowerShell in Azure functions ? You might be required to change the PnP PowerShell version used. |
| 49 | + |
| 50 | +- If the Azure function is based on PowerShell 7.0 runtime, then you should keep using PnP PowerShell 1.x versions. The latest version is 1.12.0. The PowerShell 7.0 based runtime is deprecated and not supported anymore by Microsoft. You should consider updating to the 7.2 based runtime. |
| 51 | + |
| 52 | +- If the Azure function is based on PowerShell 7.2 runtime, you should update the PnP PowerShell to the 2.x version. It is currently only available as a nightly build, so you need to explicitly specify the version like `2.0.1-nightly`. This will fix the error that you might be currently facing: [Could not load type 'Microsoft.Extensions.Logging.Abstractions.Internal.NullScope' from assembly 'Microsoft.Extensions.Logging.Abstractions'](https://github.com/pnp/powershell/issues/2136) |
| 53 | + |
| 54 | +## Breaking changes |
| 55 | + |
| 56 | +| **Cmdlet** | **Obsolete parameter** | **Replacement parameter** | **Comment** | |
| 57 | +| ----------- | ---------------------- | -------------------- | --------------------- | |
| 58 | +| New-PnPTenantSite | Force | - | The parameter was obsolete and not used. It has been removed. | |
| 59 | +| Set-PnPTenantSite | BlockDownloadOfNonViewableFiles | AllowDownloadingNonWebViewableFiles | The parameter was obsolete and hence removed. Use `AllowDownloadingNonWebViewableFiles` | |
| 60 | +| Connect-PnPOnline | NoTelemetry | - | The parameter was obsolete and hence removed. Use `$env:PNP_DISABLETELEMETRY` environment variable or `Disable-PnPTelemetry/Enable-PnPTelemetry` cmdlet | |
| 61 | +| Connect-PnPOnline | NoVersionCheck | - | The parameter was obsolete and hence removed. Use `$env:PNPPOWERSHELL_UPDATECHECK` environment variable | |
| 62 | +| Disconnect-PnPOnline | Connection | - | The parameter was obsolete and hence removed. | |
| 63 | +| Request-PnPAccessToken | Resource | Scopes | The parameter was obsolete and hence removed. Use `Scopes` instead | |
| 64 | +| Copy-PnPFile | SkipSourceFolderName | - | The parameter was obsolete and has no effect currently nor was it used | |
| 65 | +| Get-PnPMicrosoft365Group | ExcludeSiteUrl | IncludeSiteUrl | The parameter was obsolete and hence removed. The site url is now excluded by default. Use `IncludeSiteUrl` instead to include the site url of the underlying SharePoint site. | |
| 66 | +| Get-PnPMicrosoft365Group | IncludeClassification | - | The parameter was obsolete and hence removed. The site classification is now included by default. | |
| 67 | +| Get-PnPMicrosoft365Group | IncludeHasTeam | - | The parameter was obsolete and hence removed. The `HasTeam` is now included by default. | |
| 68 | +| New-PnPGroup | OnlyAllowMembersViewMembership | - | The parameter was obsolete and hence removed. It is now done by default. Use `DisallowMembersViewMembership` to disallow group members viewing membership | |
| 69 | +| New-PnPGroup | SetAssociatedGroup | - | The parameter was obsolete and hence removed. Use `Set-PnPGroup` cmdlet instead. | |
| 70 | +| Convert-PnPSiteTemplate | - | - | We have removed support for `2019-03` provisioning schema. Use `2019-09` or later versions | |
| 71 | +| Get-PnPSiteTemplate | NoBaseTemplate | - | The parameter was obsolete and hence removed. Use of this parameter is generally not required/recommended. It will use the connected web template | |
| 72 | +| New-PnPSiteTemplateFromFolder | NoBaseTemplate | - | We have removed support for `2019-03` provisioning schema. Use `2019-09` or later versions | |
| 73 | +| Add-PnPTeamsChannel | Private | ChannelType | The parameter was obsolete and hence removed. Use `-ChannelType` instead | |
| 74 | +| New-PnPTeamsTeam | Owner | Owners | The parameter was obsolete and hence removed. Use `-Owners` instead which supports setting multiple owner of a Teams team | |
| 75 | +| Export-PnPTaxonomy | - | - | The cmdlet does not support export of taxonomy using `UTF-7` encoding. If `UTF-7` is specified, it will switch to `UTF-8` encoding | |
| 76 | +| Get-PnPField | ReturnTyped | - | The cmdlet will always return the typed object of the field. | |
| 77 | +| Get-PnPUserProfileProperty | - | - | Additional user profile properties are no longer returned under UserProfileProperties but instead will be directly under the returned instance | |
| 78 | +| Get-PnPFlowEnvironment | - | - | The alias on the cmdlet has been removed. Use `PnPPowerPlatformEnvironment` instead. | |
| 79 | + |
| 80 | +## Other notable changes |
| 81 | + |
| 82 | +- We have removed support for `2019-03` version of the PnP Provisioning schema from all provisioning related cmdlets. You should be using atleast `2019-09` or a later version of the schema. |
| 83 | +- The `-Web` parameter, which was marked obsolete, was used in certain Web level cmdlets. We have removed that. You should use `Connect-PnPOnline -Url [subweburl]` instead to connect to a Web. |
| 84 | + |
| 85 | +## Changes to output type |
| 86 | + |
| 87 | +- When using `Add-PnPTeamsTab` cmdlet, if you specify the `-Type SharePointPageAndList`, then `-WebSiteUrl` is mandatory. |
| 88 | +- When using `Add-PnPTeamsTab` cmdlet, if you specify the `-Type Planner`, then `-ContentUrl` is mandatory. |
| 89 | +- The output type of `Get-PnPAzureADGroupOwner` has changed to `PnP.PowerShell.Commands.Model.Microsoft365User` |
| 90 | +- The output type of `Get-PnPAzureADGroupMember` has changed to `PnP.PowerShell.Commands.Model.Microsoft365User` |
| 91 | +- The output type of `Get-PnPAzureADGroup` has changed to `PnP.PowerShell.Commands.Model.Graph.Group` |
| 92 | +- The output type of `New-PnPAzureADGroup` has changed to `PnP.PowerShell.Commands.Model.Graph.Group` |
| 93 | +- The output type of `Get-PnPUserProfileProperty` has changed to `SortedDictionary<string, object>` |
0 commit comments