From ad2e1658ebbeb0a4e0483d1fecdd04e16aee9bb7 Mon Sep 17 00:00:00 2001 From: Gautam Sheth Date: Wed, 15 Apr 2026 22:35:19 +0300 Subject: [PATCH 1/2] Add -UseBeta parameter to Get-PnPEntraIDUser cmdlet and update documentation --- CHANGELOG.md | 1 + documentation/Get-PnPEntraIDUser.md | 20 +++++++++++++++++--- src/Commands/EntraID/GetEntraIDUser.cs | 7 ++++++- 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4fc5b1b07..f6f0cdb7b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -52,6 +52,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/). - Added parameter IncreaseRequestTimeout to `Get-PnPSearchCrawlLog` cmdlet. [#5223](https://github.com/pnp/powershell/pull/5223) ### Fixed +- Fix `Get-PnPEntraIDUser` to align supported Graph permission metadata, preserve `-Select` for GUID-based identity lookups, and expose `-UseBeta` consistently across parameter sets. - Fix `Set-PnPView -Aggregations` parameter not showing aggregations in SharePoint online. [#4868](https://github.com/pnp/powershell/pull/4868) - Fix `-CreateDrive` parameter not working correctly in `Connect-PnPOnline`. [#4869](https://github.com/pnp/powershell/pull/4869) - Fix `Get/Remove/Restore-PnPFileVersion` cmdlets to properly handle file names which have encoded values. diff --git a/documentation/Get-PnPEntraIDUser.md b/documentation/Get-PnPEntraIDUser.md index 3a05da7a6..c80508c32 100644 --- a/documentation/Get-PnPEntraIDUser.md +++ b/documentation/Get-PnPEntraIDUser.md @@ -21,17 +21,17 @@ Retrieves users from Entra ID. By default the following properties will be loade ### Return a list (Default) ```powershell -Get-PnPEntraIDUser [-Filter ] [-OrderBy ] [-Select ] [-StartIndex ] [-EndIndex] [-Connection ] +Get-PnPEntraIDUser [-Filter ] [-OrderBy ] [-Select ] [-StartIndex ] [-EndIndex] [-UseBeta] [-Connection ] ``` ### Return by specific ID ```powershell -Get-PnPEntraIDUser [-Identity ] [-Select ] [-Connection ] +Get-PnPEntraIDUser [-Identity ] [-Select ] [-UseBeta] [-Connection ] ``` ### Return the delta ```powershell -Get-PnPEntraIDUser [-Filter ] [-OrderBy ] [-Select ] [-Delta] [-DeltaToken ] [-StartIndex ] [-EndIndex] [-Connection ] +Get-PnPEntraIDUser [-Filter ] [-OrderBy ] [-Select ] [-Delta] [-DeltaToken ] [-StartIndex ] [-EndIndex] [-UseBeta] [-Connection ] ``` ## DESCRIPTION @@ -226,6 +226,20 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -UseBeta +Uses the Microsoft Graph beta endpoint instead of the v1.0 endpoint. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ### -Connection Optional connection to be used by the cmdlet. Retrieve the value for this parameter by either specifying -ReturnConnection on Connect-PnPOnline or by executing Get-PnPConnection. diff --git a/src/Commands/EntraID/GetEntraIDUser.cs b/src/Commands/EntraID/GetEntraIDUser.cs index 91eeb585b..da72cd754 100644 --- a/src/Commands/EntraID/GetEntraIDUser.cs +++ b/src/Commands/EntraID/GetEntraIDUser.cs @@ -7,7 +7,10 @@ namespace PnP.PowerShell.Commands.EntraID { [Cmdlet(VerbsCommon.Get, "PnPEntraIDUser", DefaultParameterSetName = ParameterSet_LIST)] + [RequiredApiDelegatedOrApplicationPermissions("graph/Directory.Read.All")] + [RequiredApiDelegatedOrApplicationPermissions("graph/Directory.ReadWrite.All")] [RequiredApiDelegatedOrApplicationPermissions("graph/User.Read.All")] + [RequiredApiDelegatedOrApplicationPermissions("graph/User.ReadWrite.All")] [Alias("Get-PnPAzureADUser")] public class GetAzureADUser : PnPGraphCmdlet { @@ -49,6 +52,8 @@ public class GetAzureADUser : PnPGraphCmdlet [Parameter(Mandatory = false, ParameterSetName = ParameterSet_LIST)] public SwitchParameter IgnoreDefaultProperties; + [Parameter(Mandatory = false, ParameterSetName = ParameterSet_BYID)] + [Parameter(Mandatory = false, ParameterSetName = ParameterSet_LIST)] [Parameter(Mandatory = false, ParameterSetName = ParameterSet_DELTA)] public SwitchParameter UseBeta; @@ -64,7 +69,7 @@ protected override void ExecuteCmdlet() PnP.PowerShell.Commands.Model.AzureAD.User user; if (Guid.TryParse(Identity, out Guid identityGuid)) { - user = Utilities.EntraIdUtility.GetUser(AccessToken, identityGuid, ignoreDefaultProperties: IgnoreDefaultProperties, useBetaEndPoint: UseBeta.IsPresent, azureEnvironment: Connection.AzureEnvironment); + user = Utilities.EntraIdUtility.GetUser(AccessToken, identityGuid, Select, ignoreDefaultProperties: IgnoreDefaultProperties, useBetaEndPoint: UseBeta.IsPresent, azureEnvironment: Connection.AzureEnvironment); } else { From 34bc17d98eca1e2ced95a621aa0bca7dd75ca33d Mon Sep 17 00:00:00 2001 From: Gautam Sheth Date: Wed, 15 Apr 2026 22:42:21 +0300 Subject: [PATCH 2/2] Fix Get-PnPEntraIDUser cmdlet to align Graph permission metadata and ensure consistent exposure of -UseBeta parameter across all parameter sets --- CHANGELOG.md | 2 +- documentation/Get-PnPEntraIDUser.md | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f6f0cdb7b..078d8bc80 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -52,7 +52,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/). - Added parameter IncreaseRequestTimeout to `Get-PnPSearchCrawlLog` cmdlet. [#5223](https://github.com/pnp/powershell/pull/5223) ### Fixed -- Fix `Get-PnPEntraIDUser` to align supported Graph permission metadata, preserve `-Select` for GUID-based identity lookups, and expose `-UseBeta` consistently across parameter sets. +- Fix `Get-PnPEntraIDUser` to align supported Graph permission metadata, preserve `-Select` for GUID-based identity lookups, and expose `-UseBeta` consistently across parameter sets. [#5290](https://github.com/pnp/powershell/pull/5290) - Fix `Set-PnPView -Aggregations` parameter not showing aggregations in SharePoint online. [#4868](https://github.com/pnp/powershell/pull/4868) - Fix `-CreateDrive` parameter not working correctly in `Connect-PnPOnline`. [#4869](https://github.com/pnp/powershell/pull/4869) - Fix `Get/Remove/Restore-PnPFileVersion` cmdlets to properly handle file names which have encoded values. diff --git a/documentation/Get-PnPEntraIDUser.md b/documentation/Get-PnPEntraIDUser.md index c80508c32..8e7844647 100644 --- a/documentation/Get-PnPEntraIDUser.md +++ b/documentation/Get-PnPEntraIDUser.md @@ -21,7 +21,7 @@ Retrieves users from Entra ID. By default the following properties will be loade ### Return a list (Default) ```powershell -Get-PnPEntraIDUser [-Filter ] [-OrderBy ] [-Select ] [-StartIndex ] [-EndIndex] [-UseBeta] [-Connection ] +Get-PnPEntraIDUser [-Filter ] [-OrderBy ] [-Select ] [-StartIndex ] [-EndIndex ] [-UseBeta] [-Connection ] ``` ### Return by specific ID @@ -31,7 +31,7 @@ Get-PnPEntraIDUser [-Identity ] [-Select ] [-UseBeta] [-Connec ### Return the delta ```powershell -Get-PnPEntraIDUser [-Filter ] [-OrderBy ] [-Select ] [-Delta] [-DeltaToken ] [-StartIndex ] [-EndIndex] [-UseBeta] [-Connection ] +Get-PnPEntraIDUser [-Filter ] [-OrderBy ] [-Select ] [-Delta] [-DeltaToken ] [-StartIndex ] [-EndIndex ] [-UseBeta] [-Connection ] ``` ## DESCRIPTION