SharePoint Template Operation basics

Introduction

In this document the basic elements of managing the Anywhere365 software are described.

 

Periodic Operations: (SharePoint Online) Renew Client Secret

 

Pre-requisites

Make sure the following pre-requisites are met

  1. Install SharePoint Online Management Shell

    https://www.microsoft.com/en-us/download/details.aspx?id=35588

  2. Install Microsoft Online Services Sign-In Assistant

    https://www.microsoft.com/en-us/download/details.aspx?id=41950

  3. Install PowerShell PowerShellGet

    1. Open PowerShell as administrator

    2. Run:

      Install-Module –Name PowerShellGet –Force

      Update-Module -Name PowerShellGet

  4. Install "Microsoft Online Services"

    1. Open PowerShell as administrator

    2. Run:

      Install-Module -Name MSOnline

  5. User is SharePoint Online global administrators and tenant administrator for the Office 365 tenant

 

Generate

  1. Run Powershell as administrator

  2. Run the following cmdlets: (Change the client id value to your client id)

    Connect-MsolService

    $clientId = 'clientid'

    $bytes = New-Object Byte[] 32

    $rand = [System.Security.Cryptography.RandomNumberGenerator]::Create()

    $rand.GetBytes($bytes)

    $rand.Dispose()

    $newClientSecret = [System.Convert]::ToBase64String($bytes)

    New-MsolServicePrincipalCredential -AppPrincipalId $clientId -Type Symmetric -Usage Sign -Value $newClientSecret

    New-MsolServicePrincipalCredential -AppPrincipalId $clientId -Type Symmetric -Usage Verify -Value $newClientSecret

    New-MsolServicePrincipalCredential -AppPrincipalId $clientId -Type Password -Usage Verify -Value $newClientSecret

    $newClientSecret

  3. Copy outcome and save it

 

(Optional) Extend expiration date to 3 years

Replace the "New-MsolServicePrincipalCredential” statements from the previous code with:

$dtStart = [System.DateTime]::Now

$dtEnd = $dtStart.AddYears(3)

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