How Can We Help?
< All Topics
Print

08. 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:

 

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 MSOnline))
{
try
{
Install-Module MSOnline -Confirm:$false -ErrorAction Stop

}
catch
{

$Error[0]
}

}

import-module MSOnline
$msolcred = get-credential
connect-msolservice -credential $msolcred

$clientId = “11111111-1111-1111-1111-111111111111”
$keys = Get-MsolServicePrincipalCredential -AppPrincipalId $clientId -ReturnKeyValues
$true
$keys

 

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 expiration period for SharePoint Credentials

!Important: After steps from below will be completed all syncs will be disabled. You should stop all syncs and update SharePoint Client Secret for all SharePoint integrations and Start sync for all connections again.

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 MSOnline))
{
try
{
Install-Module MSOnline -Confirm:$false -ErrorAction Stop

}
catch
{

$Error[0]
}

}

import-module MSOnline
$msolcred = get-credential
connect-msolservice -credential $msolcred

$clientId = “11111111-1111-1111-1111-111111111111”
$keys = Get-MsolServicePrincipalCredential -AppPrincipalId $clientId -ReturnKeyValues $true
$keys

Remove-MsolServicePrincipalCredential -KeyIds $keys.KeyId -AppPrincipalId $clientId

$bytes = New-Object Byte[] 32
$rand = [System.Security.Cryptography.RandomNumberGenerator]::Create()
$rand.GetBytes($bytes)
$rand.Dispose()
$newClientSecret = [System.Convert]::ToBase64String($bytes)
$dtStart = [System.DateTime]::Now
$dtEnd = $dtStart.AddYears(1)
New-MsolServicePrincipalCredential -AppPrincipalId $clientId -Type Symmetric -Usage Sign -Value $newClientSecret -StartDate $dtStart -EndDate $dtEnd
New-MsolServicePrincipalCredential -AppPrincipalId $clientId -Type Symmetric -Usage Verify -Value $newClientSecret -StartDate $dtStart -EndDate $dtEnd
New-MsolServicePrincipalCredential -AppPrincipalId $clientId -Type Password -Usage Verify -Value $newClientSecret -StartDate $dtStart -EndDate $dtEnd
Write-Host “Please send this secret to HingePoint: ” $newClientSecret -ForegroundColor Green

 

Step 3: Enter credentials of user with Global Admin permissions to O365 tenant:

 

Step 4: !Important: Save new key in the secure storage:

Previous 07. Support
Next 09. Procore – SharePoint Test Cases