How I can add Bindings in a "IIS web app manage" task using yaml? I tried putting the bindings like classic pipeline and doesnt work
Asked
Active
Viewed 3,725 times
2 Answers
10
The accepted answer doesn't give a great example on usage. The Bindings
input accepts a multiline string formatted as a particular JSON object. Also be sure to set AddBinding: true
as it appears it will ignore the Bindings
input without it.
On a related note, if you are storing your certificates in WebHosting (as opposed to MY), the deployment will fail as the task won't be able to find your certificate. Here's the relevant github enhancement to fix this
task: IISWebAppManagementOnMachineGroup@0
displayName: 'IIS Web App Manage'
inputs:
IISDeploymentType: 'IISWebsite'
ActionIISWebsite: 'CreateOrUpdateWebsite'
...
AddBinding: true
Bindings: |
{
bindings:[
{
"protocol":"http",
"ipAddress":"*",
"hostname":"mywebsite.com",
"port":"80",
"sslThumbprint":"",
"sniFlag":false
},
{
"protocol":"https",
"ipAddress":"*",
"hostname":"mywebsite.com",
"port":"443",
"sslThumbprint":"...",
"sniFlag":true
}
]
}

jamesSampica
- 12,230
- 3
- 63
- 85
-
any idea how would you make the port a variable ? – Gerrie Pretorius Sep 21 '21 at 11:35
-
Use Azure Pipelines variables or template parameters. – Mike Apr 28 '22 at 12:02
-
For those wondering what the format of the "bindings" option should be (I couldn't find any documentation for it), I think I've found it in the source code: https://github.com/microsoft/azure-pipelines-tasks/blob/master/Tasks/IISWebAppManagementOnMachineGroupV0/Utility.ps1#L49 – George Howarth Sep 06 '22 at 09:13
6
You need to create a JSon with all information like this:
{
"bindings":[{
"protocol":"http",
"ipAddress":"*",
"port":"xxxxx",
"sslThumbprint":"",
"sniFlag":false
},
{
"protocol":"http",
"ipAddress":"*",
"hostname":"yyyyyy.com",
"port":"80",
"sslThumbprint":"",
"sniFlag":false
},
{
"protocol":"http",
"ipAddress":"*",
"hostname":"xxxxxxxx.com",
"port":"80",
"sslThumbprint":"",
"sniFlag":false
}
]
}

andrés matínez rodríguez
- 243
- 2
- 9
-
It would be helpful if https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/deploy/iis-web-app-management-on-machine-group?view=azure-devops#yaml-snippet or https://github.com/microsoft/azure-pipelines-tasks/blob/master/Tasks/IISWebAppManagementOnMachineGroupV0/README.md mentioned the format expected!? – Ian Robertson Jul 17 '20 at 11:57
-
-
-