Register an app in Azure Entry ID, login to SharePoint Online and set files links expiration in days
Summary
This script shows how to register an app in Azure Entry ID, login to SharePoint Online and set files links expiration in days.
Implementation
- Open Windows PowerShell
- Edit Script and add required parameters for Site URL, tenant
- Press run
###### Declare and Initialize Variables ######
$tenant = "[tenant].onmicrosoft.com"
$url="https://[tenant].sharepoint.com/sites/[site name]"
###### Register an app in Azure Entry ID, store command in result to be able access certificate ######
$result = Register-PnPEntraIDApp -ApplicationName "PnP Rocks" -Tenant $tenant -interactive
Connect-PnPOnline $url -ClientId $result.'AzureAppId/ClientId' -Tenant $tenant -CertificatePath $result.'Pfx file'
###### Set files links expiration in days ######
Set-PnPTenantSite -identity $url -RequestFilesLinkExpirationInDay 50
Check out the PnP PowerShell to learn more at: https://aka.ms/pnp/powershell
The way you login into PnP PowerShell has changed please read PnP Management Shell EntraID app is deleted : what should I do ?
Contributors
Author(s) |
---|
Valeras Narbutas |
Disclaimer
THESE SAMPLES ARE PROVIDED AS IS WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.