Skip to main content
DevOps icon showing cogs

This post is from the XebiaLabs blog and has not been updated since the original publish date.

Last Updated Jul 24, 2014 — DevOps Expert

Deploying the same .NET site to IIS and Azure PaaS using XL Deploy


Last week, I was invited by Microsoft partner Cellenza to talk about XL Deploy during their BootCamp tech rally. Of course, we could have shown them our IIS+SQL Server deployment demo, but I wanted to take this opportunity to dig into a new subject: Microsoft Azure. Specifically, I was wondering how easy it would be to deploy the same web application package either to an on-premise IIS instance or to Azure's Web Apps (i.e. PaaS layer).

Connecting to Azure

The first thing was too find out how to communicate with Azure. The answer I found turned out to be Azure's Cross-Platform Command-Line Interface, a set of CLI commands based on node.js. npm install azure-cli -g gives you commands to drive Azure. Before you can run any commands, you also need to import your Windows Azure Publish Settings file in the tool:
vagrant@azure:~$ azure account import /vagrant/data/my.credentials.publishsettings
 info: Executing command account import
 info: account import command OK
Once done, you can create your website using this command:
vagrant@azure:~$ azure site create --location "West Europe" xld-benoit-demo
 info: Executing command site create
 + Getting sites
 + Getting locations
 info: Creating a new web site at
 \info: Created website at
 +info: site create command OK
To deploy your website, you need to put the content into an SCM (GitHub, in my case). Azure hooks into the SCM and triggers a deployment each time there is a commit. The following command links the website to a GitHub account and repository:
vagrant@azure:/vagrant/data$ azure site create --location "West Europe" xld-benoit-demo2 --github --githubusername bmoussaud --githubpassword ******* --githubrepository bmoussaud/azure-ws
 info: Executing command site create
 + Getting sites
 info: Updating existing site
 + Getting locations
 + Retrieving repositories
 + Getting site information
 + Retrieving website hooks
 + Creating new hook
 + Testing hook
 info: site create command OK
Of course, you need to transfer your SSH key onto the machine on which the Azure xplat-cli is installed.

Integration with XL Deploy

The azure.Gateway CI is a generic container on which the Azure xplat-cli is installed. It contains a single property credentialsPublishSettings that contains the files with the key, and two control tasks to import the credential file and list the accounts:
<type type="azure.Gateway" extends="generic.Container">
  <property name="credentialsPublishSettings" size="large"/>
  <!-- control tasks -->
  <method name="importsettings"/>
  <property name="importsettingsScript" default="azure/import-settings" hidden="true" />
  <method name="accounts"/>
  <property name="accountsScript" default="azure/accounts" hidden="true" />
--- azure/ ---
echo "Importing credential settings"
echo '${container.credentialsPublishSettings}'  > ./credentials.publishsettings
cat ./credentials.publishsettings
azure account import ./credentials.publishsettings
--- end azure/ ---
azure-gateway-definitionThe azure.Website CI is a Deployed targeted at the azure.Gateway container. It manages the website creation and deletion:
<type type="azure.Website" extends="generic.ExecutedScript"
  container-type="azure.Gateway" deployable-type="iis.WebsiteSpec">
  <property name="location" default="West Europe"/>
  <property name="fqdn" />
  <property name="githubUsername" category="GitHub" />
  <property name="githubPassword" password="true" category="GitHub"/>
  <property name="githubRepository" category="GitHub" />
  <property name="destroyScript" default="azure/delete-website" hidden="true" />
  <property name="createScript" default="azure/create-website" hidden="true" />
--- azure/ ---
echo "Creating webserver ${}/${deployed.fqdn}"
azure site create --location "${deployed.location}" ${deployed.fqdn} --github --githubusername ${deployed.githubUsername} --githubpassword ${deployed.githubPassword} --githubrepository ${deployed.githubRepository}
--- end azure/ ---
--- azure/ ---
echo "Removing webserver ${}"
echo "azure site delete -q ${deployed.fqdn}"
azure site delete -q ${deployed.fqdn}
--- end azure/ ---
The azure.PublishedWebContent CI is another Deployed targeted at the azure.Gateway container. It manages the web content:
--- azure/ ---
echo "Deploying website content ${} on ${} Microsoft Azure Website"
git clone${deployed.githubRepository}.git workingdir
cp -r ${deployed.file}/* ./workingdir
cd workingdir
git add -A
git commit -a -m "Commit for Deployment of ${}/${}"
git push
--- end azure/ ---
The script clones the GitHub repository, copies the content, commits and pushes. In the definitions of the two deployed CIs, the two deployable types are those defined in the IIS plugin. Based on this extension, it is now possible to use XL Deploy to deploy a deployment package containing a .NET website either to a standard IIS web server running on a Windows server (running on-premise or, indeed, in Azure's IaaS!) or to an Azure Web Site.
[caption id="attachment_7432" align="alignnone" width="300"]website-on-iis Deploying to a standard IIS server (Click to Expand)[/caption][caption id="attachment_7433" align="alignnone" width="300"]website-on-azure Deploying the package to Microsoft Azure (Click to Expand)[/caption]

More from the Blog

View more
Ascension Launch Banner
Apr 26, 2022

Get ready for peak performance with’s newest AI-Powered DevOps Platform Ascension Release

Today, is excited to announce our latest AI-Powered DevOps ...
Read More
Jan 24, 2022 Value Stream Delivery for SAFe®: The key to amazing business outcomes

The Scaled Agile Framework (SAFe) is the world’s leading framework for ...
Read More
Dec 09, 2021

How SaaS and cloud-based solutions helped the U.S. Department of Veterans Affairs achieve digital transformation

Modernizing legacy systems was an ongoing goal for the U.S. Department ...
Read More
Nov 29, 2021

Increase velocity and reduce risk with AI and machine learning

Artificial Intelligence (AI) and machine learning (ML) have proven use ...
Read More
Contact Us