aaearon / SecretManagement.CyberArk

A SecretManagement extension for CyberArk.
https://timschindler.blog/secretmanagementcyberark-an-extension-for-the-secretmanagement-powershell-module
MIT License
12 stars 0 forks source link

Convert `$AdditionalParameters` values to full parameters. #5

Closed TechDufus closed 3 years ago

TechDufus commented 3 years ago

Great job on this extension!

After looking through the module functions, I wanted to suggest instead of passing in a hashtable with some cyberark-specific lingo to AdditionalParameters, instead add those values as parameters.

For example, in Set-Secret, you have a -VaultName parameter, but it is not actually used, as the function assumes you are passing in the safeName value via the -AdditionalParameters hashtable. https://github.com/aaearon/SecretManagement.CyberArk/blob/f820808ded0156109bf6608337a8fa201e6f84df/SecretManagement.CyberArk.Extension/SecretManagement.CyberArk.Extension.psm1#L104-L123

You could create an alias on VaultName to be safeName so that either value could be passed in via a splatted hashtable to the function itself, and not only a parameter.

Additionally, you could pass in some of these other values like address, platformID, etc... to a -Metadata hashtable parameter, which would give your cmdlets the same behavior as the official Microsoft.PowerShell.SecretManagement cmdlets.

Thoughts?

TechDufus commented 3 years ago

Nevermind on this. Just watched Justin Grote's Vault Extension session at PSHSummit, this is the way it's written. My bad. 🙂