Configuring Web Site Binding with Release Management

3 minute read

Release Management provides a continuous deployment solution that makes release cycles repeatable, visible, and more efficient by automating deployments through every environment from test to production.

Within Release Management you have al large set of default Actions and Components to configure a release cycle. On MSDN you can find a list with some common actions that are available within Release Management:

In this list you will find a action for creating a web site “Create Web Site”  and configure a web site “Configure Web Site”. By using the create web site action you will create a web site with default bindings and you would expect to be able to change the bindings by using the “Configure Web Site” action but this is not the case. If you would like to configure the binding on the web site you will have to create a custom action.

You can create a custom action by navigating to the “Inventory” tab and in the action window selecting new.

image

Selecting new will open up a new window in which you are able to configure a new action. In this new action we will start PowerShell and make use of the “WebAdministration” module to add a new binding.

image

As you can see in the image above everything in the “General Information” section speaks for it self. In the example we choose to add the action to the already existing category “IIS” because it is a “IIS” action.

In the “Execution” section specify what the action should execute. In the “Command” field specify the command for execution. For PowerShell specify “powershell” and in the “Arguments” field specify the argument for the command:

-Command "& { Import-Module WebAdministration; New-WebBinding -Name '__SiteName__' -IPAddress '__IPAddress__' -Port '__Port__' -HostHeader '__HostHeader__' -Protocol '__Protocol__'}" 

As you can see in the code we Import the “WebAdministration” module and use the “New-WebBinding” function for adding a new binding with the following parameters:

Parameter Value
Name __SiteName__
Protocol __Protocol__
IPAdress __IPAdress__
Port __Port__
Hostheader __HostHeader__

By using the format __[Name]__ (before and after 2 underscores) Release Management knows that these values can be used as parameters in order to make the action reusable.

When you save this action it will become available to add in your release template.

image

You can drag and drop the action within your release flow and configure it by double clicking the action.

image

When you add a new Binding you will probably also want to be able to remove a binding. You can do this by creating a new action and adding the following argument.

-Command "& { Import-Module WebAdministration; Remove-WebBinding -Name '__SiteName__' -IPAddress '__IPAddress__' -Port '__Port__' -HostHeader '__HostHeader__'}"

Note:When using the create web site action it will create a web site with the default binding. If you add a new binding to the web site you will also have to remove the default binding or else it could be in conflict with other web sites.