答案 0 :(得分:1)
这是您可以参考的模板,根据需要使用参数extensionName AspNetCoreRuntime.2.2.x64
和extensionVersion 2.2.0-preview3-35497
。您可以在Azure Resource Explorer中找到扩展名信息。
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"siteName": {
"type": "string",
"metadata": {
"description": "The Azure App Service Name"
}
},
"extensionName": {
"type": "string",
"metadata": {
"description": "The Site Extension Name."
}
},
"extensionVersion": {
"type": "string",
"metadata": {
"description": "The Extension Version"
}
}
},
"resources": [
{
"type": "Microsoft.Web/sites/siteextensions",
"name": "[concat(parameters('siteName'), '/', parameters('extensionName'))]",
"apiVersion": "2015-04-01",
"location": "[resourceGroup().location]",
"properties": {
"version": "[parameters('extensionVersion')]"
}
}
]
}
结果:
您还可以在Terraform中使用ARM模板。您可以在main.tf
中添加一个azurerm_deployment_template块。就是这样
resource "azurerm_template_deployment" "extension" {
name = "extension"
resource_group_name = "${azurerm_resource_group.main.name}"
template_body = "${file("arm/siteextensions.json")}"
parameters {
"siteName" = "${azurerm_app_service.main.name}"
"extensionName" = "AspNetCoreRuntime.2.2.x64"
"extensionVersion" = "2.2.0-preview3-35497"
}
deployment_mode = "Incremental"
}
您可以从此博客中获得有关applying Azure App Service extensions with ARM的更多详细信息