我有3个应用程序共享一个密钥库。所以我决定创建4个RGs。3个应用3个RG,密钥库等公共资源1个RG。
这一切都运行得很好。我可以通过自己的ARM模板创建3个应用程序,并通过自己的ARM模板创建Keyvault。
因此,当应用程序资源被提供时,我想通过ARM模板在keyvault中为该应用程序添加访问策略。
{
"apiVersion": "2018-05-01",
"name": "accesspolicies_deployment",
"resourceGroup": "Common-RG",
"type": "Microsoft.Resources/deployments",
"dependsOn": [],
"properties": {
"mode": "Incremental",
"template": {
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {},
"variables": {},
"resources": [
{
"type": "Microsoft.KeyVault/vaults/accessPolicies",
"name": "[concat('kvdevwus', '/add')]",
"apiVersion": "2018-02-14",
"properties": {
"accessPolicies": [
{
"tenantId": "[reference(variables('website'),'2018-02-01','Full').identity.tenantId]",
"objectId": "[reference(variables('website'),'2018-02-01','Full').identity.principalId]",
"permissions": {
"keys": [
"all"
],
"secrets": [
"all"
],
"certificates": [
"all"
],
"storage": [
"all"
]
}
}
]
}
}
],
"outputs": {
"principalId": {
"type": "string",
"value": "[reference(variables('website'),'2018-02-01','Full').identity.principalId]"
}
}
}
}
}我在app的模板中使用了上面的模板。但是得到了Resource Not Found错误。
是设计本身错了,还是我漏掉了什么?
发布于 2019-11-02 04:51:40
我必须看到更多的代码才能确定,但我怀疑你无法使用内联部署来做你想做的事情,你必须使用链接模板。我们正在努力解决这个问题,但现在还不能使用。
发布于 2020-09-24 04:01:14
我认为您的accesspolicies_deployment资源中缺少"dependsOn":[]。我有和你一样的设置,我在一个公共资源组中有密钥库,而我的web应用程序在不同的资源中。
在创建网站ARM模板中,我还添加了accesspolicies_deployment,但添加了"dependsOn":webapp01,以确保它首先创建网站,并在创建键值访问策略之前创建标识
https://stackoverflow.com/questions/58660134
复制相似问题