Getting key stakeholder buy-in for changes perceived as risky
DevOps
Organizational leaders must recognize that change is vital for the sur ...
Read MoreThis post is from the XebiaLabs blog and has not been updated since the original publish date.
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).
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 xld-benoit-demo.azurewebsites.net
\info: Created website at xld-benoit-demo.azurewebsites.net
+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.<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" />
</type>
--- azure/import-settings.sh ---
echo "Importing credential settings"
echo '${container.credentialsPublishSettings}' > ./credentials.publishsettings
cat ./credentials.publishsettings
azure account import ./credentials.publishsettings
--- end azure/import-settings.sh ---
<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" />
</type>
--- azure/create-website.sh ---
echo "Creating webserver ${deployed.name}/${deployed.fqdn}"
azure site create --location "${deployed.location}" ${deployed.fqdn} --github --githubusername ${deployed.githubUsername} --githubpassword ${deployed.githubPassword} --githubrepository ${deployed.githubRepository}
--- end azure/create-website.sh ---
--- azure/delete-website.sh ---
echo "Removing webserver ${deployed.id}"
echo "azure site delete -q ${deployed.fqdn}"
azure site delete -q ${deployed.fqdn}
--- end azure/delete-website.sh ---
The azure.PublishedWebContent CI is another Deployed targeted at the azure.Gateway container. It manages the web content:--- azure/deploy-website.sh ---
echo "Deploying website content ${deployed.name} on ${deployed.container.name} Microsoft Azure Website"
git clone git@github.com:${deployed.githubRepository}.git workingdir
cp -r ${deployed.file}/* ./workingdir
cd workingdir
git add -A
git commit -a -m "Commit for Deployment of ${deployed.deployedApplication.version.application.name}/${deployed.deployedApplication.version.name}"
git push
--- end azure/deploy-website.sh ---
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.