Skip to content
This repository was archived by the owner on Dec 8, 2021. It is now read-only.

Conversation

PaulHigin
Copy link
Contributor

This is an initial implementation of local vault support for our secret types, using CredMan. We still need a Linux version, which I'll work on next. Tests still need to be created.

Copy link
Member

@SteveL-MSFT SteveL-MSFT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok with the code changes, we should go through a cmdlet review however.

@PaulHigin
Copy link
Contributor Author

@SteveL-MSFT Then can you merge this to main branch? I don't have permissions and I don't want the work to get lost.

@@ -73,7 +46,9 @@ PowerShellVersion = '5.1'
FunctionsToExport = @()

# Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export.
CmdletsToExport = 'Register-SecretsVault','Unregister-SecretsVault','Get-SecretsVault','Add-Secret','Remove-Secret','Get-Secret'
CmdletsToExport = @(
'Register-SecretsVault','Unregister-SecretsVault','Get-SecretsVault','Add-Secret','Remove-Secret','Get-Secret','Get-Secrets')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is still a Get-Secret and Get-Secrets cmdlets?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should have two cmdlets that a) return a secret value and b) enumerate secrets with a useful display. I feel doing this in a single (Get-Secret) cmdlet is confusing. We don't need to use the current cmdlet names but we should have two separate ones.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For example:

New-PSSession -Credential (Get-Secret MyDomainCred)

and

Get-Secrets

Name        Value              Vault
----------  -------------      ---------------
AzCred      PSCredential       AzVault

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The original idea was to follow the pattern of Get-Command, Get-Alias and other Get cmdlets in that if you don't specify a filter or identifier, you enumerate them. This is a pretty consistent pattern in PowerShell.

In scripts, I expect it should always Get-Secret <secretName> [-Vault <ifneeded>]. Interactively, I expect folks to use Get-Secret to see what they have, then Get-Secret <secretName> to use.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but that doesn't work here because in the cases you cited, a single type is returned, e.g., CmdletInfo, but in the secrets case we return five types.

And the two use patterns are completely different. In one case we return a single secret type instance.

New-PSSession -cn . -credential (Get-Secret MyCred)

In the other we enumerate one or more secret dictionary entries along with contextual information.

Get-Secret
Name               Value               Vault
------             ------              -------
MyCred             PSCredential        AzVault
...

The use patterns are not compatible and require separate cmdlets to avoid confusion.

@SteveL-MSFT SteveL-MSFT merged commit 1f10a0d into PowerShell:master Nov 14, 2019
@PaulHigin PaulHigin deleted the initial_secrets_module branch November 18, 2019 15:32
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants