更改现有 Azure Key Vault 的访问策略

Change access policy of existing Azure Key Vault

我正在尝试使用 Fluent Managment 为现有的 Azure Key Vault 设置访问策略

我可以在创建期间定义访问策略并在创建之后访问它们,但我找不到任何方法来稍后更改它。 我想添加Set权限,添加一些秘密,然后撤销它。

 _azure.Vaults.Define(name)
                    .WithRegion(group.Region)
                    .WithExistingResourceGroup(group)
                    .DefineAccessPolicy()
                        .ForServicePrincipal(principalName)
                        .AllowSecretPermissions(secretPermissions)
                        .Attach()
                    .CreateAsync()

 appVault.AccessPolicies.?????

有多个选项可以更新现有的密钥保管库访问策略。

在 C# 中,我们可以使用 keyvault nuget package and the Keyvaultmanagementclient class 来管理 azure keyvault。

我们还可以使用 Powershell commandlet Set-AzureRmKeyVaultAccessPolicy.

更新 keyvault 访问策略

当然,使用 Azure RM rest API 也可以实现同样的效果。金库-Update access policy.