Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Doc]: Docs claim piping should be supported, but AutoRest does not support it #26679

Open
sardobi opened this issue Nov 13, 2024 · 1 comment

Comments

@sardobi
Copy link

sardobi commented Nov 13, 2024

Type of issue

Outdated article

Feedback

(This is about the engineering docs.)

The piping best practices docs say this:

For all resources, -InputObject should be implemented for at least the Remove-*, Set-* and Update-* cmdlets

This doesn't seem to be true for Set-* today, though:

  • AutoRest doesn't automatically provide an -InputObject implementation, as far as we can tell
  • Manually implementing it is hard. In a help channel, @VeryEarly mentioned that "To have similar functionality requires similar customization and as you can see it is quite complicated."
  • Several major Azure resources don't support it for Set-, e.g. Set-AzStorageAccount, Set-AzVM

Suspect the docs are outdated here, or at least don't apply for AutoRest-based cmdlets.

Page URL

https://github.com/Azure/azure-powershell/blob/b08bc7cb8c20c5302d126dda1ce89967d124b9ce/documentation/development-docs/design-guidelines/piping-best-practices.md

Content source URL

For all resources, `-InputObject` should be implemented for at least the `Remove-*`, `Set-*` and `Update-*` cmdlets (and any other cmdlet where an existing resource is being operated on, such as `Start-*`, `Stop-*`, etc.). The implementation of this will be a new parameter set, like the following:

Author

No response

Document Id

No response

@sardobi sardobi added Doc - Internal needs-triage This is a new issue that needs to be triaged to the appropriate team. labels Nov 13, 2024
@microsoft-github-policy-service microsoft-github-policy-service bot removed the needs-triage This is a new issue that needs to be triaged to the appropriate team. label Nov 13, 2024
@sardobi
Copy link
Author

sardobi commented Nov 13, 2024

Also, we've had conflicting advice about how piping semantics should work.

The docs recommend the following semantics to update a resource:

Get-AzMyResourceType | Set-AzMyResourceType -SomeProperty "someValue"

But some cmdlets work differently, e.g. Set-AzWcfRelay needs the resource's name / group to be specified separately from the piped data:

Get-AzWcfRelay -ResourceGroupName $rg -Name $name | Set-AzWcfRelay -ResourceGroupName $rg -Name $name

And we've separately heard that only the name and resource group from the -InputObject will be respected and the other data will be ignored - which is the opposite of the Relay example

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants