http://stackoverflow.com/questions/4832154/webdeploy-to-deploy-multiple-web-sites
http://stackoverflow.com/questions/6457108/how-to-tell-tfs-to-deploy-multiple-webapps-containing-in-one-solution
The new VSO build allows this to be done very easily.
http://geekswithblogs.net/jakob/archive/2015/04/29/deploying-an-azure-web-site-using-tfs-build-vnext.aspx
Inspired with below two articles, deploying to azure websites with TFS build 2013 and VS Release Management 2013, is explained in this post.
http://www.colinsalmcorner.com/post/webdeploy-and-release-management--the-proper-way
http://blogs.blackmarble.co.uk/blogs/rfennell/post/2014/09/18/Using-MSDEPLOY-from-Release-Management-to-deploy-Azure-web-sites.aspx
First requirement is getting the the build to package the website. For this right click on the Web Project and click on publish.
![1 1](http://lh3.googleusercontent.com/-cZwpmAizMIk/VX2H0UNz_9I/AAAAAAAAFEs/9Td3mXl78yY/1_thumb%25255B2%25255D.png?imgmax=800)
Click on Custom and provide a name to the publish profile.
![2 2](http://lh3.googleusercontent.com/-A7PHAaCq6Uw/VX2H2HNv7II/AAAAAAAAFE8/yIp7msjWWdY/2_thumb%25255B2%25255D.png?imgmax=800)
![3 3](http://lh3.googleusercontent.com/-mC1cTeJGySI/VX2H35VUpvI/AAAAAAAAFFM/uVDk4MnDrTI/3_thumb%25255B1%25255D.png?imgmax=800)
Select webDeployPackage as publish method. Package name should be ProjectName.Zip.
Set site name with __ as prefix and suffix for RM server to understand it as a token (parameter).
![4 4](http://lh3.googleusercontent.com/-d93eUc3cddo/VX2H5u7A4mI/AAAAAAAAFFc/1soHEmuehKg/4_thumb%25255B1%25255D.png?imgmax=800)
Set the configuration to Release.
![4 4](http://lh3.googleusercontent.com/-Iy0R3XYX_As/VX2H7JsCboI/AAAAAAAAFFs/Gu56BMBN91Y/4_thumb%25255B5%25255D.png?imgmax=800)
Click publish and this will create package files in the project folder and add publish profile to the Project.
![6 6](http://lh3.googleusercontent.com/-nq7CFSH0E3U/VX2H8wWFwLI/AAAAAAAAFF8/gwfMurUPAgs/6_thumb%25255B2%25255D.png?imgmax=800)
![6.2 6.2](http://lh3.googleusercontent.com/-GsjupJ37RgE/VX2H-jZ638I/AAAAAAAAFGM/oj8AJvtCljM/6.2_thumb%25255B1%25255D.png?imgmax=800)
Publish profile contains site name value with prefix and suffix __ as DeployIisAppPath.
![7 7](http://lh3.googleusercontent.com/-m-AY5FPrME8/VX2IAUz-SPI/AAAAAAAAFGc/Pl7g_YPDvWk/7_thumb%25255B1%25255D.png?imgmax=800)
Published package in project folder contains required files to deploy the web site.
![7.2 7.2](http://lh3.googleusercontent.com/-JibQeM49XfY/VX2ICbxDAwI/AAAAAAAAFGs/auYZoBbVRO4/7.2_thumb%25255B2%25255D.png?imgmax=800)
![7.3 7.3](http://lh3.googleusercontent.com/-iEWGDl_hXfA/VX2IEuyJ0BI/AAAAAAAAFG8/xkaJMMKwfPk/7.3_thumb%25255B1%25255D.png?imgmax=800)
In SetParameters file the site name with __ available.
![7.4 7.4](http://lh3.googleusercontent.com/-GXBl7nRhcN4/VX2IGeA2OFI/AAAAAAAAFHM/2nf53t5BIp4/7.4_thumb%25255B1%25255D.png?imgmax=800)
Setup a TFS Build to package the solution. Use build arguments to package the web site with publish profile.
/p:CreatePackageOnPublish=true /p:DeployOnBuild=true;PublishProfile="TFSAzureRelease"
![22 22](http://lh3.googleusercontent.com/-DjcbvOhzm8I/VX2IIIewEuI/AAAAAAAAFHc/Koiw8N3nuZM/22_thumb%25255B1%25255D.png?imgmax=800)
This will create the package and copy to build drop location.
![25 25](http://lh3.googleusercontent.com/-h2ZX_FV4ctc/VX2IJ19gOOI/AAAAAAAAFHs/pj0hIburFf8/25_thumb%25255B1%25255D.png?imgmax=800)
Next step required is to setup a Release Management tool to deploy the package created. Collin’s ALM Corner post here shared the irmsdeploy.exe required to create the tool.
__WebAppName__.deploy.cmd /y /m:"https://__PublishUrl__/MsDeploy.axd" -allowUntrusted /u:"__PublishUser__" /p:"__PublishPassword__" /a:Basic
![10 10](http://lh3.googleusercontent.com/-2QTTSxypIos/VX2IL2xDg8I/AAAAAAAAFH8/UT1NcODdSaA/10_thumb%25255B4%25255D.png?imgmax=800)
Create environment to deploy from is the next requirement. For this setup RM Agent in a machine with VS 2013 is available. Setting up RM Agent explained here.
Register the RM Agent machine with the RM server create environment and a release path.
![11 11](http://lh3.googleusercontent.com/-kJpBjWQKlgY/VX2INajPfCI/AAAAAAAAFIM/WqUavyPUHms/11_thumb%25255B1%25255D.png?imgmax=800)
![12 12](http://lh3.googleusercontent.com/-8kYIHJs7W8w/VX2IPKYWIMI/AAAAAAAAFIc/xqR8Y4sPwCs/12_thumb%25255B1%25255D.png?imgmax=800)
![14 14](http://lh3.googleusercontent.com/-sr4w3g9RaWc/VX2IRDHOgpI/AAAAAAAAFIs/8l0knK1KTAk/14_thumb%25255B1%25255D.png?imgmax=800)
In the environment add the server and allow for all stages. All stages allow here since deployments to all azure environments in all stages can be done via same agent machine.
![16 16](http://lh3.googleusercontent.com/-cPpJO4ZZ_5g/VX2IS5W1h8I/AAAAAAAAFI8/e1OT_xGeKuA/16_thumb%25255B3%25255D.png?imgmax=800)
![17 17](http://lh3.googleusercontent.com/-PM7n5RfNr4w/VX2IUrKTYsI/AAAAAAAAFJM/ZWHxmWGbAVU/17_thumb%25255B1%25255D.png?imgmax=800)
Acceptance step set to Automated to trigger a release from the build.
![18 18](http://lh3.googleusercontent.com/-557ql11JKFo/VX2IWTiYLPI/AAAAAAAAFJc/wbL77wrpbOE/18_thumb%25255B3%25255D.png?imgmax=800)
Next create a new release template. Select the build created earlier.
![19 19](http://lh3.googleusercontent.com/-x9uM_xOa-ME/VX2IYc7u5sI/AAAAAAAAFJs/S56pKTb1Ff8/19_thumb%25255B1%25255D.png?imgmax=800)
For the release template add a new agent based component.
![20 20](http://lh3.googleusercontent.com/-DcMYu_JDgAc/VX2IaCwADsI/AAAAAAAAFJ8/0mo6bbBilQY/20_thumb%25255B1%25255D.png?imgmax=800)
![21 21](http://lh3.googleusercontent.com/-CAYlgh5PlD0/VX2Ib8bSJNI/AAAAAAAAFKM/Lh7nqh6-_8Y/21_thumb%25255B1%25255D.png?imgmax=800)
Provide the build drop location for the component (Web site package path in the build drop).
![26 26](http://lh3.googleusercontent.com/-YAhM3iXkULw/VX2IdvUSyHI/AAAAAAAAFKc/BG-FJ8w_FiI/26_thumb%25255B2%25255D.png?imgmax=800)
Select the tool created in the deployment tab.
![27 27](http://lh3.googleusercontent.com/-Ow3dMzQag1E/VX2Ifh9d0sI/AAAAAAAAFKs/-o3WVx5LjMg/27_thumb%25255B1%25255D.png?imgmax=800)
In the configuration variables tab set the AzureWebAppName parameter for SetParameters file and click Save&Close.
![27.2 27.2](http://lh3.googleusercontent.com/-vi1wjr31MEU/VX2IhVKTJHI/AAAAAAAAFK8/TD0Gdg6x66E/27.2_thumb%25255B2%25255D.png?imgmax=800)
Link the component to current template.
![28 28](http://lh3.googleusercontent.com/-Vb5hwwWxygo/VX2IjNJ_XLI/AAAAAAAAFLM/O6dzl_td8ug/28_thumb%25255B1%25255D.png?imgmax=800)
![29 29](http://lh3.googleusercontent.com/-Rag-TQ4mYKM/VX2IlC8waiI/AAAAAAAAFLc/3ur0QeEmZu8/29_thumb%25255B1%25255D.png?imgmax=800)
Add the component to template and set the parameters. The values should be obtained from the publish profile of the target Azure web site.
![30 30](http://lh3.googleusercontent.com/-tMnprvwnz5c/VX2ImotSa6I/AAAAAAAAFLs/h2PRbLzl-RQ/30_thumb%25255B1%25255D.png?imgmax=800)
Using below steps Azure Web Site can be created in Azure Management portal and obtain the publish profile.
![36 36](http://lh3.googleusercontent.com/-pWCdIRILKzk/VX2IoWl3e9I/AAAAAAAAFL8/xkKKES8npbg/36_thumb%25255B1%25255D.png?imgmax=800)
![37 37](http://lh3.googleusercontent.com/-uyLpbdgvKdg/VX2IqWcVzjI/AAAAAAAAFMM/y2KeZ56xrPE/37_thumb%25255B1%25255D.png?imgmax=800)
![38 38](http://lh3.googleusercontent.com/-_iassFtlvAE/VX2IsOpg4pI/AAAAAAAAFMc/LZaK-AxxgwE/38_thumb%25255B1%25255D.png?imgmax=800)
Parameter values for publishing available in publish profile.
![39 39](http://lh3.googleusercontent.com/-2lyvt8yg_nk/VX2Iuuelj6I/AAAAAAAAFMs/lXx7NP6so4o/39_thumb%25255B2%25255D.png?imgmax=800)
It is possible to add more web projects to Visual Studio solution and add them with a publish profile with the same name.
![35 35](http://lh3.googleusercontent.com/-FkRykWglg0c/VX2IwqH-wMI/AAAAAAAAFM8/KjY-sMyw2zc/35_thumb%25255B2%25255D.png?imgmax=800)
![46 46](http://lh3.googleusercontent.com/-PwrMl5loPzo/VX2IybrJoZI/AAAAAAAAFNM/YgTpTxVJdwI/46_thumb%25255B3%25255D.png?imgmax=800)
It is possible to add components using the tool and create a template to deploy multiple azure websites like shown below.
![47 47](http://lh3.googleusercontent.com/-MzlZIIydUzk/VX2I0a3qtuI/AAAAAAAAFNc/3-su200G0VI/47_thumb%25255B2%25255D.png?imgmax=800)
Sites can be deployed with release template.
![48 48](http://lh3.googleusercontent.com/-SUvGiXgwMko/VX2I2B0hEUI/AAAAAAAAFNs/OIfgN5PIWNI/48_thumb%25255B1%25255D.png?imgmax=800)
![34 34](http://lh3.googleusercontent.com/-yuvC3K6H9lc/VX2I3-7EZJI/AAAAAAAAFN8/IRTaD88j5_k/34_thumb%25255B1%25255D.png?imgmax=800)
![52 52](http://lh3.googleusercontent.com/-seaUy4cFwzk/VX2I5gdf-EI/AAAAAAAAFOM/goH5aA5O600/52_thumb%25255B2%25255D.png?imgmax=800)
No comments:
Post a Comment