It looks that this is not available over REST API (yet). However, this is really strange, because if you hit get build endpoint:
https://dev.azure.com/{{organization}}/{{project}}/_apis/build/builds/826?api-version=6.0-preview.6&expand=all
in link section you will find sourceVersionDisplayUri
"_links": {
"self": {
"href": "https://dev.azure.com/thecodemanual/4fa6b279-3db9-4cb0-aab8-e06c2ad550b2/_apis/build/Builds/826"
},
"web": {
"href": "https://dev.azure.com/thecodemanual/4fa6b279-3db9-4cb0-aab8-e06c2ad550b2/_build/results?buildId=826"
},
"sourceVersionDisplayUri": {
"href": "https://dev.azure.com/thecodemanual/4fa6b279-3db9-4cb0-aab8-e06c2ad550b2/_apis/build/builds/826/sources"
},
"timeline": {
"href": "https://dev.azure.com/thecodemanual/4fa6b279-3db9-4cb0-aab8-e06c2ad550b2/_apis/build/builds/826/Timeline"
},
"badge": {
"href": "https://dev.azure.com/thecodemanual/4fa6b279-3db9-4cb0-aab8-e06c2ad550b2/_apis/build/status/43"
}
},
but the URL redirects you to commit which actually trigerred a build.
It still possible to get commits and repos from the logs
https://dev.azure.com/{{organization}}/{{project}}/_apis/build/builds/826/logs/6?api-version=6.0-preview.2
But for that you need to get trough them and parse responses:
2020-05-08T11:13:04.3354990Z Syncing repository: kmadof/devops-templates (github)
.
.
.
.
2020-05-08T11:13:03.3810662Z ##[command]git checkout --progress --force 24602dc40710a53502d306d1d41d3bca3c9a9b80
2020-05-08T11:13:03.3816465Z Note: switching to '24602dc40710a53502d306d1d41d3bca3c9a9b80'.
2020-05-08T11:13:05.1455197Z ##[command]git checkout --progress --force 0d79e869239bbf0087492ac2cda3a59e9ef11a39
2020-05-08T11:13:05.1458382Z Note: switching to '0d79e869239bbf0087492ac2cda3a59e9ef11a39'.