通过ARM模板为不同资源组中的密钥库添加访问策略,可以按照以下步骤进行操作:
"parameters": {
"resourceGroupName": {
"type": "string",
"metadata": {
"description": "The name of the resource group."
}
}
}
"parameters": {
"keyVaultName": {
"type": "string",
"metadata": {
"description": "The name of the key vault."
}
}
}
"resources": [
{
"type": "Microsoft.KeyVault/vaults/accessPolicies",
"apiVersion": "2019-09-01",
"name": "[concat(parameters('keyVaultName'), '/add')]",
"properties": {
"accessPolicies": [
{
"tenantId": "[subscription().tenantId]",
"objectId": "[parameters('objectId')]",
"permissions": {
"keys": ["get", "list"],
"secrets": ["get", "list"]
},
"condition": {
"reference": {
"keyVault": {
"id": "[resourceId('Microsoft.KeyVault/vaults', parameters('keyVaultName'))]"
}
},
"operator": "Equals",
"value": "true"
}
}
]
}
}
]
在上述示例中,访问策略对象指定了一个访问权限,允许获取和列出密钥和机密。还指定了一个访问条件,只有当指定的键库存在时,访问策略才会生效。
腾讯云相关产品和产品介绍链接地址:
领取专属 10元无门槛券
手把手带您无忧上云