You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- always refer to Microsoft Graph with the full name, not "graph"
- grammatical fixes
- markdown formatting:
- scopes aren't inline code; should be BOLD
- don't explicitly set numbered bullets; always use "1." and let rendering engine number them correctly
Copy file name to clipboardExpand all lines: docs/sp-add-ins/replace-an-expiring-client-secret-in-a-sharepoint-add-in.md
+9-9Lines changed: 9 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -17,7 +17,7 @@ Client secrets for SharePoint Add-ins that are registered by using the **AppRegN
17
17
18
18
## Recommended maintenance schedule
19
19
20
-
We recommend creating new secrets a minimum of 30 days before they expire. This gives you a month of time before the old credentials expire.
20
+
We recommend creating new secrets a minimum of 30 days before they expire. This gives you a month before the old credentials expire.
21
21
22
22
We recommend only removing secrets a minimum of 7 days after expiration, provided you have removed them from the application configuration.
23
23
@@ -28,7 +28,7 @@ Removing an expired secret from ACS before you remove it from the application co
28
28
Ensure the following before you begin:
29
29
30
30
- You have installed Microsoft Graph Powershell SDK: [Install the Microsoft Graph PowerShell SDK](/powershell/microsoftgraph/installation)
31
-
- You're a tenant administrator (or having `Application.ReadWrite.All` permission) for the Microsoft 365 tenant where the add-in was registered with the **AppRegNew.aspx** page.
31
+
- You're a tenant administrator (or having **Application.ReadWrite.All** permission) for the Microsoft 365 tenant where the add-in was registered with the **AppRegNew.aspx** page.
32
32
33
33
## Generate a new secret
34
34
@@ -38,13 +38,13 @@ Ensure the following before you begin:
38
38
$clientId = 'client id of the add-in'
39
39
```
40
40
41
-
2. Connect to graph with `Application.ReadWrite.All, Directory.ReadWrite.All` scope.
41
+
1. Connect to Microsoft Graph with **Application.ReadWrite.All**, **Directory.ReadWrite.All** scope.
42
42
43
43
```powershell
44
-
Connect-MgGraph -Scopes "Application.ReadWrite.All,Directory.ReadWrite.All" # Login with corresponding scope. Should be tenant admin or anyone have the permission.
44
+
Connect-MgGraph -Scopes "Application.ReadWrite.All,Directory.ReadWrite.All" # Login with corresponding scope. Should the tenant admin or anyone else have the permission.
45
45
```
46
46
47
-
3. Generate a new client secret with the following lines:
47
+
1. Generate a new client secret with the following lines:
48
48
49
49
```powershell
50
50
$appPrincipal = Get-MgServicePrincipal -Filter "AppId eq '$clientId'" # Get principal id by AppId
@@ -80,12 +80,12 @@ Ensure the following before you begin:
80
80
$result.EndDateTime # Print the end date.
81
81
```
82
82
83
-
4. The new client secret appears on the Windows PowerShell console. Copy it to a text file. You use it in the next procedure.
83
+
1. The new client secret appears on the Windows PowerShell console. Copy it to a text file. You use it in the next procedure.
84
84
85
85
> [!TIP]
86
-
> By default, the secret lasts two years if you didn't specify the EndDateTime. You can customize by leveraging the example below to specify the EndDateTime.
86
+
> By default, the secret lasts two years if you didn't specify the EndDateTime. You can customize by using the example below to specify the EndDateTime.
87
87
>
88
-
> ```powershell
88
+
> ```powershell
89
89
> $params = @{
90
90
> PasswordCredential = @{
91
91
> DisplayName = "NewSecret" # Replace with a firendly name.
@@ -97,7 +97,7 @@ Ensure the following before you begin:
97
97
## Update the remote web application in Visual Studio to use the new secret
98
98
99
99
> [!IMPORTANT]
100
-
> If your add-in was originally created with a pre-release version of the Microsoft Office Developer Tools for Visual Studio, it may contain an out-of-date version of the **TokenHelper.[cs|vb]** file. If the file does not contain the string `secondaryClientSecret`, it is out of date and must be replaced before you can update the web application with a new secret. To obtain a copy of a release version of the file, you need Visual Studio 2012 or later. Create a new SharePoint Add-in project in Visual Studio. Copy the **TokenHelper.[cs|vb]** file from it to the web application project of your SharePoint Add-in.
100
+
> If your add-in was created with a pre-release version of the Microsoft Office Developer Tools for Visual Studio, it may contain an out-of-date version of the **TokenHelper.[cs|vb]** file. If the file does not contain the string `secondaryClientSecret`, it is out of date and must be replaced before you can update the web application with a new secret. To obtain a copy of a release version of the file, you need Visual Studio 2012 or later. Create a new SharePoint Add-in project in Visual Studio. Copy the **TokenHelper.[cs|vb]** file from it to the web application project of your SharePoint Add-in.
101
101
102
102
1. Open the SharePoint Add-in project in Visual Studio, and open the **web.config** file for the web application project. In the `appSettings` section, there are keys for the client ID and client secret. The following is an example:
0 commit comments