Microsoft Azure – Continuous deployment

While developing web application for example Web API sometimes you have to publish your work. Microsoft Azure can automate this process. I will show you how to configure continuous deployment directly from your code repository.

I created a new code repository on my GitHub which is available here. Of course you can use existing one.

Log in Azure portal:

Find and select Web App component:

And as always a form for filling:

To bind GitHub repository to newly created Web App go to Deployment options section:

Select one of available code sources. In our case it is GitHub.

Next Azure will ask you for account credentials.

After successful authorization select project and specific branch for continuous deployment.

It is done! Now fill your empty repository with code and check if everything is fine.

Create a new Web API project:

And create a simple ApiController.

namespace AutomaticDeploy.Controllers
{
    public class ValuesController : ApiController
    {
        public IEnumerable<string> Get()
        {
            return new string[] { "value1", "value2" };
        }
    }
}

Then push your code to remote branch which you previously selected. In Deployment options section you can see that Azure started his job.

After successful compilation, Azure will start deployment.

It is done. Go to : http://automaticdeployapp.azurewebsites.net/api/values
You will see following XML structure:

Since now every change on branch causes building solution and automatic deployment.

namespace AutomaticDeploy.Controllers
{
    public class ValuesController : ApiController
    {
        public IEnumerable<string> Get()
        {
            return new string[] { "Azure", "Power" }; // changes in array of strings
        }
    }
}

After code pushing:

Go again to : http://automaticdeployapp.azurewebsites.net/api/values

In case of any compilation problems Azure inform you about it.

Of course, it is a lot of methods how can deploy your application but I am sure this is one of easiest.

Read about powerful tool – Kudu.

Leave a Reply

Your email address will not be published. Required fields are marked *