Continuous deployment of ASP.NET MVC 5 app to Azure thru GitHub
http://blog.medhat.ca/2016/10/connecting-to-azure-website-with-ftp.html
In this post, I will show you how to deploy a PHP web app to Azure by directly using the Git repository that resides in Azure itself.
The following are prerequisites:
- Git is installed on your computer
- You already have an Azure subscription. Otherwise, you can get a free one month trial subscription at https://azure.microsoft.com/en-us/free.
Login into portal.azure.com. On the left-side, click on “App Services”.
Click on “+ Add”.
Click on “Web app”.
On the next blade, click on the “Create” button.
Enter a unique name for App name. Choose your subscription, select to create a new Resource Group, select an App Service plan/Location then click on Create.
The web application will be created for you in less than two minutes. When it is ready, you will see it in the list of your App services.
Click on the newly created app service on the first blade. In the above example it is toon. Then, click on Deployment credentials.
Enter a unique FTP/deployment username and Password. Note that these credentials can be used for both FTP and Git. Also, these same credentials can be used for this web app as well as other web apps that you may have already created or those that you plan to create in the future. Therefore, it important that you remember these credentials. If you forget the credentials, then you can always create a new pair of username and password.
Our next step is to let Azure know that we want to deploy our web app using Git. Click on “Deployment options”.
Click on “Choose Source” then select “Local Git Repository”.
Afterwards, click on OK.
Next, we need to obtain the URL of the remote Git repository on Azure. Click on Overview.
Copy the “Git clone url” and save it in a text editor like Notepad. This will later be used to push your code from your computer to Azure. Note that you can conveniently click on a toolbar on the right of the Git URL to copy it.
Now, back on your computer, open a terminal window in the working directory of the web application that you wish to deploy. Run the following Git commands:
git initRight after you execute the last push command, you will be prompted to authenticate with your deployment credentials in Azure. These are the credentials that you created earlier.
git add .
git commit –m “first commit”
git remote add azure {the url of the remote Azure Git repository}
git push azure master
Once your credentials are accepted, the push process will commence. When it is all finished, you can verify that your code was accepted by Azure by clicking on “Deployment options” in Azure.You should see a check mark beside your commit.
The true test is to go to the website and see whether or not it indeed works. Click on Overview. The website URL is on the right side of the last blade. Click on it.
The website should show up in your browser.
What next? Make a change to your code and push it to the remote Git repository on Azure. You will soon after notice that the change you made is reflected on your web application.
Thanks for coming this far in my article.
No comments:
Post a Comment