Skip to content
English
  • There are no suggestions because the search field is empty.

How to Replace an Expiring Office 365 App Registration Secret for Mavim Portal

To maintain secure access between the Mavim Portal and Office 365, it’s necessary to replace expiring client secrets in app registrations. This article outlines how to update the secret using PowerShell for app registrations created in SharePoint or Azure AD.

Use this procedure when:

  • The client secret for your Office 365 integration with Mavim Portal is about to expire.
  • You need to generate and apply a new secret to maintain uninterrupted access.

Step-by-Step Instructions

Step 1: Connect to MSOnline via the SharePoint Windows PowerShell with the tenant admin-user

import-module MSOnline
connect-msolservice
 

Use a tenant admin account. If managing multiple tenants, include -TenantId <Guid> in all commands.


Step 2: Retrieve Existing Keys

 clientId = "your-client-id-here"
$keys = Get-MsolServicePrincipalCredential -AppPrincipalId $clientId -ReturnKeyValues $true
$keys
  

This will show current keys and their expiration dates.


Step 3: Generate a New Client Secret

$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(3)
 
 
 

Step 4: Register the New Secret

 
 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

Step 5: Update Mavim Portal Configuration

  1. Log in to the Mavim Portal as Admin.
  2. Go to the DashboardOffice 365 tab.
  3. Enter the new client secret.
  4. Save and refresh the Portal.

🔗 Reference

Microsoft documentation: Replace an expiring client secret in a SharePoint Add-in