如何获取要在Terraform的App服务计划中使用的App服务环境ID

问题描述 投票:0回答:1

有人可以帮助使用ARM模板部署App服务环境。

{
        "apiVersion": "2019-02-01",
        "type": "Microsoft.Web/hostingEnvironments",
        "name": "[parameters('aseName')]",
        "kind": "ASEV2",
        "location": "[parameters('location')]",
        "properties": {
            "name": "[parameters('aseName')]",
            "location": "[parameters('location')]",
            "InternalLoadBalancingMode": "[parameters('ilbMode')]",
            "virtualNetwork": {
                "Id": "[parameters('subnetId')]"
            }
        },
        "tags": {},
        "dependsOn": [
            "['existingVnetTemplate']"
        ]
    },

我如何在此模板中获取App服务环境(Hostingenvironment)的ID,以便能够以terraform形式输出它并在App服务计划参数(app_service_environment_id)中使用它。这是为了将应用程序服务部署在专用网络中。

https://www.terraform.io/docs/providers/azurerm/r/app_service_plan.html#app_service_environment_id

我尝试从azure门户部署App服务环境,并以“ /subscription/xxxx-xxx-xx-xxxx-xxx/Microsoft.web/Hostingenvironment/”格式提及其ID,并返回了404。

例如:app_service_environment_id =“ /subscription/xxxx-xxx-xx-xxxx-xxx/Microsoft.web/Hostingenvironment/xxxxxxx”

任何帮助

azure azure-app-service-plans azure-app-service-envrmnt app-service-environment
1个回答
0
投票

应用程序服务环境的resourceId包括resource group

/subscriptions/xxxx-xxx-xx-xxxx-xxx/resourceGroups/xxxxx/providers/Microsoft.Web/hostingEnvironments/xxxx

如果您想将ARM模板与terraform文件结合起来,可能已经有了以下答案:ARM Return App Service Environment ID to use in Terraform Script

"outputs": {
  "app_service_evironment_id": {
    "type": "string",
    "value": "[resourceId('Microsoft.Web/hostingEnvironments', parameters('ilbase_name'))]"
  }
}
...
azurerm_app_service_plan.test.app_service_environment_id = azurerm_template_deployment.ase.outputs["app_service_evironment_id"]
© www.soinside.com 2019 - 2024. All rights reserved.