azure-web-app-service - 如何输出通过 ARM 模板部署的应用服务的 IP 地址
问题描述
我想要从 ARM 模板部署的应用服务的公共 IP 地址,如下面的简化模板。我已经看到了从 API 网关、VM 的 VNET、应用服务环境等获取公共入站 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"
}
}
}
解决方案
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
推荐阅读
- sql - 插入和更新后的 PL SQL 循环表
- python - 带有小批量的 Pytorch 隐藏单元 LSTM
- vis.js - Vis.js - 将图形标签的字体设置为下划线
- reactjs - 类型“ThunkAction”上不存在属性“then”
,根状态,未定义,任何>'。TS2339 - ios - 应用程序被杀死时的回调 - React Native
- sql - 涉及具有连接和排序的两个表的查询的查询优化
- forms - 需要 Xamarin 表单中的建议具有多种排序功能的延迟加载
- html - 如何将 fa awesome 图标添加到引导按钮
- java - JAVA-写入文件时出现问题,但程序无法完成
- angular - 访问音频播放器的主题内容 Angular