How Can We Help?
< All Topics
Print

09. How to get expiration period for SharePoint Credentials

Step 1: Open PowerShell ISE as administrator in the local computer:
Hingepoint Proconnector |
Step 2: Put the script from below and press F5:

Note: Please paste your current SharePoint Client ID to the script ($ClientID). 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

Hingepoint Proconnector |

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

 

Step 4: Find new expression End Date property in the output of the script:
Hingepoint Proconnector |