powershell icon indicating copy to clipboard operation
powershell copied to clipboard

[FEATURE] Environment Variable Rename [ENTRAID_APP_ID]

Open danmyhre opened this issue 1 year ago • 7 comments

Is your feature request related to a problem? Please describe. No

Describe the solution you'd like Would like the client ID environment variable renamed. "ENTRAID_APP_ID" is not specific to this app and since this is a system wide variable, it should have a proper name.

For example: PNPPOWERSHELL_CLIENTID (PNPPOWERSHELL_ is an already used prefix) PnPClientId PnPInteractiveClientId

Describe alternatives you've considered n/a

Additional context Related to new client ID process and single tenant app for interactive connections.

danmyhre avatar Sep 03 '24 18:09 danmyhre

To add to this one.. Most of our developers are working across dozens of tenants at any given time. It would even better if we could add tenant specific client IDs to the environment variables. Otherwise I have to keep track of them somewhere and constantly be looking up the IDs when switching between tenants.

mbice avatar Sep 06 '24 17:09 mbice

I think if no -ClientID parameter is passed, and the ENTRAID_APP_ID environment variable is not defined, Connect-PnPOnline should look for an environment variable, or maybe a stored credential called host_ENTRAID_APP_ID and try that. So if I'm trying to connect to contoso.sharepoint.com then Connect-PnPOnline would look for contoso.sharepoint.com_ENTRAID_APP_ID, much like it looks now for stored credentials.

ToddKlindt avatar Sep 06 '24 17:09 ToddKlindt

Like @ToddKlindt I'm one who constantly switches between two (sometimes more) Tenants. So, having a single ClientID as an environment variable is a bit of a hassle. I always forget to change the value, and then I keep looking uncomprehendingly at the error page. This is currently impeding me quite a bit.

TBH it feels like this change was rushed a bit and not well thought through.

nils-a avatar Sep 11 '24 09:09 nils-a

Hello all,

Please checkout these new cmdlets that we added in the nightly builds. Should help ease this issue, would love to hear your feedback on this.

https://pnp.github.io/powershell/cmdlets/Set-PnPManagedAppId.html

https://pnp.github.io/powershell/cmdlets/Get-PnPManagedAppId.html

https://pnp.github.io/powershell/cmdlets/Remove-PnPManagedAppId.html

gautamdsheth avatar Sep 26 '24 14:09 gautamdsheth

@gautamdsheth this is a great addition, thanks!

One small thing I noticed, though, is that when adding a subdomain, it doesn't automatically work for the -admin site collection, so in order to add a tenant to ENV variables we have to run Set-PnPManagedAppId twice (once for tenant.sharepoint.com and another for tenant-admin.sharepoint.com). Would it be possible for the code to respect the single App ID for both variations of the subdomain?

Thanks again!

mbice avatar Sep 26 '24 16:09 mbice

@gautamdsheth this is a great addition, thanks!

One small thing I noticed, though, is that when adding a subdomain, it doesn't automatically work for the -admin site collection, so in order to add a tenant to ENV variables we have to run Set-PnPManagedAppId twice (once for tenant.sharepoint.com and another for tenant-admin.sharepoint.com). Would it be possible for the code to respect the single App ID for both variations of the subdomain?

Thanks again!

Not exactly the fix you're looking for, but I almost never connect to the -admin site. All the commands I use that need -admin automatically connect there regardless of where I am actually connected. Because of that I always connect to https://contoso, which would grab the ClientID.

ToddKlindt avatar Sep 26 '24 16:09 ToddKlindt

Hello all,

Please checkout these new cmdlets that we added in the nightly builds. Should help ease this issue, would love to hear your feedback on this.

https://pnp.github.io/powershell/cmdlets/Set-PnPManagedAppId.html

https://pnp.github.io/powershell/cmdlets/Get-PnPManagedAppId.html

https://pnp.github.io/powershell/cmdlets/Remove-PnPManagedAppId.html

This look great. I can't wait to try it out!

ToddKlindt avatar Sep 26 '24 16:09 ToddKlindt