You can deploy ASP .NET Core web apps to Azure App Service directly using Git.
This is actually part of the Continuous Deployment workflow for apps in Azure App Service. Currently, Azure App Service integrate with not only Github, but also Visual Studio Team Services, BitBucket, Dropbox, OneDrive, and so on.
Although dotnet.sg source code is on Github, choosing the “GitHub” option cannot detect its repository. This is because the Github option only lists the repositories on my personal Github account. The dotnet.sg repo whereas is under the sg-dotnet Github Organization account. Hence, I have to choose “External Repository” as the deployment source instead.
After that, whenever there is a new commit, if we do “Sync”, it will create a new deployment record, as shown in the screenshot below. We can anytime revert back to the previous deployment by right-clicking on the desired deployment record and select “Redeploy”.
Kudu
So what if we want to customize the deployment process?
Before going into that, the first thing we need to say hi to is Kudu. What is Kudu? Kudu is the engine behind Git deployment in Azure App Service. It is also a set of troubleshooting and analysis tools for use with Azure App Service. It can capture hang dump for worker process for performance analyzing purposes.
On Kudu, we can also download the deployment script, deploy.cmd. We can then edit the file with any custom step we have and put the file under the root of repository.
There is another simpler way which is using a file with the filename “.deployment” at the root of repository. Then in the content of the file, we can specify our command to run during deployment as follows.
[config]
command = THE COMMAND TO RUN FOR DEPLOYMENT
To learn more about Kudu, please watch the following video clip from Channel 9.
References
If you would like to read more about the topics above, please refer to following websites.
- Continuous Deployment to Azure App Service (October 2016)
- Local Git Deployment to Azure App Service (June 2016)
- Azure App Service Continuous Delivery (November 2016)
- Channel 9: What is Kudu? (November 2013)
- Kudu Github Repo
- Customizing Deployments (August 2016)
- Custom Deployment Script (December 2016)
- Using Kudu with Microsoft Azure Web Apps (March 2014)
- Using Custom Deployment Scripts with Windows Azure Websites (Jun 2014)
- Using Kudu to Capture Hang Dumps for Windows Azure Web Sites (July 2013)