TC Fox
TC Fox

Reputation: 1030

Get latest deployed git commit version in Azure App Service with GitHub deployment

I have an Azure App Service website built in ASP.NET Core which is being automatically deployed via GitHub integration. Every time I commit to a particular branch in GitHub, the app automagically deploys to my chosen App Service slot.

I would like the app to display the latest deployed git commit version and (optionally) the git commit comment. Is there some way I can get my app to retrieve this information about itself? I can't seem to find any useful information in the Environment Variables as it's running in Azure App Service (aside from "APPSETTING_ScmType", which is set to "GitHub"). I suspect this information can be found (as it is displayed in the Azure Portal), I just don't know how to get at it.

If it helps, I'm running this on a Standard Plan, and testing this feature in a App Service Slot.

Upvotes: 1

Views: 1572

Answers (1)

David Ebbo
David Ebbo

Reputation: 43193

You can read the commit id from the file %home%\site\deployments\active. See https://github.com/projectkudu/kudu/issues/1336 for more discussion on this topic.

Upvotes: 2

Related Questions