Azure 忽略 ARM 模板中的站点配置设置
Azure ignores site config settings in ARM template
我正在尝试开发用于部署多个 Web 应用程序的 ARM 模板,但我一直在尝试使用 Microsoft 中可用的设置来配置 Web 应用程序。Web/sites/config。无论我放在那里,当我部署 webapp 时,设置都会被忽略。我的模板基于 David Ebbos example.
这就是我目前正在尝试的:
// Serverfarm (appservice)
{
"apiVersion": "2015-08-01",
"type": "Microsoft.Web/serverfarms",
"sku": {
"name": "B1",
"tier": "Standard",
"size": "B1",
"family": "B",
"capacity": 1
},
"name": "[variables('appSvcName')]",
"location": "[resourceGroup().location]",
"tags": {
"project": "[[variables('webAppName')]]"
},
"properties": {
"name": "[variables('appSvcName')]",
"numberOfWorkers": 1
}
},
// Site (Webapp)
{
"apiVersion": "2015-08-01",
"type": "Microsoft.Web/sites",
"name": "[variables('webAppName')]",
"location": "[resourceGroup().location]",
"tags": {
"project": "[[variables('webAppName')]]"
},
"dependsOn": [
"[resourceId('Microsoft.Web/serverfarms', variables('appSvcName'))]"
],
"properties": {
"serverFarmId": "[resourceId('Microsoft.Web/serverfarms', variables('appSvcName'))]",
"hostNames": [
"[concat(variables('webAppName'), '.azurewebsites.net')]"
],
"enabledHostNames": [
"[concat(variables('webAppName'), '.azurewebsites.net')]",
"[concat(variables('webAppName'), '.scm.azurewebsites.net')]"
],
// TODO : These resources are ignored so far
"resources": [
{
"apiVersion": "2015-08-01",
"name": "web",
"type": "Microsoft.Web/sites/config",
"location": "[resourceGroup().location]",
"dependsOn": [
"[resourceId('Microsoft.Web/Sites', variables('webAppName'))]"
],
"properties": {
"phpVersion": "",
"netFrameworkVersion": "v4.6",
"use32BitWorkerProcess": false, /* 64-bit platform */
"webSocketsEnabled": true,
"alwaysOn": true,
"requestTracingEnabled": true, /* Failed request tracing, aka 'freb' */
"httpLoggingEnabled": true, /* IIS logs (aka Web server logging) */
"logsDirectorySizeLimit": 40, /* 40 MB limit for IIS logs */
"detailedErrorLoggingEnabled": true, /* Detailed error messages */
"remoteDebuggingEnabled": false,
"remoteDebuggingVersion": "VS2015",
"defaultDocuments": [
"default.aspx",
"Default.htm",
"Default.html",
"index.html",
"hostingstart.html"
]
}
},
{
"apiVersion": "2015-08-01",
"name": "connectionstrings",
"type": "Microsoft.Web/sites/config",
"location": "[resourceGroup().location]",
"dependsOn": [
"[resourceId('Microsoft.Web/Sites', variables('webAppName'))]"
],
"properties": {
"umbracoDbDsn": {
"value": "[concat('Data Source=tcp:', reference(concat('Microsoft.Sql/servers/', variables('sqlServerName'))).fullyQualifiedDomainName, ',1433;Initial Catalog=', variables('sqlDbName'), ';User Id=', variables('appSvcName'), '@', variables('sqlServerName'), ';Password=e15cO1PtIR5dtq3zUlwK;')]",
"type": "SQLAzure"
}
}
}
]
}
}
我有点困惑的一件事是,当我 运行 (Get-AzureRmResourceProvider -ProviderNamespace Microsoft.Web).ResourceTypes
在我的 azure powershell 控制台中时,没有 sites/config ResourceTypeName 可用。
什么给了?配置资源类型是否已从模板定义中删除?我使用了错误的 apiVersion 吗?我尝试了多种不同的组合,但都无济于事。
架构中的错误,正如@JackZheng 所评论的那样。 Test-AzureRmResourceGroupDeployment
命令也没有报告这些错误,因此更难找到和更正。
请看这篇博文 -
http://wp.sjkp.dk/arm-templates-set-always-on-and-other-site-properties/
您需要 web/config 的 resource.properties 下的 siteConfig 对象。
{
"apiVersion": "2015-08-01",
"name": "[parameters('webSiteName')]",
"type": "Microsoft.Web/sites",
"location": "[resourceGroup().location]",
"tags": {
"[concat('hidden-related:', resourceGroup().id, '/providers/Microsoft.Web/serverfarms/', parameters('hostingPlanName'))]": "Resource",
"displayName": "Website"
},
"dependsOn": [
"[concat('Microsoft.Web/serverfarms/', parameters('hostingPlanName'))]"
],
"properties": {
"name": "[parameters('webSiteName')]",
"serverFarmId": "[resourceId('Microsoft.Web/serverfarms', parameters('hostingPlanName'))]"
},
"resources": [
{
"apiVersion": "2015-08-01",
"name": "web",
"type": "config",
"dependsOn": [
"[concat('Microsoft.Web/sites/', parameters('webSiteName'))]"
],
"properties": {
"javaVersion": "1.8",
"javaContainer": "TOMCAT",
"javaContainerVersion": "8.0",
"siteConfig": {
"<supported-property>": "<value>",
}
}
}
]
}
您可以在resources->properties ->SiteConfig下使用APP设置如下图
"siteConfig": {
"appSettings": [
{
"name": "AppSetting1",
"value": "Value1"
}
]
}
我正在尝试开发用于部署多个 Web 应用程序的 ARM 模板,但我一直在尝试使用 Microsoft 中可用的设置来配置 Web 应用程序。Web/sites/config。无论我放在那里,当我部署 webapp 时,设置都会被忽略。我的模板基于 David Ebbos example.
这就是我目前正在尝试的:
// Serverfarm (appservice)
{
"apiVersion": "2015-08-01",
"type": "Microsoft.Web/serverfarms",
"sku": {
"name": "B1",
"tier": "Standard",
"size": "B1",
"family": "B",
"capacity": 1
},
"name": "[variables('appSvcName')]",
"location": "[resourceGroup().location]",
"tags": {
"project": "[[variables('webAppName')]]"
},
"properties": {
"name": "[variables('appSvcName')]",
"numberOfWorkers": 1
}
},
// Site (Webapp)
{
"apiVersion": "2015-08-01",
"type": "Microsoft.Web/sites",
"name": "[variables('webAppName')]",
"location": "[resourceGroup().location]",
"tags": {
"project": "[[variables('webAppName')]]"
},
"dependsOn": [
"[resourceId('Microsoft.Web/serverfarms', variables('appSvcName'))]"
],
"properties": {
"serverFarmId": "[resourceId('Microsoft.Web/serverfarms', variables('appSvcName'))]",
"hostNames": [
"[concat(variables('webAppName'), '.azurewebsites.net')]"
],
"enabledHostNames": [
"[concat(variables('webAppName'), '.azurewebsites.net')]",
"[concat(variables('webAppName'), '.scm.azurewebsites.net')]"
],
// TODO : These resources are ignored so far
"resources": [
{
"apiVersion": "2015-08-01",
"name": "web",
"type": "Microsoft.Web/sites/config",
"location": "[resourceGroup().location]",
"dependsOn": [
"[resourceId('Microsoft.Web/Sites', variables('webAppName'))]"
],
"properties": {
"phpVersion": "",
"netFrameworkVersion": "v4.6",
"use32BitWorkerProcess": false, /* 64-bit platform */
"webSocketsEnabled": true,
"alwaysOn": true,
"requestTracingEnabled": true, /* Failed request tracing, aka 'freb' */
"httpLoggingEnabled": true, /* IIS logs (aka Web server logging) */
"logsDirectorySizeLimit": 40, /* 40 MB limit for IIS logs */
"detailedErrorLoggingEnabled": true, /* Detailed error messages */
"remoteDebuggingEnabled": false,
"remoteDebuggingVersion": "VS2015",
"defaultDocuments": [
"default.aspx",
"Default.htm",
"Default.html",
"index.html",
"hostingstart.html"
]
}
},
{
"apiVersion": "2015-08-01",
"name": "connectionstrings",
"type": "Microsoft.Web/sites/config",
"location": "[resourceGroup().location]",
"dependsOn": [
"[resourceId('Microsoft.Web/Sites', variables('webAppName'))]"
],
"properties": {
"umbracoDbDsn": {
"value": "[concat('Data Source=tcp:', reference(concat('Microsoft.Sql/servers/', variables('sqlServerName'))).fullyQualifiedDomainName, ',1433;Initial Catalog=', variables('sqlDbName'), ';User Id=', variables('appSvcName'), '@', variables('sqlServerName'), ';Password=e15cO1PtIR5dtq3zUlwK;')]",
"type": "SQLAzure"
}
}
}
]
}
}
我有点困惑的一件事是,当我 运行 (Get-AzureRmResourceProvider -ProviderNamespace Microsoft.Web).ResourceTypes
在我的 azure powershell 控制台中时,没有 sites/config ResourceTypeName 可用。
什么给了?配置资源类型是否已从模板定义中删除?我使用了错误的 apiVersion 吗?我尝试了多种不同的组合,但都无济于事。
架构中的错误,正如@JackZheng 所评论的那样。 Test-AzureRmResourceGroupDeployment
命令也没有报告这些错误,因此更难找到和更正。
请看这篇博文 - http://wp.sjkp.dk/arm-templates-set-always-on-and-other-site-properties/
您需要 web/config 的 resource.properties 下的 siteConfig 对象。
{
"apiVersion": "2015-08-01",
"name": "[parameters('webSiteName')]",
"type": "Microsoft.Web/sites",
"location": "[resourceGroup().location]",
"tags": {
"[concat('hidden-related:', resourceGroup().id, '/providers/Microsoft.Web/serverfarms/', parameters('hostingPlanName'))]": "Resource",
"displayName": "Website"
},
"dependsOn": [
"[concat('Microsoft.Web/serverfarms/', parameters('hostingPlanName'))]"
],
"properties": {
"name": "[parameters('webSiteName')]",
"serverFarmId": "[resourceId('Microsoft.Web/serverfarms', parameters('hostingPlanName'))]"
},
"resources": [
{
"apiVersion": "2015-08-01",
"name": "web",
"type": "config",
"dependsOn": [
"[concat('Microsoft.Web/sites/', parameters('webSiteName'))]"
],
"properties": {
"javaVersion": "1.8",
"javaContainer": "TOMCAT",
"javaContainerVersion": "8.0",
"siteConfig": {
"<supported-property>": "<value>",
}
}
}
]
}
您可以在resources->properties ->SiteConfig下使用APP设置如下图
"siteConfig": {
"appSettings": [
{
"name": "AppSetting1",
"value": "Value1"
}
]
}