To complete this recipe you need the following:
- The latest release of Cruise Control.NET (1.8.2.0) - Download and install here
- A Microsoft Azure Subscription - sign up for a three month free trial here.
- A Git Account - sign up for a free account here.
- Putty Gen and Putty Agent can be downloaded here.
- Git
- The .Net framework 4 or above
- The Azure SDK 1.8 and all the goodies
- Windows Azure Authoring Tools
- Windows Azure Tools for Visual Studio
- Visual Studio IDE 2012
I created this recipe on one machine with everything installed in one place. In the real world you would have a dedicated build server.
Create a Git Hub Repository
To start, create a Git Hub repository. If you aren't willing to pay for access you will only be able to create a public repository.
- Log onto http://github.com and select your git hub account.
- Click 'Create a Repository'
- Enter your Repository Name and Create
Create an Azure Cloud Service Web Role and push to Github
Next we will create an Azure Cloud Service Project with a ASP.Net MVC 4 Web Role and save locally. We will then push up to the Git Repository. The repository will ultimately be used by CC.Net to pull the latest code changes, build the solution and deploy to Azure.
- Create a Windows Azure Cloud Service project in Visual Studio 2012
- Add an ASP.Net MVC Web Role to the Solution. Give your Role a better name like 'MyAzureWebRole.Web'
- Select the Internet Application project template
- Don't worry about creating unit tests for the project.
A good folder structure and naming convention is, for example:
\Mark.Rodseth.MyAzureWebRole
--\Build {build scripts, certificates, targets, tools}
--\Documentation {doxygen docs}
--\Tools {dev tools}
--\Solutions
----\MarkRodseth.AzureWebRole.Cloud {cloud configuration project folder }
----\MarkRodseth.AzureWebRole.Web { MVC Web Project folder }
----\MarkRodseth.AzureWebRole.Web.Tests { Web Tests folder }
----\MarkRodseth.AzureWebRole.sln {solution file}
Once created initialise your Git Repository and push up to Git.
- Initialise your local Git repository. GitBash > git init
- Initialise Git Hub remote repository. GitBash > git remote add origin {Url to Git Repository}
- Add the contents of the folder to staging. GitBash > git add .
- Commit the changes. GitBash > git commit -m "my first commit"
- Pull the latest from the Git Hub Repo: GitBash > git pull origin master
- Push the changes to Git Hub. GitBash > git push origin master
You will notice that step 5 fails because you trying to push to git using SSH but haven't configured the public / private key for secure communication.
Set-up SSH Public / Private Key Pairs
To enable secure communication between your client and Git Hub you need to generate a SSH (Secure Shell) Public and Private Key Pair and add the public key details to Git Hub. This will allow your git client and Git Hub to talk securely. SSH keys will also be used by the CC.Net server for encrypted communication with GitHub.
Generate Public / Private Key Pair
- Load PutyGen.exe
- Click Generate and wave your cursor randomly around the Key area
- Add a passphrase to private key.
- Save Public Key \users\{username}\.ssh\{publickeyname}.pub
- Save Private Key \users\{username}\.ssh\{privatekeyname}.ppk
Add the Public Key to GitHub SSH Keys List.
- Navigate to GitHub>AccountSettings>SSH keys and click Add Key
- Give your public ssh key a friendly name
- Copy and Paste the contents of your public key saved in the above step into the text area
Your Git Hub account is now configured to accept secure communications from Git clients using the associated Private key.
If you try do a git push now you will still get the same error. To allow seamless communication to GitHub you need to run Putty Agent and add the SSH Private Key you created. This agent will funnel all SSH communication through it and handle the authorisation step and negate having to re-enter your private key pass phrase everytime you push to GitHub. Putty Agent is required because CC.Net server will be blocked if a pull from GitHub requires manual entry of the Private key pass phrase.
- Run Putty Agenty - pageant.exe
- Double click the Putty Agent icon in your system tray. This will launch a GUI where you can add your Private Key.
- Click Add Key and navigate to the SSH Private Key you created.
- Enter the pass phrase.
Once that is done, you or CC.Net can push and pull from GitHub securely and not be bothered with pass-phrase prompts.
You can now push your changes to git hub: GitBash > git push origin master.
Create Azure Web Service and download Publish Profile
In this step you will log onto your Azure Management Dashboard, create an Azure Web Service, and download your Subscription Publishing Profile. The Publishing Profile will be used by CC.Net to publish to your Azure Instance.
- Log into the Azure Management Portal
- Create a new Cloud Service by specifying your URI A-Record and Affinity Group (which data center the Web Role will be hosted.)
- Download Publishing Profile. Navigate to https://windows.azure.com/download/publishprofile.aspx which will automatically download the Publishing Profile for your subscription. A publishing profile contains your Azure Subscription ID, Management Certificate Public Key and the URL to the Azure Management API. This information is used by clients when communicating with the Azure Management API. Save the Publsih Profile somewhere for use in the next step.
Configure CC.Net and PowerShell
Now that you've set-up up Source Control (Git & GitHub), created an Azure Cloud Project with an MVC 4 Web Role, and created an Azure Subscription, you are ready to configure your CC.Net build server and create a new CC.Net project which will build and deploy the solution to your Azure Service.
PowerShell Script
Once all this is setup then you can navigate to the CC.Net Dashboard and run your Build and Deploy project in CC.Net and watch as you web application magically makes its way onto the cloud. Also, any pushes/changes to the Git Repository will be detected and the CC.Net project will download the latest changes from Git Hub, build the project and deploy the changes up to your production or staging slot.
- Copy the MS Build Microsoft.WebApplication.targets file from a Visual Studio installation to the build server. The targets file is an XML File which is used by MsBuild to execute the common steps in creating a package for web site deployment. The file is located in the following directory: C:\Program Files(x86)\MSBuild\Microsoft\VisualStudio\v11.0\WebApplications
- Save the Publishing Profile created previously to a location on your build server. e.g. C:\CCNetBuild\PublishProfiles\myazure-credentials.publishsettings. You will reference this Publish Profile in your PowerShell deploy script.
- Make sure you have the Azure Powershell Script Template installed in your CC.Net Build folder. e.g. C:\CCNetBuild\Scripts\ . The Powershell Script Template can be downloaded here.
- Make sure the PowerShell is able to execute the script by setting the PowerShell execution policy to RemoteSigned or UnRestricted. Run Windows Powershell and enter the following command: Set-ExecutionPolicy RemoteSigned.
- Add a new CC.Net project and Build Trigger, Source Control, Build Task (MSBuild) and Deploy Task (Powershell) to ccnet.config (Located in the CC.Net server folder) . See screenshot for configuration example.
- Update PowerShell Script Variables. See screenshot for PowerShell script example.
ccnet.config project configuration.
PowerShell Script
There were a few niggles and stack overflow posts I had to trawl through to get it fully working. I ended up running the MSBuild and Powershell commands directly to iron out a few kinks like path errors or naming errors.
If you experience issues then here are a few links which I found helpful.
If you experience issues then here are a few links which I found helpful.
Good Post! Thank you so much for sharing this pretty post, it was so good to read and useful to improve my knowledge as
ReplyDeleteupdated one, keep blogging… Azure Online Training
Tech-Rash: Cloud Recipes: Build And Deploy An Azure Web Role With Cc.Net And Github >>>>> Download Now
ReplyDelete>>>>> Download Full
Tech-Rash: Cloud Recipes: Build And Deploy An Azure Web Role With Cc.Net And Github >>>>> Download LINK
>>>>> Download Now
Tech-Rash: Cloud Recipes: Build And Deploy An Azure Web Role With Cc.Net And Github >>>>> Download Full
>>>>> Download LINK
mmorpg oyunlar
ReplyDeleteınstagram takipçi satın al
tiktok jeton hilesi
Tiktok Jeton Hilesi
antalya saç ekimi
referans kimliği nedir
İnstagram takipçi satın al
metin2 pvp serverlar
Instagram Takipçi
perde modelleri
ReplyDeletesms onay
türk telekom mobil ödeme bozdurma
Nft nasıl alınır
ankara evden eve nakliyat
trafik sigortası
Dedektor
web sitesi kurma
ASK KİTAPLARİ
tuzla arçelik klima servisi
ReplyDeleteçekmeköy samsung klima servisi
ataşehir samsung klima servisi
kadıköy vestel klima servisi
maltepe bosch klima servisi
kadıköy bosch klima servisi
beykoz beko klima servisi
pendik daikin klima servisi
tuzla toshiba klima servisi
عزل اسطح بالاحساء
ReplyDeleteعزل الاسطح
Good content. You write beautiful things.
ReplyDeletehacklink
taksi
sportsbet
vbet
sportsbet
hacklink
korsan taksi
mrbahis
mrbahis
dijital kartvizit
ReplyDeletereferans kimliği nedir
binance referans kodu
referans kimliği nedir
bitcoin nasıl alınır
resimli magnet
JOFX
https://saglamproxy.com
ReplyDeletemetin2 proxy
proxy satın al
knight online proxy
mobil proxy satın al
450
görüntülüshow
ReplyDeleteücretli show
UJJBQ
شركة تسليك مجاري بالاحساء
ReplyDeleteتسليك