【发布时间】:2016-12-03 16:41:44
【问题描述】:
在部署实际应用程序之前,我们在构建过程中使用 ARM 模板部署 Azure 资源。
到目前为止,我们所有的应用程序资源都包含在 resource group 中。例如需要 sql server 和存储帐户的 Web 应用程序被合并到一个资源组中。
但是,我们遇到了需要共享资源的场景/需求,例如。跨资源组的存储帐户。资源组 A 具有存储帐户,而资源组 B 的 Web 应用程序需要在其 appconfig.json/web.config 中与存储帐户相关的连接字符串/应用程序密钥。
问题
如何为资源组 B 中的应用构建连接字符串以连接到资源组 A 中的资源,因为我需要获取 B 中资源组 A 的 Id
如果它们在同一个资源组中,这是我如何构建连接字符串
"variables"
{
"storageAccounts_id": "[concat(**resourceGroupA**().id,'/providers/Microsoft.Storage/storageAccounts/', variables('storageAccntName'))]",
},
"resources": [
{
"apiVersion": "2015-08-01",
"type": "config",
"name": "connectionstrings",
"dependsOn": [
"[resourceId('Microsoft.Web/sites', variables('MyWebSiteName'))]"
],
"properties": {
"AzureWebJobsDashboard": {
"value": "[concat('DefaultEndpointsProtocol=https;AccountName=',variables('storageAccntName'),';AccountKey=',concat(listKeys(variables('storageAccounts_id'),'2015-05-01-preview').key1))]",
"type": "Custom"
},
}
}
]
注意事项:
我确实浏览过这个关于链接模板的网站https://azure.microsoft.com/en-us/documentation/articles/resource-group-linked-templates/,但它不适合我们当前使用Octo 的构建过程(除非我可能缺少某些东西),然后先部署 ARM应用程序(网络)。
【问题讨论】:
-
你有没有为此做过任何工作?
标签: json azure octopus-deploy azure-resource-manager