Simple way of obtaining deployment information from CI in an Azure App Service (ReleaseId, BuildId, CommitId, ReleaseName, RepoName)
Super simple ClassLibrary for Azure App Service (Linux Web Apps, Function Apps, Windows Web Apps, Web Jobs) to get the (current) deployment information
- DeploymentID
- BuildId
- ReleaseId
- ReleaseName
- BuildNumber
- ReleaseNumber
- CommitId
- RepoName
- RepoProvider
- SlotName
Install the NugetPackage Sustainable.Web.DeploymentInfo
To get the full Deployment object for the current deployment, simply do:
var deployment = DeploymentInfo.DeploymentInfo.CurrentDeployment;
For a quick and dirty full assembly version with ReleaseName tagged on do this:
using DeploymentInfo;
public class Startup {
public void Configure() {
//...
var version = DeploymentInfo.DeploymentInfo.CurrentDeployment.GetFullAzureDeploymentVersion<Startup>();
// this generic Startup reference is so we do not have to discuss the
// executing assembly or referencing assembly, we just take it
// from the current class type
//...
}
}