PowerShell – Microsoft Secret Vault Store

There are many virtual vault solution to store the passwords like lastpass, key pass etc.

Today we will go thru PowerShell Microsoft Secret Vault that you can utilize with PowerShell, you can store credentials securely and have a master password to access it.

Install the below modules:

Insatll-Module -Name Microsoft.PowerShell.SecretManagement

Insatll-Module -Name Microsoft.PowerShell.SecretStore

Let us check the commands in these modules:

Get-Command -Module Microsoft.PowerShell.SecretManagement

Get-Command -Module Microsoft.PowerShell.SecretStore

Once the above modules are installed, register the Vault using below command

Register-SecretVault -ModuleName Microsoft.PowerShell.SecretStore -Name TechWizardVault -DefaultVault:$true

Get-SecretVault vault will show the registered Vault.

Let us save one of the secret password in the Vault. (first time it will ask you to create a master password)

Set-Secret -Name “TechWizardSecret” -Secret “passwrord1234”

Now your first secret is stored in the Vault, lets retrieve this password from the vault.

Get-Secret -Name TechwizardSecret
(It asks for the master password before it will reveal the stored credential)

See above, another good thing is it is secured string but you can retrieve it as plain text as well using below command.

Get-Secret -Name TechWizardSecret -AsPlainText

Another example of storage is à pscredentials, you can store that as well.

Set-Secret -name techwizarddomaincred -secret (get-credential techwizard\svikas)

Use get-secretinfo to check what is stored in the vault. (see the type)

There can be lot of use cases of using these two modules, explore further and use it as per your requirements.

Read More: SecretManagement and SecretStore

Use Case: Credential Management | PnP PowerShell


Thanks for reading…..

Tech Wizard





Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s