This how-to provides step-by-step instructions on setting up DeployToAzure and creating build definition which deploy application to Azure.
Step 1 - Install Visual Studio 2010 and Windows Azure SDK on TFS 2010 Build server.
There is probably "smarter" way to make your build server able to build cloud projects, but the easiest one is to install Visual Studio 2010 and
Windows Azure SDK on it.
Step 2 - Create certificate for Azure API, upload it to your Azure account and install it on your build server.
One of the simplest way to create and install management API certificate is to generate it build server using makecert.exe utility. To do so, execute the command like the below on your build server:
makecert -r -pe -a sha1 -n "CN=Windows Azure Authentication Certificate" -sr LocalMachine -ss Root
-len 2048 -sp "Microsoft Enhanced RSA and AES Cryptographic Provider" -sy 24 buildcert.cer
It will generate self-signed certificate, install it to LocalMachine\Trusted Root storage, and create buildcert.cer file in the current folder. The next step is to upload buildcert.cer file to the
developer portal. The portal has Management Certificates section where you can do that.
Step 3 - Upload DeployToAzure to TFS Source Control and modify TFS Build Controller properties.
Choose a location in source control for custom assemblies. Add EastBancTech.DeployToAzure.Activities.dll and Microsoft.WindowsAzure.StorageClient.dll. Check-in added files.
Modify build controller’s properties to load custom activities from that location using the
Build Controller Properties dialog. In Visual Studio select
Build –> Manage Build Controllers… –>s elect your build controller->
Restart Visual Studio to ensure it picks up new assemblies.
Last step here is uploading build definition template to source control. Select location in source control where you will keep reusable build definitions, add and check-in DefaultTemplateWithDeploymentToAzure.xaml from
DeployToAzure Release Package there.
Step 4 - Create build definition
Open New Build Definition dialog. Select Process tab. Click
New button in Build process template section. Choose Select an existing XAML file option and specify path to DefaultTemplateWithDeploymentToAzure.xaml in your source control.
Deployment to Azure section will appear in Build process parameters. Click
Refresh button if you don’t see it.
Now define build properties. First ,open 1. Required /
Items to build dialog and select your solution and specify configuration to build.
Open Deployment to Azure section and provide following parameters:
- API Certificate store location – store location of your management certificate. Select
LocalMachine if certificate was created by command above.
- API Certificate Thumbprint – thumbprint of management certificate.
- API Certificate store – store where management certificate is located. Select
Root if certificate was created by command above.
- Cloud Project – cloud project to be packaged and deployed. It will be built with the same configuration as the one specified for solution building.
- Deployment label – label of deployment. Label can contain same set of macros as Build Label.
- Hosted Service Name – DNS Prefix of Hosted service. You can find it on Windows Azure portal.
- Service configuration – service configuration to be used for deployment, for example
Cloud. Keep this field empty to use default configuration.
- Slot – select Staging or Production.
- Storage Service Name – DNS Prefix of storage service which will be used to upload deployment package.
- Subscription Id – Azure subscription ID.
- Wait for roles to start – set to true if build should wait for all instances to start.
- Initialization Timeout – if above is true, specify timeout for build to wait before generate timeout exception.
And… that’s it! Save it and you are ready to run your deployment to Azure.