If you have setup Clever Document Links using the Client Credentials authorisation method then you will need to ensure that Microsoft SharePoint has a valid expiration date in order that Document Links continues to work successfully. 

By default the expiration date for a client secret is for one year and you will need to use PowerShell (and have the correct permissions to manage your tenant) in order to renew the client secret as there is no web interface available to do so.


Within PowerShell you will need to install the AzureAD, for which Administrator permissions will be required, using the following command.

Install-Module AzureAD

Connecting to your Azure Environment

With the AzureAD module installed, you will need to connect to your Azure environment in order to reveal and extend the expiry date of the Document Links SharePoint App, which is done using the following command inside PowerShell.


Once connected to the Azure environment on which the Clever Document Links SharePoint App was originally created within, you will need to identify the SharePoint App in order to reveal and/or extend the expiration date. 

Setting the SharePoint App

If you do not remember the name of the SharePoint App used to setup Client Credentials authorisation, you can use the following command to retrieve a list of the Apps within the environment. This will return a list of all Apps on your environment, from which you will need to identify the full name of the Clever Document Links App, e.g. Clever Document Links.

Get-AzureADServicePrincipal -All $true

Once you have the name of the App you will then need to set the App within the PowerShell session, using the following command.

$AppName = "Enter Doc Links App Name here"

Get-AzureADServicePrincipal -All $true |  Where-Object {$_.DisplayName -eq $AppName}

$App = Get-AzureADServicePrincipal -All $true |  Where-Object {$_.DisplayName -eq $AppName}

Reveal and extend the expiration date

If you wish to view the current expiration date the following commands can be used to retrieve and show the expiration date.

$CurrentExpiryDate = (Get-AzureADServicePrincipalPasswordCredential -ObjectId $App.ObjectId).EndDate

Write-host "Current Expiry Date:"$CurrentExpiryDate

To extend the expiration date, the following commands must be used, where it is possible to extend the expiration date by up to 10 years.

$StartDate = Get-Date

$EndDate = $StartDate.AddYears(x)

New-AzureADServicePrincipalPasswordCredential -ObjectId $App.ObjectId -EndDate $EndDate -Value “CurrentClientSecret”

Note: The x in the above should be replaced with a number to represent the number of years by which to extend the expiration date, e.g. 1 would be 1 year.