如何使用 .Net SDK 更新在 Azure Key Vault 中创建的 Secret 的值

How do I update value of my Secret created in Azure Key Vault using .Net SDK

我在我的 KeyVault Secret 中添加了一个连接字符串。我想使用 .Net SDK 更新相同的内容,但找不到任何允许我这样做的方法。

我尝试使用 UpdateSecretAsync(),但此方法不接受秘密值。

谁能告诉我正确的方法。

使用SetSecretAsync方法。如果 secretName 不存在,它将创建它。如果它确实存在,它将替换它。

// Code to generate a new secret
var newSecret = "<the new secret>"

// Update the secret in the key vault
client.SetSecretAsync(vault, secretName, newSecret);