msgraph-sdk-powershell icon indicating copy to clipboard operation
msgraph-sdk-powershell copied to clipboard

Feature Request: Pipeline Input

Open danielniccoli opened this issue 5 years ago • 4 comments

This module should support pipeline input where possible.

Get-MgUser -UserId e5c3398d-6401-4dd6-bb87-6d3f95499aef | Get-MgUserLicenseDetail

Get-MgGroup -GroupId 0f764d03-afb6-45cd-a720-84708fc0d5dc | Get-MgGroupMember | Get-MgUser

AB#7446

danielniccoli avatar May 07 '20 19:05 danielniccoli

I'm sure the team has their own ideas on how this could work, but I feel like adding an alias property to the output of the commands would be a good solution.

For example:

Get-MgGroup | Add-Member -MemberType AliasProperty -Name 'GroupId' -Value 'Id'

... so now the output has a GroupId property that's the same as Id.

Now all that's necessary is to add the ValueFromPipelineByPropertyName attribute to the GroupId parameter on Get-MgGroupMember.

I realise this is easier said than done, given that you're auto-generating the functions.

mabster avatar Jun 14 '22 03:06 mabster

We are still waiting for the code generator (AutoREST.PowerShell) to support ValueFromPipelineByPropertyName for path parameters. This is being tracked in https://github.com/Azure/autorest.powershell/issues/616

peombwa avatar Oct 26 '22 18:10 peombwa

A breaking change will occur because we will need to drop support for -InputObject parameter set to support piping by ValueFromPipelineByPropertyName - Get-MgUser (Microsoft.Graph.Users) | Microsoft Learn.

AutoREST uses -InputObject to support piping via ValueFrompipeline, which doesn't work for MS Graph as explained at https://github.com/Azure/autorest.powershell/issues/616. Adding support for piping via ValueFromPipelineByPropertyName has the effect of breaking customers who've taken a dependency on the publicly documented InputObject parameter.

peombwa avatar Aug 23 '23 16:08 peombwa

@timayabi2020, is there a design for this feature put down anywhere?

calebkiage avatar Feb 28 '24 13:02 calebkiage