You can configure the Release Gate to verify the status of a specific health check (e.g., a specific database connection) rather than the global status.
1. Application Configuration
Because the Release Gate relies on HTTP 200 OK to succeed, you must override the default behavior where an Unhealthy status returns an HTTP 503. You must configure your application to return HTTP 200 even for Degraded or Unhealthy statuses so the gate can parse the JSON response to find the specific check's status.
Important: If you need a general health check that fails on HTTP 503 for other purposes, you must define a separate endpoint with default ResultStatusCodes behavior.
2. Task Configuration
In the Azure DevOps task, provide:
- Display name: A name for the Release Gate.
- Url for Asp.Net Core Health Check: The full URL of your health check endpoint.
- Name of check to verify: The exact name of the health check configured in your ASP.NET Core application (e.g.,
sqlserver). - Value of healthy response for the check to verify: The expected status string (default is
Healthy when using **Health Check UI`).
app.UseHealthChecks("/healthz", new HealthCheckOptions()
{
Predicate = _ => true,
ResponseWriter = UIResponseWriter.WriteHealthCheckUIResponse,
ResultStatusCodes =
{
[HealthStatus.Healthy] = StatusCodes.Status200OK,
[HealthStatus.Degraded] = StatusCodes.Status200OK,
[HealthStatus.Unhealthy] = StatusCodes.Status200OK
}
});