140 likes | 162 Views
Explore the Automated Deployment Framework using TFS & Custom PowerShell cmdlets. Learn about TFS Build/Deploy process, Extending with Custom PowerShell, Workflow Activities, Deployment Restrictions, and WebDeploy. Enhance your deployment process with Custom PowerShell Cmdlets and resources for further customization.
E N D
Automated Deployment Framework Using TFS and Custom PowerShell cmdlets to create an automated deployment framework
Agenda • TFS Build/Deploy • Extending TFS Build/Deploy • Custom PowerShell Cmdlets • Putting it all Together
TFS Build/Deploy • How it works • Workflow Activities • XAML • Build Definitions • Build Controllers/Agents
TFS Build/Deploy • Default Process • Trigger • Local Workspace/Drop Folder • Build • Test • MSBuild
TFS Build/Deploy • Restrictions • Build Packages • Deploy only through the msbuildcommand • Rebuilds projects/solution every time
Extending TFS Build/Deploy • The Templates • XAML (Silverlight was actually worth something!) • Workflow Activities • Custom Activities and Editors • Build Controller Assemblies • Start with the default template and add/remove as needed • Test Frequently!
Extending TFS Build/Deploy • PowerShell • Object based • Snapins/modules for about every MS product • Remote server commands getting rolled into many cmdlets • Excellent community support
Extending TFS Build/Deploy • PowerShell The EEEvil Stuff • Getting rolled into products by separate product teams • Error Handling • Escaping • rEtrieve Behavior
Extending TFS Build/Deploy • WebDeploy • Package deployment • SetParameter Files • Remote Execution of Scripts • Azure and Lab Deployments
Extending TFS Build/Deploy • Setting it up • Update the template to run a PowerShell script (copy scripts locally and execute it) • Setup a PowerShell script to do your deployment by executing a WebDeploycommand line • Setup your build definitions
Extending TFS Build/Deploy • Drawbacks to the straight PowerShell approach • Whomever creates/maintains the deployments must know the ins and outs of PowerShell and each PowerShell module you use (iis, adfs, SQL, server, etc) • With multiple deployments, you end up with a lot of duplication between scripts • Complex deployments result in complex scripts
Custom PowerShell Cmdlets • Expose .NET code through PowerShell • System.Management.Automation • Inherit from Cmdlet and override BeginProcessing and ProcessRecord methods • Provide help/examples through an xml file • Create a cmdlet for each type of deployment you support and for any common deployment tasks • Can pass in parameters, a file path, use a database, etc for deployment info depending on the complexity of the deployment
Custom PowerShell Cmdlets • Install the custom cmdletson each TFSbuild agent (using PowerShell of course) • Update the PowerShell deployment scripts to call your custom cmdlets
Resources • Customizing TFS Templates • http://www.ewaldhofman.nl/post/2010/04/20/Customize-Team-Build-2010-e28093-Part-1-Introduction.aspx • TFS/ALM • http://www.deliveron.com/blog/author/mikedouglas.aspx • Web Deploy • http://blogs.iis.net/harshmittal/archive/2012/07/26/announcing-web-deploy-3-0-rtw.aspx • PowerShell • http://technet.microsoft.com/en-us/library/bb978526.aspx • Custom PowerShell Cmdlets • http://blogs.charteris.com/blogs/ivorb/archive/2011/11/01/create-a-custom-powershell-cmdlet-end-to-end.aspx Andy Bayer Deliveron Consulting Services andybayer@deliveron.com