I want to configure tenant-wide SharePoint and OneDrive sharing link retention settings, such as setting the maximum organization sharing link expiration to 365 days, along with the recommended expiration values. Should I use the SharePoint Online PowerShell module or PnP PowerShell for this? Is the SharePoint Online module still supported, and is it expected to be removed? I can connect successfully with PnP PowerShell, but running Set-PnPTenant -CoreOrganizationSharingLinkMaxExpirationInDays 365 returns an error saying that no matching parameter exists. Are Get-SPOTenant and Get-PnPTenant showing the same tenant settings?
2 Answers
The PnP documentation lists these tenant parameters, so the first things to check are that PnP PowerShell is installed or updated correctly and that the connection is being made from an elevated PowerShell session. If the command still fails, include the complete error and the installed PnP PowerShell version, since parameter support can vary between releases.
This appears to have been a missing-parameter issue in the PnP implementation rather than a problem with the tenant setting itself. Support for these parameters was added in newer nightly builds, so updating to a build that includes the fix should allow Set-PnPTenant to accept them. The expiration values should be chosen according to your organization’s security and sharing policies; there is no universal number that fits every environment.
The example values were based on an internal company decision, not a generally recommended standard. It is best to have the business and security teams agree on the appropriate duration.

The connection succeeds through Connect-PnPOnline, but Set-PnPTenant reports that it cannot find the CoreOrganizationSharingLinkMaxExpirationInDays parameter.