问题
There is an MSDeploy extension available for Azure Web Apps; this can be used with Azure Resource Manager (ARM) Templates as well (example). I'd like to pass additional command-line arguments to MSDeploy, such as -enableRule:AppOffline (example).
Is there documentation for the MSDeploy Web App extension for passing additional arguments, etc.?
回答1:
Based on the latest schema definition for Azure Web App MSDeploy extension as below, it does not support the passing of MSDeploy command line switches or flags as parameters.
http://schema.management.azure.com/schemas/2015-08-01/Microsoft.Web.json#/resourceDefinitions/sitesextensions
You can refer to the link below for passing parameters for ARM Web App MSDeploy extension as below.
Documentation link for MSDeploy Web App extension passing parameters
回答2:
Support was recently added to the MSDeploy section of ARM Templates adding appOffline support.
(...)
"resources": [
{
"apiVersion": "2016-03-01",
"name": "MSDeploy",
"type": "Extensions",
"dependsOn": [
"[concat('Microsoft.Web/Sites/', parameters('appName'))]"
],
"properties": {
"packageUri": "https://mystorageblob.blob.core.windows.net/package/my_webdeploy_package.zip",
"dbType": "None",
"connectionString": "",
"AppOffline": true,
"SkipAppData": true,
"setParameters": {
"IIS Web Application Name": "[parameters('appName')]"
}
}
}
],
(...)
回答3:
It is actually supported, but there are some things you need to know.
- when you only update the parameters, the changes aren't pushed through. You'll need to touch the web.config. Msdeploy doesn't see this as a change.
- it doesn't support configSource in web.config, you'll need to patch each file separately.
parameters.xml
<parameters>
<parameter name="SmtpHost" defaultValue="" tags="" >
<parameterEntry kind="XmlFile" scope="Web.config" match="/configuration/system.net/mailSettings/smtp/network/@host" />
</parameter>
</parameters>
arm-template
{
"name": "MSDeploy",
"type": "extensions",
"location": "[resourceGroup().location]",
"apiVersion": "2015-08-01",
"dependsOn": [
"[resourceId('Microsoft.Web/sites', parameters('siteName'))]"
],
"properties": {
"packageUri": "[concat(parameters('_artifactsLocation'), '/', parameters('folder'), '/', parameters('filename'), parameters('_artifactsLocationSasToken'))]",
"dbType": "None",
"setParameters": {
"IIS Web Application Name": "[parameters('cmsSiteName')]",
"SmtpHost": "[parameters('smtpHost')]"
}
}
}
https://social.msdn.microsoft.com/Forums/azure/en-US/3a07e809-d452-463a-b1bf-d84d48415302/azure-resource-manager-msdeploy-extension-parameters?forum=windowsazurewebsitespreview
来源:https://stackoverflow.com/questions/41768881/can-i-pass-msdeploy-parameters-to-azure-web-app-msdeploy-extension