Skip to content

Commit

Permalink
tpi: Add SecretManagement tip
Browse files Browse the repository at this point in the history
  • Loading branch information
deadlydog committed Oct 7, 2023
1 parent d41d830 commit 43a3c93
Showing 1 changed file with 36 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
$tip = [tiPS.PowerShellTip]::new()
$tip.CreatedDate = [DateTime]::Parse('2023-10-07')
$tip.Title = 'Store and retrieve secrets securely with SecretManagement'
$tip.TipText = @'
The Microsoft.PowerShell.SecretManagement module allows you to store secrets securely in a vault and retrieve them interactively, or in automated processes. This provides a secure alternative to storing secrets in plain text files, or continually being prompted for them.
The Microsoft.PowerShell.SecretStore module is a vault for storing secrets locally on your machine. There are other modules that provide integration with other vaults, such as Azure Key Vault, HashiCorp Vault, and LastPass. You can view them at https://aka.ms/SecretManagementVaults.
'@
$tip.Example = @'
# Install the SecretManagement and SecretStore modules.
Install-Module Microsoft.PowerShell.SecretManagement -Repository PSGallery
Install-Module Microsoft.PowerShell.SecretStore -Repository PSGallery
# Register the SecretStore vault with the SecretManagement module.
Register-SecretVault -Name LocalFileSecretStore -ModuleName Microsoft.PowerShell.SecretStore -DefaultVault
# Store a secret in the vault (will be prompted for a vault password the 1st time).
Set-Secret -Name MySecret -Secret 'MySecretValue'
# Retrieve the secret from the vault.
Get-Secret -Name MySecret
'@
$tip.Urls = @(
'https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.secretmanagement/?view=ps-modules'
'https://www.pdq.com/blog/how-to-manage-powershell-secrets-with-secretsmanagement/'
)
$tip.Category = [tiPS.TipCategory]::Other # Community, Editor, Module, NativeCmdlet, Performance, Syntax, Terminal, or Other.

# Community: Social events and community resources. e.g. PowerShell Summit, podcasts, etc.
# Editor: Editor tips and extensions. e.g. VSCode, ISE, etc.
# Module: Modules and module tips. e.g. PSScriptAnalyzer, Pester, etc.
# NativeCmdlet: Native cmdlet tips. e.g. Get-Process, Get-ChildItem, Get-Content, etc.
# Performance: Tips to improve performance. e.g. foreach vs ForEach-Object, ForEach-Object -Parallel, etc.
# Syntax: Syntax tips. e.g. splatting, pipeline, etc.
# Terminal: Terminal shortcuts and tips. e.g. PSReadLine, Windows Terminal, ConEmu, etc.
# Other: Tips that don't fit into any of the other categories.

0 comments on commit 43a3c93

Please sign in to comment.