List App Principle Expiry in SharePoint Online

In a recent scenario with a client, we started to notice that some apps created over a year ago have started to expire. After investigating the cause, the default lifetime for an Client ID and Secret is 1 year, Yikes!

Once this has expired your apps will stop working!  It is worth knowing when these principles expire, so from the Microsoft articles we have extracted the PowerShell used to list when these apps could expire.

Prerequisites before running the script

  • Microsoft Online Services Sign-In Assistant is installed on the development computer.
  • Microsoft Online Services PowerShell Module (32-bit; 64-bit) is installed on the development computer.
  • You need to be a tenant administrator for the Office 365 tenant where the add-in was registered with.


The code for listing apps and their expiry is fairly straight forward and much of it is provided on MSDN, we have made a few tweaks to output to CSV, for tenants with large amounts of apps.

Continue reading