Background
The Property parameter introduced in Version 0.10.0-preview allowed customers to select specific properties they would want to return in the response and is used in these 2 main scenarios:
- To request extra properties that are not returned by default.
- To return a subset of the properties when the response returns a lot of properties by default (for performance reasons).
The scenarios above introduce a limitation where only the specified properties are returned, while the default properties are excluded from the response.
The AppendSelected switch parameter we shipped in version 1.0.12 solves this limitation by ensuring that the default properties are returned together with the specified properties.
Implementation
This parameter has been implemented in some Get-* cmdlets in the Microsoft.Entra.Users, Microsoft.Entra.Groups and Microsoft.Entra.Applications sub-modules.
Usage
Install Entra PowerShell
Install-Module -Name Microsoft.Entra -RequiredVersion 1.0.12 -Repository PSGallery -Force -AllowClobber
Note we are installing the version which we shipped this feature. All later versions should contain this feature.
Connect to the tenant
We use the Connect-Entra cmdlet to connect to a Microsoft tenant. You pass all the required scopes.
We can start by invoking the command without the AppendSelected parameter.
Get-EntraGroup -GroupId 'aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb' -Property IsManagementRestricted | Select-Object Id, DisplayName, MailEnabled, Visibility, IsManagementRestricted | Format-Table -AutoSize
Below is the output
Id DisplayName MailEnabled Visibility IsManagementRestricted
-- ----------- --------------- ---------- ----------
False
Since in our property selection we only selected IsManagementRestricted, some important properties are blank.
Let’s now invoke the command with the AppendSelected parameter.
Get-EntraGroup -GroupId 'aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb' -Property IsManagementRestricted -AppendSelected | Select-Object Id, DisplayName, MailEnabled, Visibility, IsSubscribedByMail | Format-Table -AutoSize
Output
Id DisplayName MailEnabled Visibility IsManagementRestricted
-- ----------- --------------- ---------- ----------
aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb SimpleGroup False Public False
This example demonstrates how to append a selected property to the default properties. We have selected IsManagementRestricted property. Id, DisplayName, MailEnabled, Visibility are also returned.
Summary
This post demonstrates how we can use the AppendSelected parameter. This parameter is only available in a few Get-* cmdlets. With time, we will add the parameter to more cmdlets.
Kindly do not hesitate to leave your comments below or create github issues whenever you encounter an issue or you would like us to add the parameter to specific cmdlet(s).
0 comments
Be the first to start the discussion.