Get-MgApplication & Remove-MgApplication inconsistent use of ApplicationId (unable to pipe get to remove) #3069
Labels
status:waiting-for-triage
An issue that is yet to be reviewed or assigned
type:bug
A broken experience
Describe the bug
The following code does not work:
Get-MgApplication | ? {$_.displayname -eq 'test'} | Remove-MgApplication
The response from Remove-MgApplication is InputObject has null value for InputObject.ApplicationId
This response is valid as the output from Get-MgApplication returns Id and AppId, however, I believe that the intention shown by most other Powershell cmdlets is that there should be a consistent capability to pipe one command to another, especially when they are within the same module.
To workaround, I assumed the following would then work:
Get-MgApplication | ? {$_.displayname -eq 'test'} | % {Remove-MgApplication -ApplicationId $_.AppId}
This is incorrect as I need to send $_.Id because the API expects ObjectID (as per #1715 which was closed stating 'by design')
I understand that the API expects ObjectId, so why do these two applications have their parameter name as ApplicationId rather than ObjectId? Also, to assist in piping the commands together, could Remove-MgApplication have an alias for ApplicationId(aka ObjectId) that accepts InputObject.Id?
Finally, can the documentation of the cmdlets be updated so as to remove ambiguity around the usage of Id, ObjectId, ApplicationId and AppId?
Thanks.
Expected behavior
should be able to pipe output from get-MgApplication to remove-MgApplication
How to reproduce
Create an application called 'test'
Run connect-MgGraph
Run
Get-MgApplication | ? {$_.displayname -eq 'test'} | Remove-MgApplication
SDK Version
2.25.0
Latest version known to work for scenario above?
No response
Known Workarounds
Run
Get-MgApplication | ? {$_.displayname -eq 'test'} | % {Remove-MgApplication -ApplicationId $_.Id}
Debug output
Click to expand log
```The text was updated successfully, but these errors were encountered: