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
How to add bindings in devops pipeline with Yaml
Asked Answered
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
}
]
}
It would be helpful if learn.microsoft.com/en-us/azure/devops/pipelines/tasks/deploy/… or github.com/microsoft/azure-pipelines-tasks/blob/master/Tasks/… mentioned the format expected!? –
Leery
can someone please point out where you put the above JSON ?? –
Exhaust
@JohnJoseph I've added an answer with an example –
Birdie
any idea how would you make the port a variable ? –
Tungus
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
}
]
}
any idea how would you make the port a variable ? –
Tungus
Use Azure Pipelines variables or template parameters. –
Coachwhip
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: github.com/microsoft/azure-pipelines-tasks/blob/master/Tasks/… –
Denicedenie
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
}
]
}
It would be helpful if learn.microsoft.com/en-us/azure/devops/pipelines/tasks/deploy/… or github.com/microsoft/azure-pipelines-tasks/blob/master/Tasks/… mentioned the format expected!? –
Leery
can someone please point out where you put the above JSON ?? –
Exhaust
@JohnJoseph I've added an answer with an example –
Birdie
any idea how would you make the port a variable ? –
Tungus
© 2022 - 2024 — McMap. All rights reserved.