How to add bindings in devops pipeline with Yaml How to add bindings in devops pipeline with Yaml azure azure

How to add bindings in devops pipeline with Yaml


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                                        }                                    ]                                } 


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@0displayName: '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                 }            ]        }