Skip to content

Commit 09c0057

Browse files
committed
Added entry about Set-PnPManagedAppId
1 parent 285fed9 commit 09c0057

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

pages/articles/defaultclientid.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,32 @@
22

33
As of September 9<sup>th</sup>, 2024, it is no longer possible to use PnP PowerShell with `-Interactive` without [providing your own Entra ID App Registration](registerapplication.md) by passing in `-ClientId` as well. To avoid having to add `-ClientId` on every connect, you can also perform the below task to set the default ClientId for your environment. This avoids you having to update all of your scripts to include `-ClientId` in the Connect-PnPOnline statements, making the impact of this change smaller by not having to update existing scripts.
44

5+
## By storing a client id for a tenant
6+
7+
> [!NOTE]
8+
> This functionality is only available in the versions *newer* than 2.12.0
9+
10+
This options allows you to have different client ids for different tenant.
11+
12+
To set this use the `Set-PnPManagedAppId` cmdlet. You do not have to be connected to a tenant for this.
13+
14+
To set a client id for tenant with url `https://yourtenant.sharepoint.com`, you enter:
15+
16+
```powershell
17+
Set-PnPManagedAppId -Url https://yourtenant.sharepoint.com -AppId f0e2b362-8973-4fc7-a293-3c73e2677e79
18+
```
19+
20+
This will add an entry to your Windows Credential Manager or the MacOS keychain if your are on MacOS. Connect-PnPOnline will use this value to match the correct client id with the url you are connecting to and it is not needed use -ClientId anymore, e.g.
21+
22+
```powershell
23+
Connect-PnPOnline -Url https://yourtenant.sharepoint.com -Interactive
24+
```
25+
26+
27+
28+
You can manage entries using the `Get-PnPManagedAppId` and `Remove-PnPManagedAppId` cmdlets. Using these cmdlets it is possible to have different client/app ids for different tenants, which is usefull if you are a consultant serving multiple customers for instance.
29+
30+
531
## By setting an environment variable
632

733
You can set an environment variable on your machine or in your profile to default to the ClientId you configure in it. The name of the environment variable should be either: `ENTRAID_APP_ID`, or `ENTRAID_CLIENT_ID`, or `AZURE_CLIENT_ID`. You only need one of these, not all of them. They will be used in the order shown, i.e. if you set a value for `AZURE_CLIENT_ID` and another one for `ENTRAID_APP_ID`, the `ENTRAID_APP_ID` entry will be used and the other will be ignored.

0 commit comments

Comments
 (0)