我想要从ARM模板部署的应用程序服务中的公共IP地址,如下面的简化示例所示。我已经看到了从API网关,VM的VNET,App Service Environment等获取公共入站IP地址的示例,但是我没有发现任何指示如何从简单的App Service部署中获取公共入站IP地址的示例。我发现在浏览ARM API,以及如何将其转换为字符串并转换为JSON文件,而不是拜占庭。任何帮助将不胜感激。
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"appServiceName": {
"type": "string",
"minLength": 1,
"metadata": {
"description": "Specifies the name of the Azure App Service"
}
},
"appServicePlanName": {
"type": "string",
"minLength": 1
}
},
"variables": {
},
"resources": [
{
"apiVersion": "2015-08-01",
"name": "[parameters('appServiceName')]",
"type": "Microsoft.Web/sites",
"kind": "app",
"location": "[resourceGroup().location]",
"dependsOn": [],
"properties": {
"serverFarmId": "[resourceId('Microsoft.Web/serverfarms', parameters('appServicePlanName'))]",
"clientAffinityEnabled": false
},
"resources": [],
}
],
"outputs": {
"appServiceName": {
"type": "string",
"value": "[parameters('appServiceName')]"
},
"ipAddress": {
"type": "string",
"value": "whatingodsnamegoeshere"
}
}
}
答案 0 :(得分:0)
您需要使用reference()
函数并为其提供资源ID或名称(如果资源位于同一模板中则仅提供名称):
reference(parameters('appServiceName'), '2016-03-01', 'Full').properties.inboundIpAddress
或使用resourceId()
:
reference(resourceId('Microsoft.Web/serverfarms', parameters('appServicePlanName')), '2016-03-01', 'Full').properties.inboundIpAddress