你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
若要在 Azure Key Vault 中启用密钥供加密操作使用,请使用 SecretClient 类的 updateKeyProperties 方法。
启用密钥
若要在 Azure Key Vault 中启用密钥,请使用 KeyClient 类的 updateKeyProperties 方法。
const properties = await keyClient.updateKeyProperties(
keyName,
version, // optional, remove to update the latest version
{ enabled: true }
);
有关完整代码示例,请查看更新密钥属性示例。
禁用新密钥
若要禁用新密钥,请使用 createKey 方法,并使用 createKeyOptions 禁用该密钥。
const keyVaultKey = await keyClient.createKey(keyName, keyType, { enabled: false });
禁用现有密钥
若要在 Azure Key Vault 中禁用密钥,请使用 KeyClient 类的 updateKeyProperties 方法。
const properties = await keyClient.updateKeyProperties(
keyName,
version, // optional, remove to update the latest version
{ enabled: false }
);
有关完整代码示例,请查看更新密钥属性示例。