07. How to extend and get the expiration period for SharePoint Credentials (App-Only)
Quickly Navigate to Popular Sections:
- How to get expiration period for SharePoint Credentials
- How to Extend SharePoint Client Secret expiration period for 10 years?
- How to Edit your SharePoint Integrations after renewing the tokens?
How to get expiration period for SharePoint Credentials
Our guide to check the expiration date of SharePoint credentials using PowerShell, requiring SharePoint Client ID and Global Admin permissions.
Step 1: Open PowerShell ISE as administrator in the local computer:
Step 2: Put the script from below and press F5:
Note: Please paste your current SharePoint Client ID to the script (replace the value that highlighted in yellow). You can copy SharePoint Client ID from any SharePoint integration on the HingePoint Sync management portal.
if (!(Get-Module AzureAD))
{
try
{
Install-Module AzureAD -Confirm:$false -Force -ErrorAction Stop
import-module AzureAD
}
catch
{
$Error[0]
}
}
#Parameters
$ClientID = "11111111-1111-1111-1111-111111111111"
#Connect to AzureAD
Connect-AzureAD
#Get the Client ID
$App = Get-AzureADServicePrincipal -All $true | Where-Object {$_.AppID -eq $ClientID}
#Get the Current Expiry Date
$CurrentExpiryDate = (Get-AzureADServicePrincipalPasswordCredential -ObjectId $App.ObjectId).EndDate
Write-host "Current Expiry Date:"$CurrentExpiryDate -BackgroundColor Green
Step 3: Enter credentials of user with Global Admin permissions to O365 tenant:
Step 4: Find expression End Date property in the output of the script:
How to Extend SharePoint Client Secret expiration period for 10 years?
Instructions to extend the SharePoint Client Secret expiration period to 10 years, involving PowerShell script execution, SharePoint Client ID and Secret, and Global Admin access.
!Important: Please paste your current SharePoint Client ID and SharePoint Client Secret to the script (replace the value that highlighted in yellow). You can copy SharePoint Client ID from any SharePoint integration on the HingePoint Sync management portal.
Please contact the HingePoint Dev team (dev.team@hingepoint.com) before executing the script from below to plan these changes.
Step 1: Open PowerShell ISE as administrator:
Step 2: Put the script from below and press F5:
Note: Please paste your current SharePoint Client ID to the script (replace the value that highlighted in yellow). You can copy SharePoint Client ID from any SharePoint integration on the HingePoint Sync management portal.
if (!(Get-Module AzureAD))
{
try
{
Install-Module AzureAD -Confirm:$false -Force -ErrorAction Stop
import-module AzureAD
}
catch
{
$Error[0]
}
}
#Parameters
$ClientID = "11111111-1111-1111-1111-111111111111"
$ClientSecret= "9D1e4JgBMlkVlaXEdKTgZqJuzhRsmTfVMyQYoOcyHaM="
#Connect to AzureAD
Connect-AzureAD
#Get the Client ID
$App = Get-AzureADServicePrincipal -All $true | Where-Object {$_.AppID -eq $ClientID}
#Get the Current Expiry Date
$CurrentExpiryDate = (Get-AzureADServicePrincipalPasswordCredential -ObjectId $App.ObjectId).EndDate
Write-host "Current Expiry Date:"$CurrentExpiryDate -BackgroundColor Green
#Extend the validity of the App by 10 years
$StartDate = Get-Date
$EndDate = $StartDate.AddYears(10)
New-AzureADServicePrincipalPasswordCredential -ObjectId $App.ObjectId -StartDate $StartDate -EndDate $EndDate -Value $ClientSecret
New-AzureADServicePrincipalKeyCredential -ObjectId $App.ObjectId -StartDate $StartDate -EndDate $EndDate -Value $ClientSecret
Step 3: Enter credentials of user with Global Admin permissions to O365 tenant:
Step 4: Find new expression End Date property in the output of the script:
How to Edit your SharePoint Integrations after renewing the tokens?
Steps to update the expiry date in SharePoint Integrations after renewing tokens, including editing the 'End Date' in File Sync Portal and assistance for multiple integrations.