【发布时间】:2021-05-04 18:19:25
【问题描述】:
我需要在创建 Key Vault 时限制对它的访问。我正在通过 Fluent sdk 创建,我可以在其中创建 KeyVault 并定义标签和资源组。
注意:使用 powershell 我可以使用以下命令执行操作:Add-AzKeyVaultNetworkRule 但使用 Fluent 我不能
这里我是如何创建 KeyVault 的:
var azureClient = await GetAzureClientWithSubscription();
var rVault = await azureClient.Vaults
.Define(kvName)
.WithRegion(Region.BrazilSouth)
.WithExistingResourceGroup(kvRG)
.DefineAccessPolicy()
.ForObjectId(_settings.ObjectId)
.AllowSecretPermissions(SecretPermissions.Get)
.AllowSecretPermissions(SecretPermissions.List)
.AllowSecretPermissions(SecretPermissions.Set)
.Attach()
.WithTags(tags)
.CreateAsync();
【问题讨论】:
标签: c# .net azure azure-keyvault azure-fluent-api