gpt4 book ai didi

azure - 启用软删除后无法从 Key Vault 中删除 secret

转载 作者:行者123 更新时间:2023-12-03 01:00:25 27 4
gpt4 key购买 nike

我使用 PowerShell 创建了一个 Key Vault 并为 Soft-Delete 启用了它。和Purge-Protection 。然后我创建了一些 Secret 并将它们推送到新的 Key Vault 中。创建 Key Vault 时创建的默认访问策略向我的帐户授予对 key 、 secret 和证书的所有权限,但 Purge 除外。 。正如预期的那样,当我尝试删除 Secrets 然后永久删除它们时,我得到了 Forbidden错误。然后我修改了访问策略,为我的帐户指定 Purge对 Secrets 的许可认为这将允许我永久删除 Secrets。然而,即使在提供了我的帐户Purge之后权限我仍然得到 Forbidden尝试永久删除 InRemovedState 中的 Secret 时出错.

最佳答案

如果您只启用Soft-Delete,则Purge权限就足够了。但如果您还启用了Purge-Protection,则无论您获得什么权限,都需要等待保留天数才能永久删除 secret 。

引用 - Purge protectionPermitted purge .

Exceptions are:

  • When the --enable-purge-protection flag is enabled on the vault itself. In this case, Key Vault will wait for 90 days from when the original secret object was marked for deletion to permanently delete the object.

默认情况下,保留期限为 90 天,如果需要,您可以通过 powershell 将其设置为 7 到 90 天。 (文档说一旦设置并保存就无法更改,实际上可以,只需使用powershell)

$r = Get-AzResource -ResourceGroupName <group-name> -ResourceType Microsoft.KeyVault/vaults -Name <keyvault-name>
$r.Properties.softDeleteRetentionInDays = "7"
$r | Set-AzResource -Force

enter image description here

关于azure - 启用软删除后无法从 Key Vault 中删除 secret ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61342357/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com