Skip to content
This repository was archived by the owner on Jun 22, 2026. It is now read-only.

Commit e4df84e

Browse files
authored
Add docs from Learn prior to archiving the project (#249)
1 parent 72678c0 commit e4df84e

20 files changed

Lines changed: 2524 additions & 0 deletions
Lines changed: 161 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,161 @@
1+
---
2+
external help file: Microsoft.PowerShell.SecretManagement.dll-Help.xml
3+
Module Name: Microsoft.PowerShell.SecretManagement
4+
ms.date: 05/23/2025
5+
online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.secretmanagement/get-secret?view=ps-modules&wt.mc_id=ps-gethelp
6+
schema: 2.0.0
7+
---
8+
9+
# Get-Secret
10+
11+
## SYNOPSIS
12+
Finds and returns a secret by name from registered vaults.
13+
14+
## SYNTAX
15+
16+
### NameParameterSet (Default)
17+
18+
```
19+
Get-Secret [-Name] <String> [[-Vault] <String>] [-AsPlainText] [<CommonParameters>]
20+
```
21+
22+
### InfoParameterSet
23+
24+
```
25+
Get-Secret [-InputObject] <SecretInformation> [-AsPlainText] [<CommonParameters>]
26+
```
27+
28+
## DESCRIPTION
29+
30+
This cmdlet finds and returns the first secret that matches the provided name. If a vault name is
31+
specified, only that vault is searched. Otherwise, it searches all vaults and returns the first
32+
matching result. If the vault registry has a default vault, the cmdlet searches that vault before
33+
any other registered vault. Secrets that are **String** or **SecureString** types are returned as
34+
**SecureString** objects by default.
35+
36+
## EXAMPLES
37+
38+
### Example 1
39+
40+
```powershell
41+
Get-Secret -Name Secret1 -Vault CredMan
42+
Get-Secret -Name Secret1 -Vault CredMan -AsPlainText
43+
```
44+
45+
```output
46+
System.Security.SecureString
47+
PlainTextSecretString
48+
```
49+
50+
This example searches for a secret with the name `Secret1`, which is a **String** type secret. The
51+
first command returns the secret as a **SecureString** object. The second command uses the
52+
**AsPlainText** parameter to return the secret as a **String** object instead, displaying in the
53+
console as plain text.
54+
55+
### Example 2
56+
57+
```powershell
58+
Get-SecretInfo -Name Secret2 -Vault SecretStore |
59+
Get-Secret -AsPlainText
60+
```
61+
62+
This example retrieves secret information for the secret named `Secret2` in the vault named
63+
`SecretStore`. It then sends the result through the pipeline to `Get-Secret`, which searches for the
64+
secret and returns it as plain text.
65+
66+
## PARAMETERS
67+
68+
### -AsPlainText
69+
70+
Specifies that a secret whose type is **String** or **SecureString** should be returned as a
71+
**String** (in plain text) instead of a **SecureString**. If the secret being retrieved isn't a
72+
**String** or **SecureString**, this parameter has no effect.
73+
74+
> [!CAUTION]
75+
> To ensure security, you should avoid using plaintext strings whenever possible.
76+
77+
```yaml
78+
Type: System.Management.Automation.SwitchParameter
79+
Parameter Sets: (All)
80+
Aliases:
81+
82+
Required: False
83+
Position: Named
84+
Default value: False
85+
Accept pipeline input: False
86+
Accept wildcard characters: False
87+
```
88+
89+
### -InputObject
90+
91+
Specifies a **SecretInformation** object representing a vault secret instead of specifying the
92+
**Name** and **Vault** parameters. You can get a **SecretInformation** object with the
93+
`Get-SecretInfo` cmdlet.
94+
95+
```yaml
96+
Type: Microsoft.PowerShell.SecretManagement.SecretInformation
97+
Parameter Sets: InfoParameterSet
98+
Aliases:
99+
100+
Required: True
101+
Position: 0
102+
Default value: None
103+
Accept pipeline input: True (ByValue)
104+
Accept wildcard characters: False
105+
```
106+
107+
### -Name
108+
109+
Specifies the name of the secret to retrieve. Wildcard characters aren't permitted.
110+
111+
```yaml
112+
Type: System.String
113+
Parameter Sets: NameParameterSet
114+
Aliases:
115+
116+
Required: True
117+
Position: 0
118+
Default value: None
119+
Accept pipeline input: True (ByValue)
120+
Accept wildcard characters: False
121+
```
122+
123+
### -Vault
124+
125+
Specifies the name of the registered vault to retrieve the secret from. If no vault name is
126+
specified, then all registered vaults are searched. If the vault registry has a default vault and
127+
this parameter isn't specified, then the default vault is searched before the other registered
128+
vaults.
129+
130+
```yaml
131+
Type: System.String
132+
Parameter Sets: NameParameterSet
133+
Aliases:
134+
135+
Required: False
136+
Position: 1
137+
Default value: None
138+
Accept pipeline input: False
139+
Accept wildcard characters: False
140+
```
141+
142+
### CommonParameters
143+
144+
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable,
145+
-InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose,
146+
-WarningAction, and -WarningVariable. For more information, see
147+
[about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
148+
149+
## INPUTS
150+
151+
### System.String
152+
153+
### Microsoft.PowerShell.SecretManagement.SecretInformation
154+
155+
## OUTPUTS
156+
157+
### System.Object
158+
159+
## NOTES
160+
161+
## RELATED LINKS
Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
---
2+
external help file: Microsoft.PowerShell.SecretManagement.dll-Help.xml
3+
Module Name: Microsoft.PowerShell.SecretManagement
4+
ms.date: 05/23/2025
5+
online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.secretmanagement/get-secretinfo?view=ps-modules&wt.mc_id=ps-gethelp
6+
schema: 2.0.0
7+
---
8+
9+
# Get-SecretInfo
10+
11+
## SYNOPSIS
12+
Finds and returns metadata information about secrets in registered vaults.
13+
14+
## SYNTAX
15+
16+
```
17+
Get-SecretInfo [[-Name] <String>] [[-Vault] <String>] [<CommonParameters>]
18+
```
19+
20+
## DESCRIPTION
21+
22+
This cmdlet finds and returns information about secrets in registered vaults. By default, it returns
23+
information for every secret in all registered vaults.
24+
25+
## EXAMPLES
26+
27+
### Example 1
28+
29+
```powershell
30+
Get-SecretInfo -Name *
31+
```
32+
33+
```output
34+
Name Type VaultName
35+
---- ---- ---------
36+
Secret1 String LocalStore
37+
Secret2 ByteArray LocalStore
38+
Secret3 SecureString LocalStore
39+
Secret4 PSCredential LocalStore
40+
Secret5 Hashtable LocalStore
41+
Secret6 ByteArray CredMan
42+
```
43+
44+
This example specifies the **Name** parameter as a single wildcard (`*`) character to return
45+
metadata for all stored secrets. There are two registered vaults, `LocalStore` and `CredMan`. There
46+
are six **SecretInformation** objects returned from the two vaults.
47+
48+
The output objects every valid type a secret can be:
49+
50+
- **ByteArray**
51+
- **Hashtable**
52+
- **PSCredential**
53+
- **SecureString**
54+
- **String**
55+
56+
### Example 2
57+
58+
```powershell
59+
Get-SecretInfo -Name SecretWithMetadata | Select-Object -ExpandProperty Metadata
60+
```
61+
62+
```output
63+
Key Value
64+
--- -----
65+
Environment Development
66+
Expiration 5/1/2022 12:00:00 AM
67+
GroupNumber 7
68+
```
69+
70+
This example retrieves the `SecretWithMetadata` secret and displays its metadata. The entries in the
71+
hashtable show every valid type metadata values can be:
72+
73+
- **String**
74+
- **DateTime**
75+
- **Int**
76+
77+
## PARAMETERS
78+
79+
### -Name
80+
81+
Specifies the name of a secret. This cmdlet only gets metadata for secrets that have the specified
82+
name. Enter a name or name pattern. Wildcard characters are permitted.
83+
84+
If the **Name** parameter isn't specified, this cmdlet returns the metadata for all stored secrets.
85+
86+
```yaml
87+
Type: System.String
88+
Parameter Sets: (All)
89+
Aliases:
90+
91+
Required: False
92+
Position: 0
93+
Default value: None
94+
Accept pipeline input: False
95+
Accept wildcard characters: True
96+
```
97+
98+
### -Vault
99+
100+
Specifies the name of a vault to search for secret metadata. Wildcard characters aren't permitted.
101+
102+
If the **Vault** parameter isn't specified, this cmdlet searches for metadata in all registered
103+
vaults.
104+
105+
```yaml
106+
Type: System.String
107+
Parameter Sets: (All)
108+
Aliases:
109+
110+
Required: False
111+
Position: 1
112+
Default value: None
113+
Accept pipeline input: False
114+
Accept wildcard characters: False
115+
```
116+
117+
### CommonParameters
118+
119+
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable,
120+
-InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose,
121+
-WarningAction, and -WarningVariable. For more information, see
122+
[about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
123+
124+
## INPUTS
125+
126+
### None
127+
128+
## OUTPUTS
129+
130+
### Microsoft.PowerShell.SecretManagement.SecretInformation
131+
132+
## NOTES
133+
134+
## RELATED LINKS
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
---
2+
external help file: Microsoft.PowerShell.SecretManagement.dll-Help.xml
3+
Module Name: Microsoft.PowerShell.SecretManagement
4+
ms.date: 05/23/2025
5+
online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.secretmanagement/get-secretvault?view=ps-modules&wt.mc_id=ps-gethelp
6+
schema: 2.0.0
7+
---
8+
9+
# Get-SecretVault
10+
11+
## SYNOPSIS
12+
Finds and returns registered vault information.
13+
14+
## SYNTAX
15+
16+
```
17+
Get-SecretVault [[-Name] <String[]>] [<CommonParameters>]
18+
```
19+
20+
## DESCRIPTION
21+
22+
This cmdlet finds and returns information about registered vaults. By default, it returns
23+
information for every registered vault.
24+
25+
## EXAMPLES
26+
27+
### Example 1
28+
29+
```powershell
30+
Get-SecretVault
31+
```
32+
33+
```output
34+
VaultName ModuleName IsDefaultVault
35+
--------- ---------- --------------
36+
CredMan Microsoft.PowerShell.CredManStore False
37+
LocalStore Microsoft.PowerShell.SecretStore True
38+
```
39+
40+
This example runs the command without any parameters to return information on all registered vaults.
41+
The `LocalStore` vault is shown to be set as the default vault.
42+
43+
### Example 2
44+
45+
```powershell
46+
Get-SecretVault -Name LocalStore | Format-List -Property *
47+
```
48+
49+
```output
50+
Name : LocalStore
51+
ModuleName : Microsoft.PowerShell.SecretStore
52+
ModulePath : C:\Users\User01\Documents\PowerShell\Modules\Microsoft.PowerShell.SecretStore
53+
Description : Personal secrets for non-production use.
54+
VaultParameters : {}
55+
IsDefault : True
56+
```
57+
58+
This example shows additional information about the `LocalStore` vault.
59+
60+
## PARAMETERS
61+
62+
### -Name
63+
64+
Specifies the name of a vault. This cmdlet only gets information for vaults that have the specified
65+
name. Enter a name or name pattern. Wildcard characters are permitted.
66+
67+
If the **Name** parameter isn't specified, this cmdlet returns the information for all registered
68+
vaults.
69+
70+
```yaml
71+
Type: System.String[]
72+
Parameter Sets: (All)
73+
Aliases:
74+
75+
Required: False
76+
Position: 0
77+
Default value: None
78+
Accept pipeline input: False
79+
Accept wildcard characters: True
80+
```
81+
82+
### CommonParameters
83+
84+
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable,
85+
-InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose,
86+
-WarningAction, and -WarningVariable. For more information, see
87+
[about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
88+
89+
## INPUTS
90+
91+
### None
92+
93+
## OUTPUTS
94+
95+
### Microsoft.PowerShell.SecretManagement.SecretVaultInfo
96+
97+
## NOTES
98+
99+
## RELATED LINKS

0 commit comments

Comments
 (0)