Wednesday, March 25, 2020

Migrate WebApp from GitHub to Azure Cloud - Build Pipelines in Azure DevOps to migrate WebApp from GitHub to Azure Cloud

We are going to migrate application from GitHub to Azure Cloud using Azure Pipelines offered from Azure DevOps. 

Building pipelines in Azure DevOps is really easy, you can migrate your web application code from any where into Azure Cloud by using Azure pipelines.

 
Pre-requisites:
(If you already have a WebApp setup in Azure cloud, move to next step)

You need to create WebApp in Azure Cloud. WebApp is an App service (mostly Platform as a Service) provide by Azure Cloud to migrate any web applications.

Click here to learn how to create WebApp in Azure Portal.

Creating Azure pipelines in Azure DevOps

1. Now go to your visual studio project page --> https://dev.azure.com/
Select the Project dashboard you already created.

Click on Pipelines, Builds.


2. Click on New pipeline and click on use the classic editor to create a pipeline without YAML

3. Select source repository as GitHub and click Authorize using OAuth

4. Now click on Authorize Azure Pipelines, enter GitHub password if it asks.
5. Now you should be able to select repositories by clicking ... dots

6. Since our application is Java stack, type Java and Choose Azure WebApp for Java


7. Click on pipeline name and re-name per your naming standard

8. Modify maven goal as clean install and also choose POM.xml by clicking on three dots ...



9. Leave the value as it is for Copy Files to staging folder

10. Leave the value as it is for Publish Artifact: Drop 
11. Click on Stop Azure WebApp step, Enter Azure WebApp details - where  you would like to deploy your app in Azure. Select Free trial subscription from the drop down.


12. Do the same in Deploy Azure WebApp & Start Azure WebApp steps.

Enable Webhooks in Pipeline

11. Click on Triggers and then enable check box for Continuous Integration

12. Now click on Save and Queue

13. If your configurations are correct, you should be able to see the build success and able to access in the Azure. Click on Pipelines and pipeline name

Now you will see that Azure DevOps would have started build.


14. Make sure build is success, it should have all green like below.


After successful build, you can check the output by accessing the URL, copying from WebApp configuration. Please append WAR file name after the url

http://myAzureWebAppUrl/MyWebApp


Clean-up Resources:
After successfully finishing the labs, make sure to delete all the resources created in Azure portal to avoid charges from Microsoft.

Select the resource group in Azure portal, delete the resource group. This will ensure that all the resources will be deleted under the resource group.



No comments:

Post a Comment