I mentioned earlier this week in my sprint 31 deployment post that we were working on some bigger things I wasn’t ready to talk about yet. Well, this is one of them….
As development organizations are trying to improve the cycle times on their development process – getting ideas through development and into production and collecting feedback faster and faster, they are looking for ways to streamline the process. You hear a lot of talk these days about “DevOps” and “NoOps”. Both are rapidly evolving perspectives on how to improve the interaction between development and production with the goal of improving the cycle time and the application quality. One of the evolving practices in this space is “Continuous Deployment” – getting new versions of the app into production (or a production like environment) continuously to exercise the muscle and see the results.
Today, we unveiled a partnership between Azure and our Team Foundation Service that enables automated deployment of either Windows Azure Websites or Windows Azure Cloud Services. By default, we configure automated deployments with every checkin but you can modify that to do scheduled or manual deployments – basically anything you can do with a TFS Build.
Getting started is really easy. The below is not intended to be a full fidelity tutorial, but rather an overview of what you can expect the experience to be like. For a step by step tutorial check out: http://www.windowsazure.com/en-us/develop/net/common-tasks/publishing-with-tfs/
**Important** – To enable the new continuous deployment features we created a new build process template called AzureContinuousDeployment.11.xaml. This process template lives in source control at $/<teamprojectname>/BuildProcessTemplates folder. If you create a new Team Project, it will automatically be added for you. Existing projects won’t have that process template and we were a little loathe to go and insert it into everyone’s existing source control. As such, you will need to add it yourself if you want to configure continuous deployment. If you try to connect your azure account to your existing projects your will get the following error.
Failed to link TFS project ‘MS’ with your web site ‘<websitename>’
TF42073: The value cannot be null (Parameter name: Process)
I’ve attached the xaml file you will need to this blog post. You can map the BuildProcessTemplates folder into a workspace on your machine, download the xaml file from this post and then drag it into Source Control Explorer or copy it to the folder and add it either from the command line or the GUI, etc. Once that is done you can use the wizard to setup a continuous deployment build definition.
**Update** – There’s an additional step. In addition to checking in the new build process template, you need to create a build definition that is configured to use it. You can read the comments below by Thomas Quinn on the detailed steps for doing that.
Walk-through
In this walk-through I’m going to show doing an Azure Website.
You start with an Azure account. If you have one already, you’re good to go. If not, you can go to http://www.windowsazure.com/ to signup – either with a free trial or a full account (both will work with the new continuous deployment capabilities). Once you have your Azure account, create a website and go to the website dashboard on the Azure portal. On the bottom right, you’ll find a link to “Setup TFS publishing”. Click that and it will launch a wizard to connect your TFS project to the Azure application.
The wizard will allow you to connect to an existing Team Foundation Service account or create a new one. Either way, once you have the account, enter it in the “user name” field and click “Authorize Now”. That will take you through a little authorization wizard. Then it will take you to a page to choose the Team Project that the source for your app is in.
At this point, your Azure and Team Foundation Service accounts are linked. As part of linking the accounts, we also created a continuous integration build definition that will build and deploy your app to Azure each time you check in. So the next thing you might want to do is go to Visual Studio and check in a new web site or a change to an existing one and watch it deploy. If you are using the VS 2012 Release Candidate that we announced last week, you can just click the Visual Studio icon at the bottom of the Azure page and that will open Visual Studio, connected to the project you’ve configured. If not, you can just go run VS 2010 and connect to your Team Foundation Service account.
You can see the deployment results either by looking at the TFS build report or by looking in the Azure Portal…
You can also see deployment results from inside the Team Foundation Service web UI…
There’s really only a little bit of “magic” here. Clearly we’ve done some OAuth work to enable TFS and Azure to collaborate. For now, that OAuth work is private but we expect to open it up in the future for more service to service integrations. We’ve also added a new concept of a “deployment environment” that contains the necessary information to connect to a deployment endpoint, securely storing credentials, etc. Beyond that, all of this integration really comes down to a new set of TFS Build workflow tasks that are able to perform Windows Azure deployments. We also added a little bit of new UI in the build explorer in Web Access to show and manage deployment status.
It’s natural to ask if you can do this with your on premises TFS server. Of, course you can do automated deployment to local environments using Lab Management. There are also manual ways to configure an on premises TFS Build to deploy to Azure. As you can see from the article, there are a lot of steps. As our new Azure continuous deployment feature matures, we expect to bring more of the capability and simplicity into our on-premises TFS product as well. We think of what’s out there now as a “preview” like the rest of the Team Foundation Service currently is.
If you are doing any Azure development, I hope you will find that this is a really awesome way to streamline your development process. Give it a try and please share any feedback you have. You can use our forums at: http://social.msdn.microsoft.com/Forums/en-US/category/windowsazureplatformctp
I look forward to hearing from you…
Brian

I've added the new template to the BuildProcessTemplates folder, but I'm still getting the "TF42073: The value cannot be null (Parameter name: Process)" error.
Am I missing something?
Continuous Deployment is fantastic! I am glad you are looking at ways to enable that.
(We don't and won't use Azure, but just having any kind of Continuous Deployment it on your radar makes me happy.)
@Martin, I'm trying it out now. There may be another step. I'll let you know in a couple minutes.
@Martin, yes, there is another step to get the newly checked-in template registered with the system. There may be an easier way than this, but these steps worked for me. And I beleive they are roughly the same between VS 2010 and VS 2012.
In your team explorer, in the same team project where you just checked in the file, you will see a "Builds" node. In VS 2010 right click on it and select "New Build Definition." In VS 2010, select Builds and it will take you to the Build page. There is a "New Build Definition" link at the top of that page. From here on the instructions are the same…
This will open up the Build Definition editor in the main window. You will see a Process tab on the left hand side of the editor. Select that to open the Process page. At the top there is a "Build Process Template" section that says "Default Template." To the right of that is a button that says "Show Details." Select that.
You will now see a drop down with "Default Template" in it. To it's right is a button that says "New…". Click the New… button. This brings up the "New Build Process Template" dialog. Select the bottom radio button "Select an existing XAML file." Then click "Browse…" and it will open a file picker showing your BuildProcessTemplates directory in version control. Select the AzureContinuousDelivery.11.xaml file that you just checked in. Click OK. Click OK again on the "New Build Process Template" dialog.
The AzureContinuousDeliver.11.xaml file should now be in the drop down in the build definition editor. It is now registered and available to use. You do not need to save the new build definition. At this point you should be able to link your Azure account to your Team Project.
HTH.
@Thomas, Thanks that fixed it!
I'm super-pumped to try this out, but am still waiting on an invitation code to Team Foundation Service 🙁
Does this mean that VS2012 RC Supports Azure now?
Brownie, on Thursday, we released an Azure SDK that works with VS 2012. http://www.windowsazure.com/…/downloads
Brian
That is pretty awesome, all that's left is Windows Phone and I can abandon 2010 altogether.
Work'in on it 🙂
Brian
Will Continuous Deployment support GIT Deploy and HG Deploy too?
Hey Brian – this is great stuff, love the linking to Azure, but I also want more control, like not necessarily deploying to Azure on each checkin/build, but rather pushing a specific build/drop folder when I am ready?
Thanks, Matthew.
Continuous Deployment! Wow, it's awesome idea, I am agree with @Vaccanoll
I'm getting an error on the portal when I try to link my cloud service with TFS:-
Failed to link TFS project '{ProjectName}' with your cloud service '{CloudServiceName}'
Access Denied: {user} needs the following permission(s) on the resource StrongBox to perform this action: Create a StrongBox Drawer.
Any ideas what could cause that?
@Iain That error would indicate that the user account you are using does not have admin permissions for your account.
Are you using the same ID that you used to create the account? or are you trying a different one?
In addition because both Azure and TFS use live id and you can only be logged into a browser with one live id at a time you need to make sure the LiveId you use for Windows Azure is an Admin in your TFS Account otherwise you won't be able to complete the OAuth handshake.
Anything in the roadmap for Continous Deployment to SQL Azure?
I'm trying to figure out how a deployment that involves both changes to website and the database would play out with this. You would us CD for the website but still roll out the SQL Azure changes manually (log in and run whatever insert/update/alter scripts)?
Unit tests in solution stops run after I used "AzureContinuousDeployment.11.xaml" instead of "Defaul template",
has anybody ideas why this happens?
Lexej.s, I've not heard any issues with that. What are you seeing in the log files?
Brian
@Saca
right now the best database story for our solution revolves around Entity Framework Migrations. However, this is something we are looking to improve. A second option is to customize the workflow to run the sql command line tools to execute your scripts against your target database. Finally you could use the sql server data tools to manage your schema then deploy it with their tools which are installed on the build machine.
For the entity framework solution I did a talk at TechEd that goes over it channel9.msdn.com/…/DEV362
For the other two I don't have great examples but I will work on some and get links posted to Brian's blog.
I'm also getting the same error on the portal when I try to link my cloud service with TFS:-
Failed to link TFS project '{ProjectName}' with your cloud service '{CloudServiceName}'
Access Denied: {user} needs the following permission(s) on the resource StrongBox to perform this action: Create a StrongBox Drawer.
My live account is part of the administrators group as well as build administrators. Any thoughts?
Thanks much!
@Joe
You need to be a member of the Project Collection Administrators group for now. We are working on a fix that will allow Project Administrators to setup the integration and expect it to be deployed later this month.
Sorry for the inconvienence
Maybe I am missing something, but when we Connect an Azure website with a "TFS Project" that tfs project has many soultions, of which may have multiple websites. How do I select the website project from the TFS project that I want to deploy to the Azure Website?
Brian, would you mind looking at this uncomfortable conversation I am having with Trevor over on the forums.
social.msdn.microsoft.com/…/accfa8de-7b9d-4c04-b66f-c6c9e72f1b70
Thank you.
Terrence, Sure. I've asked Chris Patterson to look at this. He's our expert on the Azure CD integration.
Brian
@Terrence
I have replied to your forum post, please reply there if things are still not clear.
I also have the issue with my unit tests not being built with this build process. What to do?
We have CI working from Team Foundation Service -> Azure Web Site, however, I am a bit stuck. I went in to modify the build configuration through VS (e.g., add a description to the build configuration) and I get a validation error. It creates the build definition with the following value for the drop folder: #/.
E.g., Copy build output to the following drop folder: #/
This is invalid, but I didn't want to mess with the configuration. Any help would be greatly appreciated!
Is there a way to get the azure deployment package to a drop location instead of deploying directly to cloud service?
@rnx
The package is dropped either to source control or into Azure storage. On the build log there is a button to either open the drop folder or download drop as a zip.
This article should be updated for TFS 2013 Azure templates –> stackoverflow.com/…/175679
AzureContinuousDeployment.11.xaml has been superceded with TfvcContinuousDeploymentTemplate.12.xaml