Azure website and Git commit id

Is there a way to find the id of the commit used in an automated git deployment to an Azure website?

Particularly, after that deployment has been swapped in to another deployment slot (which is NOT configured for auto-git deployment).

  • Visual Studio Online isn't deploying .js files from TypeScript compilation to Azure
  • Deploy Orchard.Source to Azure via GIT
  • How can I only publish a subfolder to my Azure Website?
  • How can I automatically push code to Azure WebSites when I push to my BitBucket GIT Repository?
  • Continuous Deployment of VSTS app with Git submodules fails on Azure
  • How to set build type(Release/Debug) for Continuous deployment using GIT in Azure App Service
  • EDIT: Preferably a programmatic way, but visible in either portal would be a good start.

  • create a composer package on packigist with bitbucket
  • Restore Git History / Repo From Local .git Folder
  • Git push: change on a branch doesn't always trigger Jenkins to run
  • Clone submodule into directory
  • Reduce increasing time to push a subtree
  • why git svn clone failed when using cygwin?
  • 2 Solutions collect form web for “Azure website and Git commit id”

    sending a request to
    https://<yourSiteName>.scm.azurewebsites.net/api/deployments

    should get you an array of objects that look like this

    {
      "id":"3a706bb8f1e39b1f01f1911c1440d31077c90e8e",
      "status":4,
      "status_text":"",
      "author_email":"name@example.com",
      "author":"FistName LastName",
      "deployer":"userName",
      "message":"Site updated: 2015-02-12 00:00:00",
      "progress":"",
      "received_time":"2015-02-12T00:00:00Z",
      "start_time":"2015-02-12T00:00:00Z",
      "end_time":"2015-02-12T00:00:00Z",
      "last_success_end_time":"2015-02-12T00:00:00Z",
      "complete":true,
      "active":true,
      "is_temp":false,
      "is_readonly":false,
      "url":"https://<yourSiteName>.scm.azurewebsites.net/api/deployments/3a706bb8f1e39b1f01f1911c1440d31077c90e8e",
      "log_url":"https://<yourSiteName>.scm.azurewebsites.net/api/deployments/3a706bb8f1e39b1f01f1911c1440d31077c90e8e/log",
      "site_name":"yourSiteName"
    }
    

    with "id" being the commit id that was used for a deployment.

    If you didn’t want to call the API, you could do this with a Post Deployment Action Hook.

    running a commit like this will get you the hash:

    git log -1 | sed -n '/commit/p'
    

    You will need to figure out how you’d want to store it in order to access it. Options include environment variable or text file.

    Git Baby is a git and github fan, let's start git clone.