Skip to content

Commit b17fbd8

Browse files
author
Qiang Huang
committed
fix base64 issue
1 parent 020d3e0 commit b17fbd8

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

docs/sp-add-ins/replace-an-expiring-client-secret-in-a-sharepoint-add-in.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,13 @@ Ensure the following before you begin:
4949
$app = Get-AzureADServicePrincipal -Filter "AppId eq '$clientId'"
5050
$objectId = $app.ObjectId
5151
52-
$secret = New-AzureADServicePrincipalPasswordCredential -ObjectId $objectId -EndDate $endDate
53-
New-AzureADServicePrincipalKeyCredential -ObjectId $objectId -EndDate $endDate -Type Symmetric -Usage Verify -Value $secret.Value
54-
New-AzureADServicePrincipalKeyCredential -ObjectId $objectId -EndDate $endDate -Type Symmetric -Usage Sign -Value $secret.Value
52+
$base64secret = New-AzureADServicePrincipalPasswordCredential -ObjectId $objectId -EndDate $endDate
53+
$secret = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($base64secret.Value))
54+
New-AzureADServicePrincipalKeyCredential -ObjectId $objectId -EndDate $endDate -Type Symmetric -Usage Verify -Value $secret
55+
New-AzureADServicePrincipalKeyCredential -ObjectId $objectId -EndDate $endDate -Type Symmetric -Usage Sign -Value $secret
5556
56-
$secret.Value
57-
$secret.EndDate # Print the end date.
57+
$base64secret.Value
58+
$base64secret.EndDate # Print the end date.
5859
```
5960
6061
4. The new client secret appears on the Windows PowerShell console. Copy it to a text file. You use it in the next procedure.

0 commit comments

Comments
 (0)