entra-powershell icon indicating copy to clipboard operation
entra-powershell copied to clipboard

Pipeline support in Entra PowerShell

Open alexandair opened this issue 1 year ago • 3 comments

It looks like Entra PowerShell is going into another extreme compared to the Microsoft.Graph that's famous for almost nonexistent pipeline support.

Let's look, for example, at the Get-EntraUser and Get-EntraGroup commands. All their parameters accept the pipeline input ByValue and ByPropertyName. There is no a single reason for that kind of design. Why would -All and -Top parameters accept the pipeline input? Just because that's wrongly executed in AzureAD module?

Things that are wrong in AzureAD (another example is a Boolean -All parameter) should not be inherited in Entra PowerShell.

alexandair avatar May 05 '24 20:05 alexandair

@alexandair What would be your proposal for better handling of pipeline input?

KenitoInc avatar May 09 '24 08:05 KenitoInc

@alexandair I totally agree that All and Top should not be accepting pipeline input. We are working to resolve that. Also All should be a Switch Parameter. There is a PR to fix that #770

We have pipelining in Entra PowerShell for example. We can Get a group and use the result to Get the group members image

We can Get an application the use the result to Get the application proxy image

We are really interested in understanding the pipeline scenarios that you would like supported. For example, do you expect parameters like SearchString to accepted Pipeline input?

"Box" | Get-EntraBetaApplication

These scenarios will go along way in helping us improve pipelining support for Entra PowerShell Thanks

KenitoInc avatar May 16 '24 13:05 KenitoInc

First, pipeline support should be fixed downstream in the Microsoft.Graph modules. Entra PowerShell should just "inherit" that functionality and maybe add some new ones based on a specific scenario (if there is a need for that).

One of the first patterns is: Get-Entra<object> | Set/Update/Remove-Entra<object>

Second pattern: Get-Entra<object> | Get/<otherVerbs>-Entra<object2><childObject>

e.g. Get-EntraUser | Get-EntraGroupMember

Pipelines with multiple commands, like:

# input is an array of user IDs
Get-Content userIDs.txt | Get-EntraUser | Update-EntraUser

# input is an array of the PSCustomObjects that represent user objects
Get-EntraUser | Export-Csv users.csv
Import-Csv users.csv | Update-EntraUser | New-EntraGroupMember

alexandair avatar May 18 '24 06:05 alexandair