How Can We Help?
< All Topics
Print

06. How to extend and get the expiration period for SharePoint Credentials (App-Only)

 

How to get expiration period for SharePoint Credentials

 

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?

!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?

Step 1: You need to edit the Expiry Date for all the existing SP Credentials in your File Sync Portal under Integrations -> Edit

Step 2: Select your SP Integrations and update the ‘End Date’ field and click on Save. The SP Integrations’ End Date must be edited for the next 10 years.

Step 3: In case if you have multiple SP Integrations to be edited, please reach out to dev.team@hingepoint.com with your renewal date and we can get them updated for you.

Previous 05. Create SharePoint Credentials