Generate a new client secret for SharePoint Template
Warning
Update, 26-Nov-2025: Microsoft 365 generated Client Secrets are now 41 characters or longer. Unfortunately our software and deployment methods built on Microsoft's SDK's can only process Client Secrets up to 40 characters. The only solution if your Client Secrets have expired is to migrate your authentication to AppOnly/Certificate.
Renewing a ClientSecret for SharePoint access is a temporary measure until deprecation of the entire Azure Access Control Services (AACS), a deprecating authentication service of Microsoft Azure used to connect to (among other services) SharePoint online. In the past this was often abbreviated to ACS.
Not to be confused with the similarly named and newer acronym ACS (Azure Communication Services). authentication model by Microsoft in April 2026. For more information see Microsoft announcement on: https://aka.ms/retirement/acs/support. Beyond that date Dialogue Cloud or any other AnywhereNow application or script will not be able to access your SharePoint sites anymore, to read changes, or write/upload list items or files, using this authentication method.
Prior to that date, please change your A Unified Contact Center, or UCC, is a queue of interactions (voice, email, IM, etc.) that are handled by Agents. Each UCC has its own settings, IVR menus and Agents. Agents can belong to one or several UCCs and can have multiple skills (competencies). A UCC can be visualized as a contact center “micro service”. Customers can utilize one UCC (e.g. a global helpdesk), a few UCC’s (e.g. for each department or regional office) or hundreds of UCC’s (e.g. for each bed at a hospital). They are interconnected and can all be managed from one central location. site authentication method to using AppOnly/Certificate as advised by both Microsoft and AnywhereNow. See: Migrating from ClientSecret to Dialogue Cloud Certificate Authentication
Generate New ClientSecret
Renew SharePoint Client Secret using Microsoft Graph PowerShell Module
Make sure you have the latest Microsoft Graph PowerShell modules loaded.
1. (Optional) Uninstall Old modules
Remove any outdated or conflicting Microsoft Graph modules:
PowerShell
Get-InstalledModule Microsoft.Graph* | Uninstall-Module -Force
2. Install the Latest Microsoft Graph SDK
Reinstall the latest version of the Microsoft Graph PowerShell SDK:
PowerShell
Install-Module Microsoft.Graph -Scope CurrentUser -Force -AllowClobber
3. Import the Module
Ensure the module is loaded:
PowerShell
Import-Module Microsoft.Graph
4. Run script to generate and display a new Client Secret
This script template will generate a new Client Secret with a validity period of 2 years for the existing Application you should already have created in the past for your Ucc.Creator template site collection (legacy method).
Adapt the with your details, corporate security standards and naming conventions (TenandId, ClientId, Validity period, Displayname)
PowerShell
# Connect to Microsoft Graph with a specific tenant
$tenantId = 'your-tenant-id-here'
Connect-MgGraph -Scopes "Application.ReadWrite.All" -TenantId $tenantId
# Define the application ID
$appId = 'your-client-id-here'
$app = Get-MgServicePrincipalByAppId -AppId $appId
# Define the secret validity period
$dtStart = [System.DateTime]::Now
$dtEnd = $dtStart.AddYears(2)
# Create the password credential object
$passwordCred = @{
displayName = "AnywhereNow-ClientSecret-2025"
startDateTime = $dtStart
endDateTime = $dtEnd
}
# Add the new client secret and capture the output
$secret = Add-MgServicePrincipalPassword -ServicePrincipalId $app.id -PasswordCredential $passwordCred
# Output the secret value (Store this securely! This can be displayed only once!)
$secret.secretText
Store the new ClientSecret in a safe place. It can be displayed only once.
Note
Microsoft has deprecated the Microsoft Online Powershell module (as wel as the AzureAD Powershell module) and will not be functional anymore after May 2025. See announcements like: 4094536
All replacement functionality should be found in the currently maintained Microsoft Graph Powershell SDK.
(SharePoint Online) Renew Client Secret (MSOnline deprecated by Microsoft after May 2025)
Note
Microsoft has deprecated the Microsoft Online Powershell module (as wel as the AzureAD Powershell module) and will not be functional anymore after May 2025. See announcements like: 4094536
All replacement functionality should be found in the currently maintained Microsoft Graph Powershell SDK.
A client secret (just as a password or a certificate) expires over time. Before it expires a new client secret must be in place before the current one expires to ensure continued operation of your application. Microsoft recommends to create new secrets a minimum of 30 days before they expire. Learn More - Microsoft
Prerequisites
Make sure the following prerequisites are met
-
User is SharePoint Online global administrators and tenant administrator for the Microsoft 365 tenant
-
Install SharePoint Online Management Shell
https://www.microsoft.com/en-us/download/details.aspx?id=35588
-
Install PowerShell PowerShellGet
-
Open PowerShell as administrator
-
Run:
PowerShellInstall-Module –Name PowerShellGet –Force Update-Module -Name PowerShellGet
-
-
Install "Microsoft Online Services"
-
Open PowerShell as administrator
-
Run:
PowerShellInstall-Module -Name MSOnline
-
Generate
Note
Generating a new secret won’t affect to old one, the current Client Secret will be active until it expires
Note
If the client secret is already expired, creating a new app is recommended:3. Update App Permissions to "Sites.Selected" only
-
Run Powershell as administrator
-
Run the following cmdlets: (Change the client id value to your client id)
PowerShellConnect-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
-
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
Where to Apply the New ClientSecret
Where to apply the New Client Secret
Once your new Client ID and Secret are created there are several places these may need to be applied.
-
If you expect to, or regularly do add new UCC sites (from one of your own local SharePoint administrator Windows machines) to your SharePoint, you will need to set AppSecret to the new Client Secret in the configuration.xml file of your UCC.Creator script to build these sites.
-
If you want to update your Site Collection and Sites to a newer template version (from one of your own local SharePoint administrator Windows machines) of UCC.Creator, you will need to use the new Client Secret in the configuration.xml file of your UCC.Creator script to update your sites. See: Update UCC Creator
-
If you have running UCC's you will need to contact your AnywhereNow representative or official partner in advance to have the client secret changed at a scheduled time. (Or contact AnywhereNow support and submit a P4 case because it can be planned, to request this change) to have the Client secret changed in a service window. A UCC service restart is not required for this change.
-
If you have Snapper(s) running in your organization which have been configured for screenrecording and writing the recording to a SharePoint online (Ucc) site then ALL those Snapper configurations will need to be updated with the new Client Secret for ScreenRecording storage location. Learn More
-
If a Dialogue Studio flow connects to a SharePoint online site using Client ID and Client Secret, the Client Secret will need to be replaced in the Dialogue Studio flow.