问题描述
我正在尝试开发用于部署多个 Web 应用程序的 ARM 模板,但我在尝试使用 Microsoft.Web/sites/config 中的可用设置配置 Web 应用程序时遇到困难.无论我在那里放什么,当我部署 webapp 时,这些设置都会被忽略.我的模板基于 David Ebbos 示例.>
这就是我目前正在尝试的:
//Serverfarm (appservice){"apiVersion": "2015-08-01","type": "Microsoft.Web/serverfarms",sku":{"name": "B1","tier": "标准",尺寸":B1","家庭": "B",容量":1},"name": "[变量('appSvcName')]","location": "[resourceGroup().location]",标签":{项目":[[变量('webAppName')]]"},特性": {"name": "[变量('appSvcName')]",工人数":1}},//站点(Web 应用程序){"apiVersion": "2015-08-01","type": "Microsoft.Web/sites","name": "[变量('webAppName')]","location": "[resourceGroup().location]",标签":{项目":[[变量('webAppName')]]"},取决于": [[resourceId('Microsoft.Web/serverfarms', variables('appSvcName'))]"],特性": {"serverFarmId": "[resourceId('Microsoft.Web/serverfarms', variables('appSvcName'))]",主机名":[[concat(变量('webAppName'),'.azurewebsites.net')]"],已启用主机名":["[concat(variables('webAppName'), '.azurewebsites.net')]",[concat(变量('webAppName'),'.scm.azurewebsites.net')]"],//TODO : 这些资源目前被忽略资源": [{"apiVersion": "2015-08-01","name": "网络","type": "Microsoft.Web/sites/config","location": "[resourceGroup().location]",取决于": [[resourceId('Microsoft.Web/Sites', variables('webAppName'))]"],特性": {"phpVersion": "","网络框架版本": "v4.6","use32BitWorkerProcess": false,/* 64 位平台 */webSocketsEnabled":真,永远在线":真,"requestTracingEnabled": true,/* 失败的请求跟踪,又名 'freb' */"httpLoggingEnabled": true,/* IIS 日志(又名 Web 服务器日志记录)*/"logsDirectorySizeLimit": 40,/* IIS 日志的 40 MB 限制 */"detailedErrorLoggingEnabled": true,/* 详细的错误信息 */remoteDebuggingEnabled":假,"remoteDebuggingVersion": "VS2015",默认文件":["default.aspx","默认.htm","默认.html","index.html",hostingstart.html"]}},{"apiVersion": "2015-08-01","name": "连接字符串","type": "Microsoft.Web/sites/config","location": "[resourceGroup().location]",取决于": [[resourceId('Microsoft.Web/Sites', variables('webAppName'))]"],特性": {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;')]",类型":SQLAzure"}}}]}}
我有点困惑的一件事是,当我在 azure powershell 控制台中运行 (Get-AzureRmResourceProvider -ProviderNamespace Microsoft.Web).ResourceTypes
时,没有可用的站点/配置 ResourceTypeName.
什么给?配置资源类型是否已从模板定义中删除?我是否使用了错误的 apiVersion?我尝试了许多不同的组合,但都无济于事.
请看这篇博客 -http://wp.sjkp.dk/arm-templates-set-always-on-and-other-site-properties/
您需要在 web/config 的 resource.properties 下的 siteConfig 对象.
{"apiVersion": "2015-08-01","name": "[参数('webSiteName')]","type": "Microsoft.Web/sites","location": "[resourceGroup().location]",标签":{"[concat('hidden-related:', resourceGroup().id, '/providers/Microsoft.Web/serverfarms/', parameters('hostingPlanName'))]": "Resource","displayName": "网站"},取决于": ["[concat('Microsoft.Web/serverfarms/', parameters('hostingPlanName'))]"],特性": {"name": "[参数('webSiteName')]","serverFarmId": "[resourceId('Microsoft.Web/serverfarms', parameters('hostingPlanName'))]"},资源": [{"apiVersion": "2015-08-01","name": "网络",类型":配置",取决于": ["[concat('Microsoft.Web/sites/', parameters('webSiteName'))]"],特性": {"javaVersion": "1.8","javaContainer": "TOMCAT","javaContainerVersion": "8.0",站点配置":{"": "",}}}]}
I am trying to develop an ARM template for deployment of multiple webapps, but I am stuck trying to configure the webapp using the settings available in Microsoft.Web/sites/config. Whatever I put in there, the settings are just ignored when I deploy the webapp. I'm basing my template on David Ebbos example.
This is what I am trying at the moment:
// 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"
}
}
}
]
}
}
One thing I am a bit confused about is that when I run (Get-AzureRmResourceProvider -ProviderNamespace Microsoft.Web).ResourceTypes
in my azure powershell console there is no sites/config ResourceTypeName available.
What gives? Have the config resourcetype been removed from the template definitions? Am I using the wrong apiVersion? I have tried a number of different combinations, to no avail.
Please see this blog -http://wp.sjkp.dk/arm-templates-set-always-on-and-other-site-properties/
You would need siteConfig object under resource.properties of web/config.
{
"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>",
}
}
}
]
}
这篇关于Azure 忽略 ARM 模板中的站点配置设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!