Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add bindings in devops pipeline with Yaml

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

enter image description here

like image 267
andrés matínez rodríguez Avatar asked Dec 18 '22 14:12

andrés matínez rodríguez


2 Answers

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
                 }
            ]
        }
like image 175
James Sampica Avatar answered Jan 30 '23 21:01

James Sampica


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
                                        }
                                    ]
                                } 
like image 27
andrés matínez rodríguez Avatar answered Jan 30 '23 21:01

andrés matínez rodríguez