gpt4 book ai didi

azure-web-app-service - 如何输出通过 ARM 模板部署的应用服务的 IP 地址

转载 作者:行者123 更新时间:2023-12-04 01:03:50 27 4
gpt4 key购买 nike

我想要从 ARM 模板部署的应用服务的公共(public) IP 地址,如下面的简化模板。我已经看到了从 API 网关、VM 的 VNET、应用服务环境等获取公共(public)入站 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

关于azure-web-app-service - 如何输出通过 ARM 模板部署的应用服务的 IP 地址,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57539544/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com