Set-SecretStoreConfiguration
配置 SecretStore。
语法
ParameterSet (默认值)
Set-SecretStoreConfiguration
[-Scope <SecureStoreScope>]
[-Authentication <Authenticate>]
[-PasswordTimeout <Int32>]
[-Interaction <Interaction>]
[-Password <SecureString>]
[-PassThru]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
DefaultParameterSet
Set-SecretStoreConfiguration
[-Default]
[-Password <SecureString>]
[-PassThru]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
说明
Important
PowerShell团队决定Secret模块功能已完备,不再积极开发。 这些模块将继续支持安全性和关键漏洞修复。 代码仓库已被归档。
最新发布的版本有:
自该项目设计以来,秘密的本质发生了根本变化。 无密码认证方法如通行密钥、单点登录以及联邦凭证系统如 Microsoft Entra ID、生物识别和硬件安全密钥是未来的趋势。
此 cmdlet 为当前用户配置 SecretStore。
示例
示例 1
PS C:\> Set-SecretStoreConfiguration -Default
Confirm
Are you sure you want to perform this action?
Performing the operation "Changes local store configuration" on target "SecretStore module local store".
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): Y
Scope Authentication PasswordTimeout Interaction
----- -------------- --------------- -----------
CurrentUser Password 900 Prompt
此示例将 SecretStore 还原为其默认配置。
参数
-Authentication
指定如何对 SecretStore的访问权限进行身份验证。 值必须为 Password 或 None。
如果指定为 None,则 cmdlet 允许在没有密码的情况下访问 SecretStore。 默认身份验证为 Password。
谨慎
将 身份验证 设置为 None 的安全性低于 Password。 指定 None 可能对测试方案有用,但不应与重要密钥一起使用。
参数属性
| 类型: | Microsoft.PowerShell.SecretStore.Authenticate |
| 默认值: | Password |
| 支持通配符: | False |
| 不显示: | False |
参数集
ParameterSet
| Position: | Named |
| 必需: | False |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | False |
| 来自剩余参数的值: | False |
-Confirm
在运行 cmdlet 之前,提示你进行确认。
参数属性
| 类型: | SwitchParameter |
| 默认值: | False |
| 支持通配符: | False |
| 不显示: | False |
| 别名: | cf |
参数集
(All)
| Position: | Named |
| 必需: | False |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | False |
| 来自剩余参数的值: | False |
-Default
指示应将 SecretStore 设置为其默认配置。
参数属性
| 类型: | SwitchParameter |
| 默认值: | False |
| 支持通配符: | False |
| 不显示: | False |
参数集
DefaultParameterSet
| Position: | Named |
| 必需: | False |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | False |
| 来自剩余参数的值: | False |
-Interaction
指定 SecretStore 在访问时是否应提示用户。 如果值 Prompt,则用户在需要时在交互式会话中提示输入其密码。 如果值为 None,则不会提示用户输入密码。 如果值 None 且需要密码,则要求密码的 cmdlet 将引发 Microsoft.PowerShell.SecretStore.PasswordRequiredException 错误。
参数属性
| 类型: | Microsoft.PowerShell.SecretStore.Interaction |
| 默认值: | False |
| 支持通配符: | False |
| 不显示: | False |
参数集
ParameterSet
| Position: | Named |
| 必需: | False |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | False |
| 来自剩余参数的值: | False |
-PassThru
指示 cmdlet 更新后应返回 SecretStore 配置。 默认情况下,cmdlet 不返回任何输出。
参数属性
| 类型: | SwitchParameter |
| 默认值: | False |
| 支持通配符: | False |
| 不显示: | False |
参数集
(All)
| Position: | Named |
| 必需: | False |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | False |
| 来自剩余参数的值: | False |
-Password
指定访问 SecretStore所需的密码。 此参数不能用于更改现有密码。 若要更改现有密码,请使用 Set-SecretStorePassword。
当此参数与 Authenticate 参数一起使用以将身份验证的配置从 None 更改为 Password时,此参数的值将设置为 SecretStore的新密码。
如果将此参数与 Authenticate 参数一起使用,将身份验证的配置从 Password 更改为 None,则此参数的值必须是 SecretStore的当前密码。 它用于授权配置更改。
参数属性
| 类型: | SecureString |
| 默认值: | None |
| 支持通配符: | False |
| 不显示: | False |
参数集
(All)
| Position: | Named |
| 必需: | False |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | False |
| 来自剩余参数的值: | False |
-PasswordTimeout
指定使用密码进行身份验证后,SecretStore 保持解锁的秒数。 超时过后,会话的当前密码值将失效。 在超时后访问 SecretStore 需要再次密码。
参数属性
| 类型: | Int32 |
| 默认值: | None |
| 支持通配符: | False |
| 不显示: | False |
参数集
ParameterSet
| Position: | Named |
| 必需: | False |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | False |
| 来自剩余参数的值: | False |
-Scope
指定 SecretStore 配置的上下文。 目前仅支持 CurrentUser。
参数属性
| 类型: | Microsoft.PowerShell.SecretStore.SecureStoreScope |
| 默认值: | None |
| 接受的值: | CurrentUser, AllUsers |
| 支持通配符: | False |
| 不显示: | False |
参数集
ParameterSet
| Position: | Named |
| 必需: | False |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | False |
| 来自剩余参数的值: | False |
-WhatIf
显示 cmdlet 运行时会发生什么情况。 cmdlet 未能运行。
参数属性
| 类型: | SwitchParameter |
| 默认值: | False |
| 支持通配符: | False |
| 不显示: | False |
| 别名: | 无线 |
参数集
(All)
| Position: | Named |
| 必需: | False |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | False |
| 来自剩余参数的值: | False |
CommonParameters
此 cmdlet 支持通用参数:-Debug、-ErrorAction、-ErrorVariable、-InformationAction、-InformationVariable、-OutBuffer、-OutVariable、-PipelineVariable、-ProgressAction、-Verbose、-WarningAction 和 -WarningVariable。 有关详细信息,请参阅 about_CommonParameters。