Repository: Azure/data-api-builder
Pull request #2667: [Health]: Test Case for Rest and GraphQL Requests to DAB during health check
Author: login: sezal98
Created: 2025-04-28T11:41:31Z | Merged: 2025-05-15T03:51:41Z

## Why make this change?
Resolves #2662 

## What is this change?
1. Created the HttpUtilities with HttpClient already instantiated and basic details filled from Startup.cs
2. Using this httpClient, call the REST and GraphQL requests with relative URI 
3. Created a function in DatabaseObject to access mapping dict as it is an abstract class which was not allowed to be mocked. 
4. Test cases for both REST and GraphQL
5. Rest Test case: Mock the client to return a 200 response when we receive a GET request with specific URI. Validate the error message from HttpUtilities should be null.
6. GraphQL Test case: Mock the client to return a 200 response when we get a POST request with /graphql URI and content payload. Mock the Dabase Object with columns in the entity map to only return the db object when a certain entity is called for. 


## How was this tested?

- [ ] Integration Tests
- [x] Unit Tests

## Sample Request(s)
Requests are running as expected. Test cases added for Rest and Graphql


Linked issue #2662: [HealthEndpoint] Test cases for GraphQL and REST in Health Check Report
The testing for Health Endpoint is failing for GraphQL and Rest calls with the error `One or more errors occurred. (No connection could be made because the target machine actively refused it. (localhost:5000)`. This is due to an in memory server running and not an http server for internal calls to work on http://localhost endpoint. 
We need to modify the HttpUtilities to pass the HttpClient from the Startup.cs and use the client from the factory instead of creating new. 

But if /health internally calls /api and /graphql, and you're using the same in-memory TestServer, you might hit issues like:

- Loopbacks not working: Since the same server is handling the request and the internal call, it could cause reentrancy issues or socket errors.
- Your test app is running in-memory (via TestServer or WebApplicationFactory), and not actually listening on a real network port.

Boot up your app in-memory for integration tests.
Run your app in-memory via test code, likely using WebApplicationFactory, TestServer, or similar.
That means: Your app should be bound to an external port like [http://localhost:80](http://localhost/)
Instead of in-memory (via the HttpClient returned from factory.CreateClient())
You need to inject the HttpClient from the test context into your health check logic, so it uses the in-memory test server instead of trying to call a real external address.

Diff:
diff --git a/src/Config/DatabasePrimitives/DatabaseObject.cs b/src/Config/DatabasePrimitives/DatabaseObject.cs
index 6e0db9d8b8..f3714cd1b0 100644
--- a/src/Config/DatabasePrimitives/DatabaseObject.cs
+++ b/src/Config/DatabasePrimitives/DatabaseObject.cs
@@ -55,7 +55,7 @@ public override int GetHashCode()
     /// <summary>
     /// Get the underlying SourceDefinition based on database object source type
     /// </summary>
-    public SourceDefinition SourceDefinition
+    public virtual SourceDefinition SourceDefinition
     {
         get
         {
diff --git a/src/Core/Services/MetadataProviders/ISqlMetadataProvider.cs b/src/Core/Services/MetadataProviders/ISqlMetadataProvider.cs
index 581f8a80bc..83989b645a 100644
--- a/src/Core/Services/MetadataProviders/ISqlMetadataProvider.cs
+++ b/src/Core/Services/MetadataProviders/ISqlMetadataProvider.cs
@@ -121,7 +121,7 @@ bool VerifyForeignKeyExistsInDB(
         /// </summary>
         /// <param name="entityName">The entity whose mapping we lookup.</param>
         /// <param name="field">The field used for the lookup in the mapping.</param>
-        /// <param name="name"/>Out parameter in which we will save backing column name.<param>
+        /// <param name="name"/>Out parameter in which we will save backing column name.</param>
         /// <returns>True if exists, false otherwise.</returns>
         /// <throws>KeyNotFoundException if entity name not found.</throws>
         bool TryGetBackingColumn(string entityName, string field, [NotNullWhen(true)] out string? name);
@@ -132,6 +132,16 @@ bool VerifyForeignKeyExistsInDB(
         /// <returns></returns>
         DatabaseType GetDatabaseType();
 
+        /// <summary>
+        /// Method to access the dictionary since DatabaseObject is abstract class
+        /// </summary>
+        /// <param name="key">Key.</param>
+        /// <returns>DatabaseObject.</returns>
+        public virtual DatabaseObject GetDatabaseObjectByKey(string key)
+        {
+            return EntityToDatabaseObject[key];
+        }
+
         IQueryBuilder GetQueryBuilder();
 
         /// <summary>
diff --git a/src/Service.Tests/Configuration/ConfigurationTests.cs b/src/Service.Tests/Configuration/ConfigurationTests.cs
index d0c9058ad4..3b79aaf9be 100644
--- a/src/Service.Tests/Configuration/ConfigurationTests.cs
+++ b/src/Service.Tests/Configuration/ConfigurationTests.cs
@@ -20,7 +20,6 @@
 using System.Web;
 using Azure.DataApiBuilder.Auth;
 using Azure.DataApiBuilder.Config;
-using Azure.DataApiBuilder.Config.HealthCheck;
 using Azure.DataApiBuilder.Config.ObjectModel;
 using Azure.DataApiBuilder.Core;
 using Azure.DataApiBuilder.Core.AuthenticationHelpers;
@@ -4018,221 +4017,7 @@ public async Task HealthEndpoint_ValidateContents()
             Dictionary<string, JsonElement> responseProperties = JsonSerializer.Deserialize<Dictionary<string, JsonElement>>(responseBody);
             Assert.AreEqual(expected: HttpStatusCode.OK, actual: response.StatusCode, message: "Received unexpected HTTP code from health check endpoint.");
 
-            ValidateBasicDetailsHealthCheckResponse(responseProperties);
-        }
-
-        /// <summary>
-        /// Simulates a GET request to DAB's comprehensive health check endpoint ('/health') and validates the contents of the response.
-        /// The expected format of the response is the comprehensive health check response.
-        /// This test is currently flakey, failing intermittently in our pipeline, and is therefore ignored.
-        /// </summary>
-        [Ignore]
-        [TestMethod]
-        [TestCategory(TestCategory.MSSQL)]
-        [DataRow(true, true, true, true, true, true, true, DisplayName = "Validate Health Report all enabled.")]
-        [DataRow(false, true, true, true, true, true, true, DisplayName = "Validate when Comprehensive Health Report is disabled")]
-        [DataRow(true, true, true, false, true, true, true, DisplayName = "Validate Health Report when data-source health is disabled")]
-        [DataRow(true, true, true, true, false, true, true, DisplayName = "Validate Health Report when entity health is disabled")]
-        [DataRow(true, false, true, true, true, true, true, DisplayName = "Validate Health Report when global rest health is disabled")]
-        [DataRow(true, true, true, true, true, false, true, DisplayName = "Validate Health Report when entity rest health is disabled")]
-        [DataRow(true, true, false, true, true, true, true, DisplayName = "Validate Health Report when global graphql health is disabled")]
-        [DataRow(true, true, true, true, true, true, false, DisplayName = "Validate Health Report when entity graphql health is disabled")]
-        public async Task ComprehensiveHealthEndpoint_ValidateContents(bool enableGlobalHealth, bool enableGlobalRest, bool enableGlobalGraphql, bool enableDatasourceHealth, bool enableEntityHealth, bool enableEntityRest, bool enableEntityGraphQL)
-        {
-            // Arrange
-            // At least one entity is required in the runtime config for the engine to start.
-            // Even though this entity is not under test, it must be supplied enable successful
-            // config file creation.
-            Entity requiredEntity = new(
-                Health: new(enabled: enableEntityHealth),
-                Source: new("books", EntitySourceType.Table, null, null),
-                Rest: new(Enabled: enableEntityRest),
-                GraphQL: new("book", "books", enableEntityGraphQL),
-                Permissions: new[] { GetMinimalPermissionConfig(AuthorizationResolver.ROLE_ANONYMOUS) },
-                Relationships: null,
-                Mappings: null);
-
-            Dictionary<string, Entity> entityMap = new()
-            {
-                { "Book", requiredEntity }
-            };
-
-            CreateCustomConfigFile(entityMap, enableGlobalRest, enableGlobalGraphql, enableGlobalHealth, enableDatasourceHealth, HostMode.Development);
-
-            string[] args = new[]
-            {
-                $"--ConfigFileName={CUSTOM_CONFIG_FILENAME}"
-            };
-
-            using (TestServer server = new(Program.CreateWebHostBuilder(args)))
-            using (HttpClient client = server.CreateClient())
-            {
-                HttpRequestMessage healthRequest = new(HttpMethod.Get, "/health");
-                HttpResponseMessage response = await client.SendAsync(healthRequest);
-
-                if (!enableGlobalHealth)
-                {
-                    Assert.AreEqual(expected: HttpStatusCode.NotFound, actual: response.StatusCode, message: "Received unexpected HTTP code from health check endpoint.");
-                }
-                else
-                {
-                    string responseBody = await response.Content.ReadAsStringAsync();
-                    Dictionary<string, JsonElement> responseProperties = JsonSerializer.Deserialize<Dictionary<string, JsonElement>>(responseBody);
-                    Assert.AreEqual(expected: HttpStatusCode.OK, actual: response.StatusCode, message: "Received unexpected HTTP code from health check endpoint.");
-
-                    ValidateBasicDetailsHealthCheckResponse(responseProperties);
-                    ValidateConfigurationDetailsHealthCheckResponse(responseProperties, enableGlobalRest, enableGlobalGraphql);
-                    ValidateIfAttributePresentInResponse(responseProperties, enableDatasourceHealth, HealthCheckConstants.DATASOURCE);
-                    ValidateIfAttributePresentInResponse(responseProperties, enableEntityHealth, HealthCheckConstants.ENDPOINT);
-                    if (enableEntityHealth)
-                    {
-                        ValidateEntityRestAndGraphQLResponse(responseProperties, enableEntityRest, enableEntityGraphQL, enableGlobalRest, enableGlobalGraphql);
-                    }
-                }
-            }
-        }
-
-        private static void ValidateEntityRestAndGraphQLResponse(
-            Dictionary<string, JsonElement> responseProperties,
-            bool enableEntityRest,
-            bool enableEntityGraphQL,
-            bool enableGlobalRest,
-            bool enableGlobalGraphQL)
-        {
-            bool hasRestTag = false, hasGraphQLTag = false;
-            if (responseProperties.TryGetValue("checks", out JsonElement checksElement) && checksElement.ValueKind == JsonValueKind.Array)
-            {
-                checksElement.EnumerateArray().ToList().ForEach(entityCheck =>
-                {
-                    // Check if the 'tags' property exists and is of type array
-                    if (entityCheck.TryGetProperty("tags", out JsonElement tagsElement) && tagsElement.ValueKind == JsonValueKind.Array)
-                    {
-                        hasRestTag = hasRestTag || tagsElement.EnumerateArray().Any(tag => tag.ToString() == HealthCheckConstants.REST);
-                        hasGraphQLTag = hasGraphQLTag || tagsElement.EnumerateArray().Any(tag => tag.ToString() == HealthCheckConstants.GRAPHQL);
-                    }
-                });
-
-                if (enableGlobalRest)
-                {
-                    // When both enableEntityRest and hasRestTag match the same value
-                    Assert.AreEqual(enableEntityRest, hasRestTag);
-                }
-                else
-                {
-                    Assert.IsFalse(hasRestTag);
-                }
-
-                if (enableGlobalGraphQL)
-                {
-                    // When both enableEntityGraphQL and hasGraphQLTag match the same value
-                    Assert.AreEqual(enableEntityGraphQL, hasGraphQLTag);
-                }
-                else
-                {
-                    Assert.IsFalse(hasGraphQLTag);
-                }
-            }
-        }
-
-        private static void ValidateIfAttributePresentInResponse(
-            Dictionary<string, JsonElement> responseProperties,
-            bool enableFlag,
-            string checkString)
-        {
-            if (responseProperties.TryGetValue("checks", out JsonElement checksElement) && checksElement.ValueKind == JsonValueKind.Array)
-            {
-                bool checksTags = checksElement.EnumerateArray().Any(entityCheck =>
-                {
-                    if (entityCheck.TryGetProperty("tags", out JsonElement tagsElement) && tagsElement.ValueKind == JsonValueKind.Array)
-                    {
-                        return tagsElement.EnumerateArray().Any(tag => tag.ToString() == checkString);
-                    }
-
-                    return false;
-                });
-
-                Assert.AreEqual(enableFlag, checksTags);
-            }
-            else
-            {
-                Assert.Fail("Checks array is not present in the Comprehensive Health Check Report.");
-            }
-        }
-
-        private static void ValidateConfigurationIsNotNull(Dictionary<string, JsonElement> configPropertyValues, string objectKey)
-        {
-            Assert.IsTrue(configPropertyValues.ContainsKey(objectKey), $"Expected {objectKey} to be present in the configuration object.");
-            Assert.IsNotNull(configPropertyValues[objectKey], $"Expected {objectKey} to be non-null.");
-        }
-
-        private static void ValidateConfigurationIsCorrectFlag(Dictionary<string, JsonElement> configElement, string objectKey, bool enableFlag)
-        {
-            Assert.AreEqual(enableFlag, configElement[objectKey].GetBoolean(), $"Expected {objectKey} to be set to {enableFlag}.");
-        }
-
-        private static void ValidateConfigurationDetailsHealthCheckResponse(Dictionary<string, JsonElement> responseProperties, bool enableGlobalRest, bool enableGlobalGraphQL)
-        {
-            if (responseProperties.TryGetValue("configuration", out JsonElement configElement) && configElement.ValueKind == JsonValueKind.Object)
-            {
-                Dictionary<string, JsonElement> configPropertyValues = new();
-
-                // Enumerate through the configProperty's object properties and add them to the dictionary
-                foreach (JsonProperty property in configElement.EnumerateObject().ToList())
-                {
-                    configPropertyValues[property.Name] = property.Value;
-                }
-
-                ValidateConfigurationIsNotNull(configPropertyValues, "rest");
-                ValidateConfigurationIsCorrectFlag(configPropertyValues, "rest", enableGlobalRest);
-                ValidateConfigurationIsNotNull(configPropertyValues, "graphql");
-                ValidateConfigurationIsCorrectFlag(configPropertyValues, "graphql", enableGlobalGraphQL);
-                ValidateConfigurationIsNotNull(configPropertyValues, "caching");
-                ValidateConfigurationIsNotNull(configPropertyValues, "telemetry");
-                ValidateConfigurationIsNotNull(configPropertyValues, "mode");
-            }
-            else
-            {
-                Assert.Fail("Missing 'configuration' object in Health Check Response.");
-            }
-        }
-
-        private static void ValidateBasicDetailsHealthCheckResponse(Dictionary<string, JsonElement> responseProperties)
-        {
-            // Validate value of 'status' property in reponse.
-            if (responseProperties.TryGetValue(key: "status", out JsonElement statusValue))
-            {
-                Assert.IsTrue(statusValue.ValueKind == JsonValueKind.String, "Unexpected or missing status value as string.");
-            }
-            else
-            {
-                Assert.Fail();
-            }
-
-            // Validate value of 'version' property in response.
-            if (responseProperties.TryGetValue(key: BasicHealthCheck.DAB_VERSION_KEY, out JsonElement versionValue))
-            {
-                Assert.AreEqual(
-                    expected: ProductInfo.GetProductVersion(),
-                    actual: versionValue.ToString(),
-                    message: "Unexpected or missing version value.");
-            }
-            else
-            {
-                Assert.Fail();
-            }
-
-            // Validate value of 'app-name' property in response.
-            if (responseProperties.TryGetValue(key: BasicHealthCheck.DAB_APPNAME_KEY, out JsonElement appNameValue))
-            {
-                Assert.AreEqual(
-                    expected: ProductInfo.GetDataApiBuilderUserAgent(),
-                    actual: appNameValue.ToString(),
-                    message: "Unexpected or missing DAB user agent string.");
-            }
-            else
-            {
-                Assert.Fail();
-            }
+            HealthEndpointTests.ValidateBasicDetailsHealthCheckResponse(responseProperties);
         }
 
         /// <summary>
@@ -4670,22 +4455,20 @@ public async Task TestNoDepthLimitOnGrahQLInNonHostedMode(int? depthLimit)
         /// </summary>
         /// <param name="entityMap">Collection of entityName -> Entity object.</param>
         /// <param name="enableGlobalRest">flag to enable or disabled REST globally.</param>
-        private static void CreateCustomConfigFile(Dictionary<string, Entity> entityMap, bool enableGlobalRest = true, bool enableGlobalGraphql = true, bool enableGlobalHealth = true, bool enableDatasourceHealth = true, HostMode hostMode = HostMode.Production)
+        private static void CreateCustomConfigFile(Dictionary<string, Entity> entityMap, bool enableGlobalRest = true)
         {
             DataSource dataSource = new(
                 DatabaseType.MSSQL,
                 GetConnectionStringFromEnvironmentConfig(environment: TestCategory.MSSQL),
-                Options: null,
-                Health: new(enableDatasourceHealth));
-            HostOptions hostOptions = new(Mode: hostMode, Cors: null, Authentication: new() { Provider = nameof(EasyAuthType.StaticWebApps) });
+                Options: null);
+            HostOptions hostOptions = new(Cors: null, Authentication: new() { Provider = nameof(EasyAuthType.StaticWebApps) });
 
             RuntimeConfig runtimeConfig = new(
                 Schema: string.Empty,
                 DataSource: dataSource,
                 Runtime: new(
-                    Health: new(enabled: enableGlobalHealth),
                     Rest: new(Enabled: enableGlobalRest),
-                    GraphQL: new(Enabled: enableGlobalGraphql),
+                    GraphQL: new(Enabled: true),
                     Host: hostOptions
                 ),
                 Entities: new(entityMap));
diff --git a/src/Service.Tests/Configuration/HealthEndpointTests.cs b/src/Service.Tests/Configuration/HealthEndpointTests.cs
new file mode 100644
index 0000000000..c765a837b7
--- /dev/null
+++ b/src/Service.Tests/Configuration/HealthEndpointTests.cs
@@ -0,0 +1,514 @@
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT License.
+
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.IO.Abstractions.TestingHelpers;
+using System.Linq;
+using System.Net;
+using System.Net.Http;
+using System.Text.Json;
+using System.Threading;
+using System.Threading.Tasks;
+using Azure.DataApiBuilder.Config;
+using Azure.DataApiBuilder.Config.DatabasePrimitives;
+using Azure.DataApiBuilder.Config.HealthCheck;
+using Azure.DataApiBuilder.Config.ObjectModel;
+using Azure.DataApiBuilder.Core.Authorization;
+using Azure.DataApiBuilder.Core.Configurations;
+using Azure.DataApiBuilder.Core.Services;
+using Azure.DataApiBuilder.Core.Services.MetadataProviders;
+using Azure.DataApiBuilder.Product;
+using Azure.DataApiBuilder.Service.HealthCheck;
+using Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.TestHost;
+using Microsoft.Extensions.Logging;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Moq;
+using Moq.Protected;
+
+namespace Azure.DataApiBuilder.Service.Tests.Configuration
+{
+    [TestClass]
+    public class HealthEndpointTests
+    {
+        private const string CUSTOM_CONFIG_FILENAME = "custom_config.json";
+        private const string BASE_DAB_URL = "http://localhost:5000";
+
+        [TestCleanup]
+        public void CleanupAfterEachTest()
+        {
+            if (File.Exists(CUSTOM_CONFIG_FILENAME))
+            {
+                File.Delete(CUSTOM_CONFIG_FILENAME);
+            }
+
+            TestHelper.UnsetAllDABEnvironmentVariables();
+        }
+
+        /// <summary>
+        /// Simulates a GET request to DAB's comprehensive health check endpoint ('/health') and validates the contents of the response.
+        /// The expected format of the response is the comprehensive health check response.
+        /// </summary>
+        [TestMethod]
+        [TestCategory(TestCategory.MSSQL)]
+        [DataRow(true, true, true, true, true, true, true, DisplayName = "Validate Health Report all enabled.")]
+        [DataRow(false, true, true, true, true, true, true, DisplayName = "Validate when Comprehensive Health Report is disabled")]
+        [DataRow(true, true, true, false, true, true, true, DisplayName = "Validate Health Report when data-source health is disabled")]
+        [DataRow(true, true, true, true, false, true, true, DisplayName = "Validate Health Report when entity health is disabled")]
+        [DataRow(true, false, true, true, true, true, true, DisplayName = "Validate Health Report when global rest health is disabled")]
+        [DataRow(true, true, true, true, true, false, true, DisplayName = "Validate Health Report when entity rest health is disabled")]
+        [DataRow(true, true, false, true, true, true, true, DisplayName = "Validate Health Report when global graphql health is disabled")]
+        [DataRow(true, true, true, true, true, true, false, DisplayName = "Validate Health Report when entity graphql health is disabled")]
+        public async Task ComprehensiveHealthEndpoint_ValidateContents(bool enableGlobalHealth, bool enableGlobalRest, bool enableGlobalGraphql, bool enableDatasourceHealth, bool enableEntityHealth, bool enableEntityRest, bool enableEntityGraphQL)
+        {
+            // Arrange
+            // Create a mock entity map with a single entity for testing
+            RuntimeConfig runtimeConfig = SetupCustomConfigFile(enableGlobalHealth, enableGlobalRest, enableGlobalGraphql, enableDatasourceHealth, enableEntityHealth, enableEntityRest, enableEntityGraphQL);
+            WriteToCustomConfigFile(runtimeConfig);
+
+            string[] args = new[]
+            {
+                $"--ConfigFileName={CUSTOM_CONFIG_FILENAME}"
+            };
+
+            using (TestServer server = new(Program.CreateWebHostBuilder(args)))
+            using (HttpClient client = server.CreateClient())
+            {
+                HttpRequestMessage healthRequest = new(HttpMethod.Get, $"{BASE_DAB_URL}/health");
+                HttpResponseMessage response = await client.SendAsync(healthRequest);
+
+                if (!enableGlobalHealth)
+                {
+                    Assert.AreEqual(expected: HttpStatusCode.NotFound, actual: response.StatusCode, message: "Received unexpected HTTP code from health check endpoint.");
+                }
+                else
+                {
+                    string responseBody = await response.Content.ReadAsStringAsync();
+                    Dictionary<string, JsonElement> responseProperties = JsonSerializer.Deserialize<Dictionary<string, JsonElement>>(responseBody);
+                    Assert.AreEqual(expected: HttpStatusCode.OK, actual: response.StatusCode, message: "Received unexpected HTTP code from health check endpoint.");
+
+                    ValidateBasicDetailsHealthCheckResponse(responseProperties);
+                    ValidateConfigurationDetailsHealthCheckResponse(responseProperties, enableGlobalRest, enableGlobalGraphql);
+                    ValidateIfAttributePresentInResponse(responseProperties, enableDatasourceHealth, HealthCheckConstants.DATASOURCE);
+                    ValidateIfAttributePresentInResponse(responseProperties, enableEntityHealth, HealthCheckConstants.ENDPOINT);
+                    if (enableEntityHealth)
+                    {
+                        ValidateEntityRestAndGraphQLResponse(responseProperties, enableEntityRest, enableEntityGraphQL, enableGlobalRest, enableGlobalGraphql);
+                    }
+                }
+            }
+        }
+
+        /// <summary>
+        /// Simulates the function call to HttpUtilities.ExecuteRestQueryAsync.
+        /// while setting up mock HTTP client to simulate the response from the server to send OK code.
+        /// Validates the response to ensure no error message is received.
+        /// </summary>
+        [TestMethod]
+        public async Task TestHealthCheckRestResponseAsync()
+        {
+            // Arrange
+            RuntimeConfig runtimeConfig = SetupCustomConfigFile(true, true, true, true, true, true, true);
+            HttpUtilities httpUtilities = SetupRestTest(runtimeConfig);
+
+            // Act
+            // Call the ExecuteRestQuery method with the mock HttpClient
+            // Simulate a REST API call to the endpoint
+            // Response should be null as error message is not expected to be returned
+            string errorMessageFromRest = await httpUtilities.ExecuteRestQueryAsync(
+                restUriSuffix: runtimeConfig.RestPath,
+                entityName: runtimeConfig.Entities.First().Key,
+                first: runtimeConfig.Entities.First().Value.Health.First,
+                incomingRoleHeader: string.Empty,
+                incomingRoleToken: string.Empty
+            );
+
+            // Assert
+            // Validate the null response from the REST API call 
+            Assert.IsNull(errorMessageFromRest);
+        }
+
+        /// <summary>
+        /// Simulates the function call to HttpUtilities.ExecuteRestQueryAsync.
+        /// while setting up mock HTTP client to simulate the response from the server to send BadRequest code.
+        /// Validates the response to ensure error message is received.
+        /// </summary>
+        [TestMethod]
+        public async Task TestFailureHealthCheckRestResponseAsync()
+        {
+            // Arrange
+            RuntimeConfig runtimeConfig = SetupCustomConfigFile(true, true, true, true, true, true, true);
+            HttpUtilities httpUtilities = SetupGraphQLTest(runtimeConfig, HttpStatusCode.BadRequest);
+
+            // Act
+            // Call the ExecuteRestQuery method with the mock HttpClient
+            // Simulate a REST API call to the endpoint
+            // Response should be null as error message is not expected to be returned
+            string errorMessageFromRest = await httpUtilities.ExecuteRestQueryAsync(
+                restUriSuffix: runtimeConfig.RestPath,
+                entityName: runtimeConfig.Entities.First().Key,
+                first: runtimeConfig.Entities.First().Value.Health.First,
+                incomingRoleHeader: string.Empty,
+                incomingRoleToken: string.Empty
+            );
+
+            // Assert
+            Assert.IsNotNull(errorMessageFromRest);
+        }
+
+        /// <summary>
+        /// Simulates the function call to HttpUtilities.ExecuteGraphQLQueryAsync.
+        /// while setting up mock HTTP client to simulate the response from the server to send OK code.
+        /// Validates the response to ensure no error message is received.
+        /// </summary>
+        [TestMethod]
+        public async Task TestHealthCheckGraphQLResponseAsync()
+        {
+            // Arrange
+            RuntimeConfig runtimeConfig = SetupCustomConfigFile(true, true, true, true, true, true, true);
+            HttpUtilities httpUtilities = SetupGraphQLTest(runtimeConfig);
+
+            // Act
+            string errorMessageFromGraphQL = await httpUtilities.ExecuteGraphQLQueryAsync(
+                graphqlUriSuffix: "/graphql",
+                entityName: runtimeConfig.Entities.First().Key,
+                entity: runtimeConfig.Entities.First().Value,
+                incomingRoleHeader: string.Empty,
+                incomingRoleToken: string.Empty);
+
+            // Assert
+            Assert.IsNull(errorMessageFromGraphQL);
+        }
+
+        /// <summary>
+        /// Simulates the function call to HttpUtilities.ExecuteGraphQLQueryAsync.
+        /// while setting up mock HTTP client to simulate the response from the server to send InternalServerError code.
+        /// Validates the response to ensure error message is received.
+        /// </summary>
+        [TestMethod]
+        public async Task TestFailureHealthCheckGraphQLResponseAsync()
+        {
+            // Arrange
+            RuntimeConfig runtimeConfig = SetupCustomConfigFile(true, true, true, true, true, true, true);
+            HttpUtilities httpUtilities = SetupGraphQLTest(runtimeConfig, HttpStatusCode.InternalServerError);
+
+            // Act
+            string errorMessageFromGraphQL = await httpUtilities.ExecuteGraphQLQueryAsync(
+                graphqlUriSuffix: "/graphql",
+                entityName: runtimeConfig.Entities.First().Key,
+                entity: runtimeConfig.Entities.First().Value,
+                incomingRoleHeader: string.Empty,
+                incomingRoleToken: string.Empty);
+
+            // Assert
+            Assert.IsNotNull(errorMessageFromGraphQL);
+        }
+
+        #region Helper Methods
+        private static HttpUtilities SetupRestTest(RuntimeConfig runtimeConfig, HttpStatusCode httpStatusCode = HttpStatusCode.OK)
+        {
+            // Arrange
+            // Create a mock entity map with a single entity for testing and load in RuntimeConfigProvider
+            Mock<IMetadataProviderFactory> metadataProviderFactory = new();
+            MockFileSystem fileSystem = new();
+            fileSystem.AddFile(FileSystemRuntimeConfigLoader.DEFAULT_CONFIG_FILE_NAME, new MockFileData(runtimeConfig.ToJson()));
+            FileSystemRuntimeConfigLoader loader = new(fileSystem);
+            RuntimeConfigProvider provider = new(loader);
+
+            // Create a Mock of HttpMessageHandler
+            Mock<HttpMessageHandler> mockHandler = new();
+            // Mocking the handler to return a specific response for SendAsync
+            mockHandler.Protected()
+                .Setup<Task<HttpResponseMessage>>(
+                    "SendAsync",
+                    ItExpr.Is<HttpRequestMessage>(req =>
+                        req.Method == HttpMethod.Get
+                        && req.RequestUri.Equals($"{BASE_DAB_URL}/{runtimeConfig.RestPath.Trim('/')}/{runtimeConfig.Entities.First().Key}?$first={runtimeConfig.Entities.First().Value.Health.First}")),
+                    ItExpr.IsAny<CancellationToken>())
+                .ReturnsAsync(new HttpResponseMessage(httpStatusCode)
+                {
+                    Content = new StringContent("{\"message\":\"Rest response\"}")
+                });
+
+            // Mocking IHttpClientFactory
+            Mock<IHttpClientFactory> mockHttpClientFactory = new();
+            mockHttpClientFactory.Setup(x => x.CreateClient("ContextConfiguredHealthCheckClient"))
+                .Returns(new HttpClient(mockHandler.Object)
+                {
+                    BaseAddress = new Uri($"{BASE_DAB_URL}")
+                });
+
+            Mock<ILogger<HttpUtilities>> _logger = new();
+
+            // Create the mock HttpContext to return the expected scheme and host
+            // when the ConfigureApiRoute method is called.
+            Mock<HttpContext> mockHttpContext = new();
+            Mock<HttpRequest> mockHttpRequest = new();
+            mockHttpRequest.Setup(r => r.Scheme).Returns("http");
+            mockHttpRequest.Setup(r => r.Host).Returns(new HostString("localhost", 5000));
+            mockHttpContext.Setup(c => c.Request).Returns(mockHttpRequest.Object);
+
+            return new(
+                _logger.Object,
+                metadataProviderFactory.Object,
+                provider,
+                mockHttpClientFactory.Object);
+        }
+
+        private static HttpUtilities SetupGraphQLTest(RuntimeConfig runtimeConfig, HttpStatusCode httpStatusCode = HttpStatusCode.OK)
+        {
+            // Arrange
+            // Create a mock entity map with a single entity for testing and load in RuntimeConfigProvider            
+            MockFileSystem fileSystem = new();
+            fileSystem.AddFile(FileSystemRuntimeConfigLoader.DEFAULT_CONFIG_FILE_NAME, new MockFileData(runtimeConfig.ToJson()));
+            FileSystemRuntimeConfigLoader loader = new(fileSystem);
+            RuntimeConfigProvider provider = new(loader);
+            Mock<IMetadataProviderFactory> metadataProviderFactory = new();
+            Mock<ISqlMetadataProvider> sqlMetadataProvider = new();
+
+            // Setup the mock database object with a source definition
+            SourceDefinition sourceDef = new();
+            sourceDef.Columns.Add("id", new ColumnDefinition());
+            sourceDef.Columns.Add("title", new ColumnDefinition());
+            // Mock DB Object to return the source definition
+            Mock<DatabaseObject> mockDbObject = new();
+            mockDbObject.SetupGet(x => x.SourceDefinition).Returns(sourceDef);
+            // Mocking the metadata provider to return the mock database object
+            sqlMetadataProvider.Setup(x => x.GetDatabaseObjectByKey(runtimeConfig.Entities.First().Key)).Returns(mockDbObject.Object);
+            metadataProviderFactory.Setup(x => x.GetMetadataProvider(It.IsAny<string>())).Returns(sqlMetadataProvider.Object);
+
+            Mock<HttpMessageHandler> mockHandler = new();
+            mockHandler.Protected()
+                .Setup<Task<HttpResponseMessage>>(
+                    "SendAsync",
+                    ItExpr.Is<HttpRequestMessage>(req =>
+                        req.Method == HttpMethod.Post &&
+                        req.RequestUri == new Uri($"{BASE_DAB_URL}/graphql") &&
+                        req.Content.ReadAsStringAsync().Result.Equals("{\"query\":\"{bookLists (first: 100) {items { id title }}}\"}")), // Use the correct GraphQL query format
+                    ItExpr.IsAny<CancellationToken>())
+                .ReturnsAsync(new HttpResponseMessage(httpStatusCode)
+                {
+                    Content = new StringContent("{\"errors\":[{\"message\":\"Internal Server Error\"}]}")
+                });
+
+            Mock<IHttpClientFactory> mockHttpClientFactory = new();
+            mockHttpClientFactory.Setup(x => x.CreateClient("ContextConfiguredHealthCheckClient"))
+                .Returns(new HttpClient(mockHandler.Object)
+                {
+                    BaseAddress = new Uri($"{BASE_DAB_URL}")
+                });
+
+            Mock<ILogger<HttpUtilities>> logger = new();
+
+            return new(
+                logger.Object,
+                metadataProviderFactory.Object,
+                provider,
+                mockHttpClientFactory.Object);
+        }
+
+        private static void ValidateEntityRestAndGraphQLResponse(
+            Dictionary<string, JsonElement> responseProperties,
+            bool enableEntityRest,
+            bool enableEntityGraphQL,
+            bool enableGlobalRest,
+            bool enableGlobalGraphQL)
+        {
+            bool hasRestTag = false, hasGraphQLTag = false;
+            if (responseProperties.TryGetValue("checks", out JsonElement checksElement) && checksElement.ValueKind == JsonValueKind.Array)
+            {
+                checksElement.EnumerateArray().ToList().ForEach(entityCheck =>
+                {
+                    // Check if the 'tags' property exists and is of type array
+                    if (entityCheck.TryGetProperty("tags", out JsonElement tagsElement) && tagsElement.ValueKind == JsonValueKind.Array)
+                    {
+                        hasRestTag = hasRestTag || tagsElement.EnumerateArray().Any(tag => tag.ToString() == HealthCheckConstants.REST);
+                        hasGraphQLTag = hasGraphQLTag || tagsElement.EnumerateArray().Any(tag => tag.ToString() == HealthCheckConstants.GRAPHQL);
+                    }
+                });
+
+                if (enableGlobalRest)
+                {
+                    // When both enableEntityRest and hasRestTag match the same value
+                    Assert.AreEqual(enableEntityRest, hasRestTag);
+                }
+                else
+                {
+                    Assert.IsFalse(hasRestTag);
+                }
+
+                if (enableGlobalGraphQL)
+                {
+                    // When both enableEntityGraphQL and hasGraphQLTag match the same value
+                    Assert.AreEqual(enableEntityGraphQL, hasGraphQLTag);
+                }
+                else
+                {
+                    Assert.IsFalse(hasGraphQLTag);
+                }
+            }
+        }
+
+        private static void ValidateIfAttributePresentInResponse(
+            Dictionary<string, JsonElement> responseProperties,
+            bool enableFlag,
+            string checkString)
+        {
+            if (responseProperties.TryGetValue("checks", out JsonElement checksElement) && checksElement.ValueKind == JsonValueKind.Array)
+            {
+                bool checksTags = checksElement.EnumerateArray().Any(entityCheck =>
+                {
+                    if (entityCheck.TryGetProperty("tags", out JsonElement tagsElement) && tagsElement.ValueKind == JsonValueKind.Array)
+                    {
+                        return tagsElement.EnumerateArray().Any(tag => tag.ToString() == checkString);
+                    }
+
+                    return false;
+                });
+
+                Assert.AreEqual(enableFlag, checksTags);
+            }
+            else
+            {
+                Assert.Fail("Checks array is not present in the Comprehensive Health Check Report.");
+            }
+        }
+
+        private static void ValidateConfigurationIsNotNull(Dictionary<string, JsonElement> configPropertyValues, string objectKey)
+        {
+            Assert.IsTrue(configPropertyValues.ContainsKey(objectKey), $"Expected {objectKey} to be present in the configuration object.");
+            Assert.IsNotNull(configPropertyValues[objectKey], $"Expected {objectKey} to be non-null.");
+        }
+
+        private static void ValidateConfigurationIsCorrectFlag(Dictionary<string, JsonElement> configElement, string objectKey, bool enableFlag)
+        {
+            Assert.AreEqual(enableFlag, configElement[objectKey].GetBoolean(), $"Expected {objectKey} to be set to {enableFlag}.");
+        }
+
+        private static void ValidateConfigurationDetailsHealthCheckResponse(Dictionary<string, JsonElement> responseProperties, bool enableGlobalRest, bool enableGlobalGraphQL)
+        {
+            if (responseProperties.TryGetValue("configuration", out JsonElement configElement) && configElement.ValueKind == JsonValueKind.Object)
+            {
+                Dictionary<string, JsonElement> configPropertyValues = new();
+
+                // Enumerate through the configProperty's object properties and add them to the dictionary
+                foreach (JsonProperty property in configElement.EnumerateObject().ToList())
+                {
+                    configPropertyValues[property.Name] = property.Value;
+                }
+
+                ValidateConfigurationIsNotNull(configPropertyValues, "rest");
+                ValidateConfigurationIsCorrectFlag(configPropertyValues, "rest", enableGlobalRest);
+                ValidateConfigurationIsNotNull(configPropertyValues, "graphql");
+                ValidateConfigurationIsCorrectFlag(configPropertyValues, "graphql", enableGlobalGraphQL);
+                ValidateConfigurationIsNotNull(configPropertyValues, "caching");
+                ValidateConfigurationIsNotNull(configPropertyValues, "telemetry");
+                ValidateConfigurationIsNotNull(configPropertyValues, "mode");
+            }
+            else
+            {
+                Assert.Fail("Missing 'configuration' object in Health Check Response.");
+            }
+        }
+
+        public static void ValidateBasicDetailsHealthCheckResponse(Dictionary<string, JsonElement> responseProperties)
+        {
+            // Validate value of 'status' property in response.
+            if (responseProperties.TryGetValue(key: "status", out JsonElement statusValue))
+            {
+                Assert.IsTrue(statusValue.ValueKind == JsonValueKind.String, "Unexpected or missing status value as string.");
+            }
+            else
+            {
+                Assert.Fail();
+            }
+
+            // Validate value of 'version' property in response.
+            if (responseProperties.TryGetValue(key: BasicHealthCheck.DAB_VERSION_KEY, out JsonElement versionValue))
+            {
+                Assert.AreEqual(
+                    expected: ProductInfo.GetProductVersion(),
+                    actual: versionValue.ToString(),
+                    message: "Unexpected or missing version value.");
+            }
+            else
+            {
+                Assert.Fail();
+            }
+
+            // Validate value of 'app-name' property in response.
+            if (responseProperties.TryGetValue(key: BasicHealthCheck.DAB_APPNAME_KEY, out JsonElement appNameValue))
+            {
+                Assert.AreEqual(
+                    expected: ProductInfo.GetDataApiBuilderUserAgent(),
+                    actual: appNameValue.ToString(),
+                    message: "Unexpected or missing DAB user agent string.");
+            }
+            else
+            {
+                Assert.Fail();
+            }
+        }
+
+        private static RuntimeConfig SetupCustomConfigFile(bool enableGlobalHealth, bool enableGlobalRest, bool enableGlobalGraphql, bool enableDatasourceHealth, bool enableEntityHealth, bool enableEntityRest, bool enableEntityGraphQL)
+        {
+            // At least one entity is required in the runtime config for the engine to start.
+            // Even though this entity is not under test, it must be supplied enable successful
+            // config file creation.
+            Entity requiredEntity = new(
+                Health: new(enabled: enableEntityHealth),
+                Source: new("books", EntitySourceType.Table, null, null),
+                Rest: new(Enabled: enableEntityRest),
+                GraphQL: new("book", "bookLists", enableEntityGraphQL),
+                Permissions: new[] { ConfigurationTests.GetMinimalPermissionConfig(AuthorizationResolver.ROLE_ANONYMOUS) },
+                Relationships: null,
+                Mappings: null);
+
+            Dictionary<string, Entity> entityMap = new()
+            {
+                { "Book", requiredEntity }
+            };
+
+            return CreateRuntimeConfig(entityMap, enableGlobalRest, enableGlobalGraphql, enableGlobalHealth, enableDatasourceHealth, HostMode.Development);
+        }
+
+        /// <summary>
+        /// Helper function to write custom configuration file. with minimal REST/GraphQL global settings
+        /// using the supplied entities.
+        /// </summary>
+        /// <param name="entityMap">Collection of entityName -> Entity object.</param>
+        /// <param name="enableGlobalRest">flag to enable or disabled REST globally.</param>
+        private static RuntimeConfig CreateRuntimeConfig(Dictionary<string, Entity> entityMap, bool enableGlobalRest = true, bool enableGlobalGraphql = true, bool enableGlobalHealth = true, bool enableDatasourceHealth = true, HostMode hostMode = HostMode.Production)
+        {
+            DataSource dataSource = new(
+                DatabaseType.MSSQL,
+                ConfigurationTests.GetConnectionStringFromEnvironmentConfig(environment: TestCategory.MSSQL),
+                Options: null,
+                Health: new(enableDatasourceHealth));
+            HostOptions hostOptions = new(Mode: hostMode, Cors: null, Authentication: new() { Provider = nameof(EasyAuthType.StaticWebApps) });
+
+            RuntimeConfig runtimeConfig = new(
+                Schema: string.Empty,
+                DataSource: dataSource,
+                Runtime: new(
+                    Health: new(enabled: enableGlobalHealth),
+                    Rest: new(Enabled: enableGlobalRest),
+                    GraphQL: new(Enabled: enableGlobalGraphql),
+                    Host: hostOptions
+                ),
+                Entities: new(entityMap));
+
+            return runtimeConfig;
+        }
+
+        private static void WriteToCustomConfigFile(RuntimeConfig runtimeConfig)
+        {
+            File.WriteAllText(
+                path: CUSTOM_CONFIG_FILENAME,
+                contents: runtimeConfig.ToJson());
+        }
+    }
+    #endregion
+}
diff --git a/src/Service/Controllers/HealthController.cs b/src/Service/Controllers/HealthController.cs
index f54de8baf4..74eb8f554d 100644
--- a/src/Service/Controllers/HealthController.cs
+++ b/src/Service/Controllers/HealthController.cs
@@ -41,7 +41,7 @@ public async Task Get()
         {
             if (IHttpContextAccessor != null && IHttpContextAccessor.HttpContext != null)
             {
-                await ComprehensiveHealthReportResponseWriter.WriteResponse(IHttpContextAccessor.HttpContext);
+                await ComprehensiveHealthReportResponseWriter.WriteResponseAsync(IHttpContextAccessor.HttpContext);
             }
 
             return;
diff --git a/src/Service/HealthCheck/ComprehensiveHealthReportResponseWriter.cs b/src/Service/HealthCheck/ComprehensiveHealthReportResponseWriter.cs
index 70a257c295..2555890791 100644
--- a/src/Service/HealthCheck/ComprehensiveHealthReportResponseWriter.cs
+++ b/src/Service/HealthCheck/ComprehensiveHealthReportResponseWriter.cs
@@ -69,7 +69,7 @@ public ComprehensiveHealthReportResponseWriter(
         /// </summary>
         /// <param name="context">HttpContext for writing the response.</param>
         /// <returns>Writes the http response to the http context.</returns>
-        public async Task WriteResponse(HttpContext context)
+        public async Task WriteResponseAsync(HttpContext context)
         {
             RuntimeConfig config = _runtimeConfigProvider.GetConfig();
 
@@ -95,7 +95,7 @@ public async Task WriteResponse(HttpContext context)
                             key: CACHE_KEY,
                             async (FusionCacheFactoryExecutionContext<string?> ctx, CancellationToken ct) =>
                             {
-                                string? response = await ExecuteHealthCheck(context, config).ConfigureAwait(false);
+                                string? response = await ExecuteHealthCheckAsync(config).ConfigureAwait(false);
                                 ctx.Options.SetDuration(TimeSpan.FromSeconds(config.CacheTtlSecondsForHealthReport));
                                 return response;
                             });
@@ -124,7 +124,7 @@ public async Task WriteResponse(HttpContext context)
                 }
                 else
                 {
-                    response = await ExecuteHealthCheck(context, config).ConfigureAwait(false);
+                    response = await ExecuteHealthCheckAsync(config).ConfigureAwait(false);
                     // Return the newly generated response
                     await context.Response.WriteAsync(response);
                 }
@@ -139,9 +139,9 @@ public async Task WriteResponse(HttpContext context)
             return;
         }
 
-        private async Task<string> ExecuteHealthCheck(HttpContext context, RuntimeConfig config)
+        private async Task<string> ExecuteHealthCheckAsync(RuntimeConfig config)
         {
-            ComprehensiveHealthCheckReport dabHealthCheckReport = await _healthCheckHelper.GetHealthCheckResponse(context, config);
+            ComprehensiveHealthCheckReport dabHealthCheckReport = await _healthCheckHelper.GetHealthCheckResponseAsync(config);
             string response = JsonSerializer.Serialize(dabHealthCheckReport, options: new JsonSerializerOptions { WriteIndented = true, DefaultIgnoreCondition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull });
             _logger.LogTrace($"Health check response writer writing status as: {dabHealthCheckReport.Status}");
 
diff --git a/src/Service/HealthCheck/HealthCheckHelper.cs b/src/Service/HealthCheck/HealthCheckHelper.cs
index f4e7f1f84e..5361a55da5 100644
--- a/src/Service/HealthCheck/HealthCheckHelper.cs
+++ b/src/Service/HealthCheck/HealthCheckHelper.cs
@@ -45,21 +45,19 @@ public HealthCheckHelper(ILogger<HealthCheckHelper> logger, HttpUtilities httpUt
         /// GetHealthCheckResponse is the main function which fetches the HttpContext and then creates the comprehensive health check report.
         /// Serializes the report to JSON and returns the response.  
         /// </summary>
-        /// <param name="context">HttpContext</param>
         /// <param name="runtimeConfig">RuntimeConfig</param>
         /// <returns>This function returns the comprehensive health report after calculating the response time of each datasource, rest and graphql health queries.</returns>
-        public async Task<ComprehensiveHealthCheckReport> GetHealthCheckResponse(HttpContext context, RuntimeConfig runtimeConfig)
+        public async Task<ComprehensiveHealthCheckReport> GetHealthCheckResponseAsync(RuntimeConfig runtimeConfig)
         {
             // Create a JSON response for the comprehensive health check endpoint using the provided basic health report.
             // If the response has already been created, it will be reused.
-            _httpUtility.ConfigureApiRoute(context);
             _logger.LogTrace("Comprehensive Health check is enabled in the runtime configuration.");
 
             ComprehensiveHealthCheckReport ComprehensiveHealthCheckReport = new();
             UpdateVersionAndAppName(ref ComprehensiveHealthCheckReport);
             UpdateTimestampOfResponse(ref ComprehensiveHealthCheckReport);
             UpdateDabConfigurationDetails(ref ComprehensiveHealthCheckReport, runtimeConfig);
-            await UpdateHealthCheckDetails(ComprehensiveHealthCheckReport, runtimeConfig);
+            await UpdateHealthCheckDetailsAsync(ComprehensiveHealthCheckReport, runtimeConfig);
             UpdateOverallHealthStatus(ref ComprehensiveHealthCheckReport);
             return ComprehensiveHealthCheckReport;
         }
@@ -148,20 +146,20 @@ private static void UpdateDabConfigurationDetails(ref ComprehensiveHealthCheckRe
         }
 
         // Main function to internally call for data source and entities health check.
-        private async Task UpdateHealthCheckDetails(ComprehensiveHealthCheckReport ComprehensiveHealthCheckReport, RuntimeConfig runtimeConfig)
+        private async Task UpdateHealthCheckDetailsAsync(ComprehensiveHealthCheckReport ComprehensiveHealthCheckReport, RuntimeConfig runtimeConfig)
         {
             ComprehensiveHealthCheckReport.Checks = new List<HealthCheckResultEntry>();
-            await UpdateDataSourceHealthCheckResults(ComprehensiveHealthCheckReport, runtimeConfig);
-            await UpdateEntityHealthCheckResults(ComprehensiveHealthCheckReport, runtimeConfig);
+            await UpdateDataSourceHealthCheckResultsAsync(ComprehensiveHealthCheckReport, runtimeConfig);
+            await UpdateEntityHealthCheckResultsAsync(ComprehensiveHealthCheckReport, runtimeConfig);
         }
 
         // Updates the DataSource Health Check Results in the response.
-        private async Task UpdateDataSourceHealthCheckResults(ComprehensiveHealthCheckReport ComprehensiveHealthCheckReport, RuntimeConfig runtimeConfig)
+        private async Task UpdateDataSourceHealthCheckResultsAsync(ComprehensiveHealthCheckReport ComprehensiveHealthCheckReport, RuntimeConfig runtimeConfig)
         {
             if (ComprehensiveHealthCheckReport.Checks != null && runtimeConfig.DataSource.IsDatasourceHealthEnabled)
             {
                 string query = Utilities.GetDatSourceQuery(runtimeConfig.DataSource.DatabaseType);
-                (int, string?) response = await ExecuteDatasourceQueryCheck(query, runtimeConfig.DataSource.ConnectionString);
+                (int, string?) response = await ExecuteDatasourceQueryCheckAsync(query, runtimeConfig.DataSource.ConnectionString);
                 bool isResponseTimeWithinThreshold = response.Item1 >= 0 && response.Item1 < runtimeConfig.DataSource.DatasourceThresholdMs;
 
                 // Add DataSource Health Check Results
@@ -181,14 +179,14 @@ private async Task UpdateDataSourceHealthCheckResults(ComprehensiveHealthCheckRe
         }
 
         // Executes the DB Query and keeps track of the response time and error message.
-        private async Task<(int, string?)> ExecuteDatasourceQueryCheck(string query, string connectionString)
+        private async Task<(int, string?)> ExecuteDatasourceQueryCheckAsync(string query, string connectionString)
         {
             string? errorMessage = null;
             if (!string.IsNullOrEmpty(query) && !string.IsNullOrEmpty(connectionString))
             {
                 Stopwatch stopwatch = new();
                 stopwatch.Start();
-                errorMessage = await _httpUtility.ExecuteDbQuery(query, connectionString);
+                errorMessage = await _httpUtility.ExecuteDbQueryAsync(query, connectionString);
                 stopwatch.Stop();
                 return string.IsNullOrEmpty(errorMessage) ? ((int)stopwatch.ElapsedMilliseconds, errorMessage) : (HealthCheckConstants.ERROR_RESPONSE_TIME_MS, errorMessage);
             }
@@ -198,7 +196,7 @@ private async Task UpdateDataSourceHealthCheckResults(ComprehensiveHealthCheckRe
 
         // Updates the Entity Health Check Results in the response. 
         // Goes through the entities one by one and executes the rest and graphql checks (if enabled).
-        private async Task UpdateEntityHealthCheckResults(ComprehensiveHealthCheckReport ComprehensiveHealthCheckReport, RuntimeConfig runtimeConfig)
+        private async Task UpdateEntityHealthCheckResultsAsync(ComprehensiveHealthCheckReport ComprehensiveHealthCheckReport, RuntimeConfig runtimeConfig)
         {
             if (runtimeConfig?.Entities != null && runtimeConfig.Entities.Entities.Any())
             {
@@ -206,7 +204,7 @@ private async Task UpdateEntityHealthCheckResults(ComprehensiveHealthCheckReport
                 {
                     if (Entity.Value.IsEntityHealthEnabled)
                     {
-                        await PopulateEntityHealth(ComprehensiveHealthCheckReport, Entity, runtimeConfig);
+                        await PopulateEntityHealthAsync(ComprehensiveHealthCheckReport, Entity, runtimeConfig);
                     }
                 }
             }
@@ -215,7 +213,7 @@ private async Task UpdateEntityHealthCheckResults(ComprehensiveHealthCheckReport
         // Populates the Entity Health Check Results in the response for a particular entity.
         // Checks for Rest enabled and executes the rest query.
         // Checks for GraphQL enabled and executes the graphql query.
-        private async Task PopulateEntityHealth(ComprehensiveHealthCheckReport ComprehensiveHealthCheckReport, KeyValuePair<string, Entity> entity, RuntimeConfig runtimeConfig)
+        private async Task PopulateEntityHealthAsync(ComprehensiveHealthCheckReport ComprehensiveHealthCheckReport, KeyValuePair<string, Entity> entity, RuntimeConfig runtimeConfig)
         {
             // Global Rest and GraphQL Runtime Options
             RuntimeOptions? runtimeOptions = runtimeConfig.Runtime;
@@ -234,7 +232,7 @@ private async Task PopulateEntityHealth(ComprehensiveHealthCheckReport Comprehen
                     // The path is trimmed to remove the leading '/' character.
                     // If the path is not present, use the entity key name as the path.
                     string entityPath = entityValue.Rest.Path != null ? entityValue.Rest.Path.TrimStart('/') : entityKeyName;
-                    (int, string?) response = await ExecuteRestEntityQuery(runtimeConfig.RestPath, entityPath, entityValue.EntityFirst);
+                    (int, string?) response = await ExecuteRestEntityQueryAsync(runtimeConfig.RestPath, entityPath, entityValue.EntityFirst);
                     bool isResponseTimeWithinThreshold = response.Item1 >= 0 && response.Item1 < entityValue.EntityThresholdMs;
 
                     // Add Entity Health Check Results
@@ -256,7 +254,7 @@ private async Task PopulateEntityHealth(ComprehensiveHealthCheckReport Comprehen
                 {
                     ComprehensiveHealthCheckReport.Checks ??= new List<HealthCheckResultEntry>();
 
-                    (int, string?) response = await ExecuteGraphQLEntityQuery(runtimeConfig.GraphQLPath, entityValue, entityKeyName);
+                    (int, string?) response = await ExecuteGraphQLEntityQueryAsync(runtimeConfig.GraphQLPath, entityValue, entityKeyName);
                     bool isResponseTimeWithinThreshold = response.Item1 >= 0 && response.Item1 < entityValue.EntityThresholdMs;
 
                     ComprehensiveHealthCheckReport.Checks.Add(new HealthCheckResultEntry
@@ -276,14 +274,14 @@ private async Task PopulateEntityHealth(ComprehensiveHealthCheckReport Comprehen
         }
 
         // Executes the Rest Entity Query and keeps track of the response time and error message.
-        private async Task<(int, string?)> ExecuteRestEntityQuery(string restUriSuffix, string entityName, int first)
+        private async Task<(int, string?)> ExecuteRestEntityQueryAsync(string restUriSuffix, string entityName, int first)
         {
             string? errorMessage = null;
             if (!string.IsNullOrEmpty(entityName))
             {
                 Stopwatch stopwatch = new();
                 stopwatch.Start();
-                errorMessage = await _httpUtility.ExecuteRestQuery(restUriSuffix, entityName, first, _incomingRoleHeader, _incomingRoleToken);
+                errorMessage = await _httpUtility.ExecuteRestQueryAsync(restUriSuffix, entityName, first, _incomingRoleHeader, _incomingRoleToken);
                 stopwatch.Stop();
                 return string.IsNullOrEmpty(errorMessage) ? ((int)stopwatch.ElapsedMilliseconds, errorMessage) : (HealthCheckConstants.ERROR_RESPONSE_TIME_MS, errorMessage);
             }
@@ -292,14 +290,14 @@ private async Task PopulateEntityHealth(ComprehensiveHealthCheckReport Comprehen
         }
 
         // Executes the GraphQL Entity Query and keeps track of the response time and error message.
-        private async Task<(int, string?)> ExecuteGraphQLEntityQuery(string graphqlUriSuffix, Entity entity, string entityName)
+        private async Task<(int, string?)> ExecuteGraphQLEntityQueryAsync(string graphqlUriSuffix, Entity entity, string entityName)
         {
             string? errorMessage = null;
             if (entity != null)
             {
                 Stopwatch stopwatch = new();
                 stopwatch.Start();
-                errorMessage = await _httpUtility.ExecuteGraphQLQuery(graphqlUriSuffix, entityName, entity, _incomingRoleHeader, _incomingRoleToken);
+                errorMessage = await _httpUtility.ExecuteGraphQLQueryAsync(graphqlUriSuffix, entityName, entity, _incomingRoleHeader, _incomingRoleToken);
                 stopwatch.Stop();
                 return string.IsNullOrEmpty(errorMessage) ? ((int)stopwatch.ElapsedMilliseconds, errorMessage) : (HealthCheckConstants.ERROR_RESPONSE_TIME_MS, errorMessage);
             }
diff --git a/src/Service/HealthCheck/HttpUtilities.cs b/src/Service/HealthCheck/HttpUtilities.cs
index 3b26adafc2..a3195d0d8a 100644
--- a/src/Service/HealthCheck/HttpUtilities.cs
+++ b/src/Service/HealthCheck/HttpUtilities.cs
@@ -5,7 +5,6 @@
 using System.Collections.Generic;
 using System.Linq;
 using System.Net.Http;
-using System.Net.Http.Headers;
 using System.Text;
 using System.Threading.Tasks;
 using Azure.DataApiBuilder.Config.DatabasePrimitives;
@@ -14,8 +13,7 @@
 using Azure.DataApiBuilder.Core.Configurations;
 using Azure.DataApiBuilder.Core.Services;
 using Azure.DataApiBuilder.Core.Services.MetadataProviders;
-using Humanizer;
-using Microsoft.AspNetCore.Http;
+using Azure.DataApiBuilder.Service.GraphQLBuilder;
 using Microsoft.Data.SqlClient;
 using Microsoft.Extensions.Logging;
 
@@ -27,7 +25,7 @@ namespace Azure.DataApiBuilder.Service.HealthCheck
     public class HttpUtilities
     {
         private readonly ILogger<HttpUtilities> _logger;
-        private string _apiRoute;
+        private HttpClient _httpClient;
         private IMetadataProviderFactory _metadataProviderFactory;
         private RuntimeConfigProvider _runtimeConfigProvider;
 
@@ -37,34 +35,21 @@ public class HttpUtilities
         /// <param name="logger">Logger</param>
         /// <param name="metadataProviderFactory">MetadataProviderFactory</param>
         /// <param name="runtimeConfigProvider">RuntimeConfigProvider</param>
+        /// <param name="httpClientFactory">HttpClientFactory</param>
         public HttpUtilities(
             ILogger<HttpUtilities> logger,
             IMetadataProviderFactory metadataProviderFactory,
-            RuntimeConfigProvider runtimeConfigProvider)
+            RuntimeConfigProvider runtimeConfigProvider,
+            IHttpClientFactory httpClientFactory)
         {
             _logger = logger;
-            _apiRoute = string.Empty;
             _metadataProviderFactory = metadataProviderFactory;
             _runtimeConfigProvider = runtimeConfigProvider;
-        }
-
-        /// <summary>
-        /// Fetches the Http Base URI from the Context information to execute the REST and GraphQL queries.
-        /// </summary>
-        /// <param name="httpContext">HttpContext</param>
-        public void ConfigureApiRoute(HttpContext httpContext)
-        {
-            if (httpContext == null || httpContext.Request == null)
-            {
-                throw new ArgumentNullException(nameof(httpContext));
-            }
-
-            // Extract base URL: scheme + host + port (if present)
-            _apiRoute = $"{httpContext.Request.Scheme}://{httpContext.Request.Host}";
+            _httpClient = httpClientFactory.CreateClient("ContextConfiguredHealthCheckClient");
         }
 
         // Executes the DB query by establishing a connection to the DB.
-        public async Task<string?> ExecuteDbQuery(string query, string connectionString)
+        public async Task<string?> ExecuteDbQueryAsync(string query, string connectionString)
         {
             string? errorMessage = null;
             // Execute the query on DB and return the response time.
@@ -89,50 +74,44 @@ public void ConfigureApiRoute(HttpContext httpContext)
         }
 
         // Executes the REST query by sending a GET request to the API.
-        public async Task<string?> ExecuteRestQuery(string restUriSuffix, string entityName, int first, string incomingRoleHeader, string incomingRoleToken)
+        public async Task<string?> ExecuteRestQueryAsync(string restUriSuffix, string entityName, int first, string incomingRoleHeader, string incomingRoleToken)
         {
             string? errorMessage = null;
             try
             {
                 // Base URL of the API that handles SQL operations
-                string apiRoute = Utilities.GetServiceRoute(_apiRoute, restUriSuffix);
+                string apiRoute = $"{restUriSuffix}{Utilities.CreateHttpRestQuery(entityName, first)}";
                 if (string.IsNullOrEmpty(apiRoute))
                 {
                     _logger.LogError("The API route is not available, hence HealthEndpoint is not available.");
                     return errorMessage;
                 }
 
-                if (!Program.CheckSanityOfUrl(apiRoute))
+                if (!Program.CheckSanityOfUrl($"{_httpClient.BaseAddress}{restUriSuffix}"))
                 {
                     _logger.LogError("Blocked outbound request due to invalid or unsafe URI.");
                     return "Blocked outbound request due to invalid or unsafe URI.";
                 }
 
-                // Create an instance of HttpClient
-                using (HttpClient client = CreateClient(apiRoute))
+                HttpRequestMessage message = new(method: HttpMethod.Get, requestUri: apiRoute);
+                if (!string.IsNullOrEmpty(incomingRoleToken))
                 {
-                    // Send a GET request to the API
-                    apiRoute = $"{apiRoute}{Utilities.CreateHttpRestQuery(entityName, first)}";
-                    HttpRequestMessage message = new(method: HttpMethod.Get, requestUri: apiRoute);
-                    if (!string.IsNullOrEmpty(incomingRoleToken))
-                    {
-                        message.Headers.Add(AuthenticationOptions.CLIENT_PRINCIPAL_HEADER, incomingRoleToken);
-                    }
+                    message.Headers.Add(AuthenticationOptions.CLIENT_PRINCIPAL_HEADER, incomingRoleToken);
+                }
 
-                    if (!string.IsNullOrEmpty(incomingRoleHeader))
-                    {
-                        message.Headers.Add(AuthorizationResolver.CLIENT_ROLE_HEADER, incomingRoleHeader);
-                    }
+                if (!string.IsNullOrEmpty(incomingRoleHeader))
+                {
+                    message.Headers.Add(AuthorizationResolver.CLIENT_ROLE_HEADER, incomingRoleHeader);
+                }
 
-                    HttpResponseMessage response = await client.SendAsync(message);
-                    if (response.IsSuccessStatusCode)
-                    {
-                        _logger.LogTrace($"The REST HealthEndpoint query executed successfully with code {response.IsSuccessStatusCode}.");
-                    }
-                    else
-                    {
-                        errorMessage = $"The REST HealthEndpoint query failed with code: {response.StatusCode}.";
-                    }
+                HttpResponseMessage response = await _httpClient.SendAsync(message);
+                if (response.IsSuccessStatusCode)
+                {
+                    _logger.LogTrace($"The REST HealthEndpoint query executed successfully with code {response.IsSuccessStatusCode}.");
+                }
+                else
+                {
+                    errorMessage = $"The REST HealthEndpoint query failed with code: {response.StatusCode}.";
                 }
 
                 return errorMessage;
@@ -146,18 +125,11 @@ public void ConfigureApiRoute(HttpContext httpContext)
 
         // Executes the GraphQL query by sending a POST request to the API.
         // Internally calls the metadata provider to fetch the column names to create the graphql payload.
-        public async Task<string?> ExecuteGraphQLQuery(string graphqlUriSuffix, string entityName, Entity entity, string incomingRoleHeader, string incomingRoleToken)
+        public async Task<string?> ExecuteGraphQLQueryAsync(string graphqlUriSuffix, string entityName, Entity entity, string incomingRoleHeader, string incomingRoleToken)
         {
             string? errorMessage = null;
-            // Base URL of the API that handles SQL operations
-            string apiRoute = Utilities.GetServiceRoute(_apiRoute, graphqlUriSuffix);
-            if (string.IsNullOrEmpty(apiRoute))
-            {
-                _logger.LogError("The API route is not available, hence HealthEndpoint is not available.");
-                return errorMessage;
-            }
 
-            if (!Program.CheckSanityOfUrl(apiRoute))
+            if (!Program.CheckSanityOfUrl($"{_httpClient.BaseAddress}{graphqlUriSuffix}"))
             {
                 _logger.LogError("Blocked outbound request due to invalid or unsafe URI.");
                 return "Blocked outbound request due to invalid or unsafe URI.";
@@ -169,46 +141,43 @@ public void ConfigureApiRoute(HttpContext httpContext)
 
                 // Fetch Column Names from Metadata Provider
                 ISqlMetadataProvider sqlMetadataProvider = _metadataProviderFactory.GetMetadataProvider(dataSourceName);
-                DatabaseObject dbObject = sqlMetadataProvider.EntityToDatabaseObject[entityName];
+                DatabaseObject dbObject = sqlMetadataProvider.GetDatabaseObjectByKey(entityName);
                 List<string> columnNames = dbObject.SourceDefinition.Columns.Keys.ToList();
 
                 // In case of GraphQL API, use the plural value specified in [entity.graphql.type.plural].
                 // Further, we need to camel case this plural value to match the GraphQL object name.                  
-                string graphqlObjectName = LowerFirstLetter(entity.GraphQL.Plural.Pascalize());
+                string graphqlObjectName = GraphQLNaming.GenerateListQueryName(entityName, entity);
 
                 // In case any primitive column names are present, execute the query
                 if (columnNames.Any())
                 {
-                    using (HttpClient client = CreateClient(apiRoute))
+                    string jsonPayload = Utilities.CreateHttpGraphQLQuery(graphqlObjectName, columnNames, entity.EntityFirst);
+                    HttpContent content = new StringContent(jsonPayload, Encoding.UTF8, Utilities.JSON_CONTENT_TYPE);
+
+                    HttpRequestMessage message = new(method: HttpMethod.Post, requestUri: graphqlUriSuffix)
+                    {
+                        Content = content
+                    };
+
+                    if (!string.IsNullOrEmpty(incomingRoleToken))
+                    {
+                        message.Headers.Add(AuthenticationOptions.CLIENT_PRINCIPAL_HEADER, incomingRoleToken);
+                    }
+
+                    if (!string.IsNullOrEmpty(incomingRoleHeader))
+                    {
+                        message.Headers.Add(AuthorizationResolver.CLIENT_ROLE_HEADER, incomingRoleHeader);
+                    }
+
+                    HttpResponseMessage response = await _httpClient.SendAsync(message);
+
+                    if (response.IsSuccessStatusCode)
                     {
-                        string jsonPayload = Utilities.CreateHttpGraphQLQuery(graphqlObjectName, columnNames, entity.EntityFirst);
-                        HttpContent content = new StringContent(jsonPayload, Encoding.UTF8, Utilities.JSON_CONTENT_TYPE);
-
-                        HttpRequestMessage message = new(method: HttpMethod.Post, requestUri: apiRoute)
-                        {
-                            Content = content
-                        };
-
-                        if (!string.IsNullOrEmpty(incomingRoleToken))
-                        {
-                            message.Headers.Add(AuthenticationOptions.CLIENT_PRINCIPAL_HEADER, incomingRoleToken);
-                        }
-
-                        if (!string.IsNullOrEmpty(incomingRoleHeader))
-                        {
-                            message.Headers.Add(AuthorizationResolver.CLIENT_ROLE_HEADER, incomingRoleHeader);
-                        }
-
-                        HttpResponseMessage response = await client.SendAsync(message);
-
-                        if (response.IsSuccessStatusCode)
-                        {
-                            _logger.LogTrace("The GraphQL HealthEndpoint query executed successfully.");
-                        }
-                        else
-                        {
-                            errorMessage = $"The GraphQL HealthEndpoint query failed with code: {response.StatusCode}.";
-                        }
+                        _logger.LogTrace("The GraphQL HealthEndpoint query executed successfully.");
+                    }
+                    else
+                    {
+                        errorMessage = $"The GraphQL HealthEndpoint query failed with code: {response.StatusCode}.";
                     }
                 }
 
@@ -220,34 +189,5 @@ public void ConfigureApiRoute(HttpContext httpContext)
                 return ex.Message;
             }
         }
-
-        /// <summary>
-        /// Creates a <see cref="HttpClient" /> for processing HTTP requests/responses with the test server.
-        /// </summary>
-        public HttpClient CreateClient(string apiRoute)
-        {
-            return new HttpClient()
-            {
-                // Set the base URL for the client
-                BaseAddress = new Uri(apiRoute),
-                DefaultRequestHeaders =
-                {
-                    Accept = { new MediaTypeWithQualityHeaderValue(Utilities.JSON_CONTENT_TYPE) }
-                },
-                Timeout = TimeSpan.FromSeconds(200),
-            };
-        }
-
-        // Updates the entity key name to camel case for the health check report.
-        public static string LowerFirstLetter(string input)
-        {
-            if (string.IsNullOrEmpty(input) || char.IsLower(input[0]))
-            {
-                // If the input is null or empty, or if the first character is already lowercase, return the input as is.
-                return input;
-            }
-
-            return char.ToLower(input[0]) + input.Substring(1);
-        }
     }
 }
diff --git a/src/Service/HealthCheck/Utilities.cs b/src/Service/HealthCheck/Utilities.cs
index 2872e244f5..4b61346736 100644
--- a/src/Service/HealthCheck/Utilities.cs
+++ b/src/Service/HealthCheck/Utilities.cs
@@ -48,20 +48,8 @@ public static string CreateHttpGraphQLQuery(string entityName, List<string> colu
         public static string CreateHttpRestQuery(string entityName, int first)
         {
             // Create the payload for the REST HTTP request.
-            // "/EntityName?$first=4"
+            // "EntityName?$first=4"
             return $"/{entityName}?$first={first}";
         }
-
-        public static string GetServiceRoute(string route, string uriSuffix)
-        {
-            // The RuntimeConfigProvider enforces the expectation that the configured REST and GraphQL path starts with a
-            // forward slash '/'. This is to ensure that the path is always relative to the base URL.
-            if (uriSuffix == string.Empty)
-            {
-                return string.Empty;
-            }
-
-            return $"{route}{uriSuffix.ToLowerInvariant()}";
-        }
     }
 }
diff --git a/src/Service/Startup.cs b/src/Service/Startup.cs
index 3d70f60e30..3dfdbf3751 100644
--- a/src/Service/Startup.cs
+++ b/src/Service/Startup.cs
@@ -4,6 +4,7 @@
 using System;
 using System.IO.Abstractions;
 using System.Net.Http;
+using System.Net.Http.Headers;
 using System.Threading.Tasks;
 using Azure.DataApiBuilder.Auth;
 using Azure.DataApiBuilder.Config;
@@ -271,6 +272,27 @@ public void ConfigureServices(IServiceCollection services)
             //Enable accessing HttpContext in RestService to get ClaimsPrincipal.
             services.AddHttpContextAccessor();
 
+            services.AddHttpClient("ContextConfiguredHealthCheckClient")
+                .ConfigureHttpClient((serviceProvider, client) =>
+                {
+                    IHttpContextAccessor httpContextAccessor = serviceProvider.GetRequiredService<IHttpContextAccessor>();
+                    HttpContext? httpContext = httpContextAccessor.HttpContext;
+
+                    if (httpContext != null)
+                    {
+                        // Build base address from request
+                        string baseUri = $"{httpContext.Request.Scheme}://{httpContext.Request.Host}";
+                        client.BaseAddress = new Uri(baseUri);
+
+                        // Set default Accept header
+                        client.DefaultRequestHeaders.Accept.Clear();
+                        client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
+                    }
+
+                    // Optional: Set a timeout
+                    client.Timeout = TimeSpan.FromSeconds(200);
+                });
+
             if (runtimeConfig is not null && runtimeConfig.Runtime?.Host?.Mode is HostMode.Development)
             {
                 // Development mode implies support for "Hot Reload". The V2 authentication function
@@ -507,6 +529,7 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env, RuntimeC
                 {
                     context.Response.StatusCode = StatusCodes.Status503ServiceUnavailable;
                 }
+
             });
 
             app.UseAuthentication();


Reviews:
user: login: copilot-pull-request-reviewer[bot]
body: ## Pull Request Overview

This PR adds unit tests for REST and GraphQL health check endpoints while refactoring the HTTP client configuration and health check utilities. Key changes include:
- Configuring a named HttpClient in Startup to set up base addresses and default headers.
- Refactoring HttpUtilities methods to use IHttpClientFactory with asynchronous REST calls.
- Updating test configurations and helper methods to support asynchronous health check processing.

### Reviewed Changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.

<details>
<summary>Show a summary per file</summary>

| File | Description |
| ---- | ----------- |
| src/Service/Startup.cs | Adds a named HttpClient for context-aware health check requests. |
| src/Service/HealthCheck/Utilities.cs | Updates REST query string formatting for health check endpoints. |
| src/Service/HealthCheck/HttpUtilities.cs | Refactors REST calls to async using IHttpClientFactory and updates GraphQL query handling. |
| src/Service/HealthCheck/HealthCheckHelper.cs | Converts helper methods to async to support non-blocking health check responses. |
| src/Service/HealthCheck/ComprehensiveHealthReportResponseWriter.cs | Updates response writing to be asynchronous. |
| src/Service.Tests/Configuration/ConfigurationTests.cs | Removes unused options in custom configuration file creation and hardcodes GraphQL enablement. |
| src/Core/Services/MetadataProviders/ISqlMetadataProvider.cs | Adds a helper method for accessing database objects by key. |
| src/Config/DatabasePrimitives/DatabaseObject.cs | Allows overriding of the SourceDefinition property for testability. |
</details>



<details>
<summary>Comments suppressed due to low confidence (2)</summary>

**src/Service/HealthCheck/HttpUtilities.cs:122**
* For consistency with the async ExecuteRestQuery, consider converting ExecuteGraphQLQuery to an async method and await the HttpClient call instead of using .Result.
```
public string? ExecuteGraphQLQuery(string graphqlUriSuffix, string entityName, Entity entity, string incomingRoleHeader, string incomingRoleToken)
```
**src/Service.Tests/Configuration/ConfigurationTests.cs:4457**
* Since the function previously accepted multiple flags for GraphQL and health check enablement, ensure that hardcoding GraphQL as enabled aligns with the intended test scenarios and document the change accordingly.
```
private static void CreateCustomConfigFile(Dictionary<string, Entity> entityMap, bool enableGlobalRest = true)
```
</details>


state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-28T11:42:11Z
user: login: sezal98
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-28T11:43:44Z
user: login: Aniruddh25
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-04-29T01:56:16Z
user: login: sezal98
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-29T07:31:48Z
user: login: Aniruddh25
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-05-01T00:50:25Z
user: login: Aniruddh25
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-05-01T00:52:19Z
user: login: Aniruddh25
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-05-01T01:05:06Z
user: login: Aniruddh25
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-05-01T01:18:05Z
user: login: Aniruddh25
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-05-01T01:19:48Z
user: login: sezal98
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-05-08T07:31:27Z
user: login: sezal98
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-05-08T07:36:59Z
user: login: sezal98
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-05-08T07:52:54Z
user: login: Aniruddh25
body: LGTM, thanks for adding these tests!
state: APPROVED
author_association: COLLABORATOR
submitted_at: 2025-05-08T21:36:28Z
user: login: RubenCerna2079
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-05-12T23:45:01Z
user: login: RubenCerna2079
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-05-13T00:01:37Z
user: login: RubenCerna2079
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-05-13T00:27:36Z
user: login: sezal98
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-05-14T07:23:40Z
user: login: sezal98
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-05-14T07:26:30Z
user: login: sezal98
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-05-14T07:28:06Z
user: login: Aniruddh25
state: APPROVED
author_association: COLLABORATOR
submitted_at: 2025-05-14T17:03:05Z
user: login: RubenCerna2079
body: LGTM
state: APPROVED
author_association: CONTRIBUTOR
submitted_at: 2025-05-14T18:13:05Z

Review comments:
diff_hunk: @@ -166,36 +139,33 @@ public void ConfigureApiRoute(HttpContext httpContext)
                 // In case any primitive column names are present, execute the query
                 if (columnNames.Any())
                 {
-                    using (HttpClient client = CreateClient(apiRoute))
+                    string jsonPayload = Utilities.CreateHttpGraphQLQuery(graphqlObjectName, columnNames, entity.EntityFirst);
+                    HttpContent content = new StringContent(jsonPayload, Encoding.UTF8, Utilities.JSON_CONTENT_TYPE);
+
+                    HttpRequestMessage message = new(method: HttpMethod.Post, requestUri: graphqlUriSuffix)
path: src/Service/HealthCheck/HttpUtilities.cs
user: login: Copilot
body: Consider constructing the full GraphQL API URL by combining the base address with the GraphQL endpoint (similar to the REST query) to ensure consistency.
```suggestion
                    string graphqlFullUri = $"{baseAddress.TrimEnd('/')}/{graphqlUriSuffix.TrimStart('/')}";
                    HttpRequestMessage message = new(method: HttpMethod.Post, requestUri: graphqlFullUri)
```
created_at: 2025-04-28T11:42:11Z
author_association: CONTRIBUTOR
diff_hunk: @@ -166,36 +139,33 @@ public void ConfigureApiRoute(HttpContext httpContext)
                 // In case any primitive column names are present, execute the query
                 if (columnNames.Any())
                 {
-                    using (HttpClient client = CreateClient(apiRoute))
+                    string jsonPayload = Utilities.CreateHttpGraphQLQuery(graphqlObjectName, columnNames, entity.EntityFirst);
+                    HttpContent content = new StringContent(jsonPayload, Encoding.UTF8, Utilities.JSON_CONTENT_TYPE);
+
+                    HttpRequestMessage message = new(method: HttpMethod.Post, requestUri: graphqlUriSuffix)
path: src/Service/HealthCheck/HttpUtilities.cs
user: login: sezal98
body: We want to create a relative URIs since base address is already set in the startup.cs
created_at: 2025-04-28T11:43:44Z
author_association: CONTRIBUTOR
diff_hunk: @@ -208,23 +178,6 @@ public void ConfigureApiRoute(HttpContext httpContext)
             }
         }
 
-        /// <summary>
-        /// Creates a <see cref="HttpClient" /> for processing HTTP requests/responses with the test server.
-        /// </summary>
-        public HttpClient CreateClient(string apiRoute)
-        {
-            return new HttpClient()
-            {
-                // Set the base URL for the client
-                BaseAddress = new Uri(apiRoute),
-                DefaultRequestHeaders =
-                {
-                    Accept = { new MediaTypeWithQualityHeaderValue(Utilities.JSON_CONTENT_TYPE) }
-                },
-                Timeout = TimeSpan.FromSeconds(200),
-            };
-        }
-
         // Updates the entity key name to camel case for the health check report.
         public static string LowerFirstLetter(string input)
path: src/Service/HealthCheck/HttpUtilities.cs
user: login: Aniruddh25
body: I know this was added in the fix that went in here: https://github.com/Azure/data-api-builder/pull/2657

But, we should have used the function GraphQLNaming::GenerateListQueryName to generate the field name for the GraphQL query. This uses FormatNameForField and will camelCase it as needed. Currently we are only converting the first letter to lower case. This does not account for the case where the entity name is Two word for e.g. if it is `Lastname`, the query field name should be `lastName` but the current solution will generate `lastname` 
created_at: 2025-04-29T01:56:16Z
author_association: COLLABORATOR
diff_hunk: @@ -208,23 +178,6 @@ public void ConfigureApiRoute(HttpContext httpContext)
             }
         }
 
-        /// <summary>
-        /// Creates a <see cref="HttpClient" /> for processing HTTP requests/responses with the test server.
-        /// </summary>
-        public HttpClient CreateClient(string apiRoute)
-        {
-            return new HttpClient()
-            {
-                // Set the base URL for the client
-                BaseAddress = new Uri(apiRoute),
-                DefaultRequestHeaders =
-                {
-                    Accept = { new MediaTypeWithQualityHeaderValue(Utilities.JSON_CONTENT_TYPE) }
-                },
-                Timeout = TimeSpan.FromSeconds(200),
-            };
-        }
-
         // Updates the entity key name to camel case for the health check report.
         public static string LowerFirstLetter(string input)
path: src/Service/HealthCheck/HttpUtilities.cs
user: login: sezal98
body: `string graphqlObjectName = LowerFirstLetter(entity.GraphQL.Plural.Pascalize());` I did account for two words like Lastname which gets changed to `lastnames`. The function will also generate this which is what is required in GraphQL
<img width="560" alt="image" src="https://github.com/user-attachments/assets/b03966d5-4983-4cd0-adf6-3a7976eabaa5" />
However since we already have this function, modified to use this. 
created_at: 2025-04-29T07:31:48Z
author_association: CONTRIBUTOR
diff_hunk: @@ -4017,219 +4016,7 @@ public async Task HealthEndpoint_ValidateContents()
             Dictionary<string, JsonElement> responseProperties = JsonSerializer.Deserialize<Dictionary<string, JsonElement>>(responseBody);
             Assert.AreEqual(expected: HttpStatusCode.OK, actual: response.StatusCode, message: "Received unexpected HTTP code from health check endpoint.");
 
-            ValidateBasicDetailsHealthCheckResponse(responseProperties);
-        }
-
-        /// <summary>
-        /// Simulates a GET request to DAB's comprehensive health check endpoint ('/health') and validates the contents of the response.
-        /// The expected format of the response is the comprehensive health check response.
-        /// </summary>
-        [TestMethod]
-        [TestCategory(TestCategory.MSSQL)]
-        [DataRow(true, true, true, true, true, true, true, DisplayName = "Validate Health Report all enabled.")]
-        [DataRow(false, true, true, true, true, true, true, DisplayName = "Validate when Comprehensive Health Report is disabled")]
-        [DataRow(true, true, true, false, true, true, true, DisplayName = "Validate Health Report when data-source health is disabled")]
-        [DataRow(true, true, true, true, false, true, true, DisplayName = "Validate Health Report when entity health is disabled")]
-        [DataRow(true, false, true, true, true, true, true, DisplayName = "Validate Health Report when global rest health is disabled")]
-        [DataRow(true, true, true, true, true, false, true, DisplayName = "Validate Health Report when entity rest health is disabled")]
-        [DataRow(true, true, false, true, true, true, true, DisplayName = "Validate Health Report when global graphql health is disabled")]
-        [DataRow(true, true, true, true, true, true, false, DisplayName = "Validate Health Report when entity graphql health is disabled")]
-        public async Task ComprehensiveHealthEndpoint_ValidateContents(bool enableGlobalHealth, bool enableGlobalRest, bool enableGlobalGraphql, bool enableDatasourceHealth, bool enableEntityHealth, bool enableEntityRest, bool enableEntityGraphQL)
-        {
-            // Arrange
-            // At least one entity is required in the runtime config for the engine to start.
-            // Even though this entity is not under test, it must be supplied enable successful
-            // config file creation.
-            Entity requiredEntity = new(
-                Health: new(Enabled: enableEntityHealth),
-                Source: new("books", EntitySourceType.Table, null, null),
-                Rest: new(Enabled: enableEntityRest),
-                GraphQL: new("book", "books", enableEntityGraphQL),
-                Permissions: new[] { GetMinimalPermissionConfig(AuthorizationResolver.ROLE_ANONYMOUS) },
-                Relationships: null,
-                Mappings: null);
-
-            Dictionary<string, Entity> entityMap = new()
-            {
-                { "Book", requiredEntity }
-            };
-
-            CreateCustomConfigFile(entityMap, enableGlobalRest, enableGlobalGraphql, enableGlobalHealth, enableDatasourceHealth, HostMode.Development);
-
-            string[] args = new[]
-            {
-                $"--ConfigFileName={CUSTOM_CONFIG_FILENAME}"
-            };
-
-            using (TestServer server = new(Program.CreateWebHostBuilder(args)))
-            using (HttpClient client = server.CreateClient())
-            {
-                HttpRequestMessage healthRequest = new(HttpMethod.Get, "/health");
-                HttpResponseMessage response = await client.SendAsync(healthRequest);
-
-                if (!enableGlobalHealth)
-                {
-                    Assert.AreEqual(expected: HttpStatusCode.NotFound, actual: response.StatusCode, message: "Received unexpected HTTP code from health check endpoint.");
-                }
-                else
-                {
-                    string responseBody = await response.Content.ReadAsStringAsync();
-                    Dictionary<string, JsonElement> responseProperties = JsonSerializer.Deserialize<Dictionary<string, JsonElement>>(responseBody);
-                    Assert.AreEqual(expected: HttpStatusCode.OK, actual: response.StatusCode, message: "Received unexpected HTTP code from health check endpoint.");
-
-                    ValidateBasicDetailsHealthCheckResponse(responseProperties);
-                    ValidateConfigurationDetailsHealthCheckResponse(responseProperties, enableGlobalRest, enableGlobalGraphql);
-                    ValidateIfAttributePresentInResponse(responseProperties, enableDatasourceHealth, HealthCheckConstants.DATASOURCE);
-                    ValidateIfAttributePresentInResponse(responseProperties, enableEntityHealth, HealthCheckConstants.ENDPOINT);
-                    if (enableEntityHealth)
-                    {
-                        ValidateEntityRestAndGraphQLResponse(responseProperties, enableEntityRest, enableEntityGraphQL, enableGlobalRest, enableGlobalGraphql);
-                    }
-                }
-            }
-        }
-
-        private static void ValidateEntityRestAndGraphQLResponse(
-            Dictionary<string, JsonElement> responseProperties,
-            bool enableEntityRest,
-            bool enableEntityGraphQL,
-            bool enableGlobalRest,
-            bool enableGlobalGraphQL)
-        {
-            bool hasRestTag = false, hasGraphQLTag = false;
-            if (responseProperties.TryGetValue("checks", out JsonElement checksElement) && checksElement.ValueKind == JsonValueKind.Array)
-            {
-                checksElement.EnumerateArray().ToList().ForEach(entityCheck =>
-                {
-                    // Check if the 'tags' property exists and is of type array
-                    if (entityCheck.TryGetProperty("tags", out JsonElement tagsElement) && tagsElement.ValueKind == JsonValueKind.Array)
-                    {
-                        hasRestTag = hasRestTag || tagsElement.EnumerateArray().Any(tag => tag.ToString() == HealthCheckConstants.REST);
-                        hasGraphQLTag = hasGraphQLTag || tagsElement.EnumerateArray().Any(tag => tag.ToString() == HealthCheckConstants.GRAPHQL);
-                    }
-                });
-
-                if (enableGlobalRest)
-                {
-                    // When both enableEntityRest and hasRestTag match the same value
-                    Assert.AreEqual(enableEntityRest, hasRestTag);
-                }
-                else
-                {
-                    Assert.IsFalse(hasRestTag);
-                }
-
-                if (enableGlobalGraphQL)
-                {
-                    // When both enableEntityGraphQL and hasGraphQLTag match the same value
-                    Assert.AreEqual(enableEntityGraphQL, hasGraphQLTag);
-                }
-                else
-                {
-                    Assert.IsFalse(hasGraphQLTag);
-                }
-            }
-        }
-
-        private static void ValidateIfAttributePresentInResponse(
-            Dictionary<string, JsonElement> responseProperties,
-            bool enableFlag,
-            string checkString)
-        {
-            if (responseProperties.TryGetValue("checks", out JsonElement checksElement) && checksElement.ValueKind == JsonValueKind.Array)
-            {
-                bool checksTags = checksElement.EnumerateArray().Any(entityCheck =>
-                {
-                    if (entityCheck.TryGetProperty("tags", out JsonElement tagsElement) && tagsElement.ValueKind == JsonValueKind.Array)
-                    {
-                        return tagsElement.EnumerateArray().Any(tag => tag.ToString() == checkString);
-                    }
-
-                    return false;
-                });
-
-                Assert.AreEqual(enableFlag, checksTags);
-            }
-            else
-            {
-                Assert.Fail("Checks array is not present in the Comprehensive Health Check Report.");
-            }
-        }
-
-        private static void ValidateConfigurationIsNotNull(Dictionary<string, JsonElement> configPropertyValues, string objectKey)
-        {
-            Assert.IsTrue(configPropertyValues.ContainsKey(objectKey), $"Expected {objectKey} to be present in the configuration object.");
-            Assert.IsNotNull(configPropertyValues[objectKey], $"Expected {objectKey} to be non-null.");
-        }
-
-        private static void ValidateConfigurationIsCorrectFlag(Dictionary<string, JsonElement> configElement, string objectKey, bool enableFlag)
-        {
-            Assert.AreEqual(enableFlag, configElement[objectKey].GetBoolean(), $"Expected {objectKey} to be set to {enableFlag}.");
-        }
-
-        private static void ValidateConfigurationDetailsHealthCheckResponse(Dictionary<string, JsonElement> responseProperties, bool enableGlobalRest, bool enableGlobalGraphQL)
-        {
-            if (responseProperties.TryGetValue("configuration", out JsonElement configElement) && configElement.ValueKind == JsonValueKind.Object)
-            {
-                Dictionary<string, JsonElement> configPropertyValues = new();
-
-                // Enumerate through the configProperty's object properties and add them to the dictionary
-                foreach (JsonProperty property in configElement.EnumerateObject().ToList())
-                {
-                    configPropertyValues[property.Name] = property.Value;
-                }
-
-                ValidateConfigurationIsNotNull(configPropertyValues, "rest");
-                ValidateConfigurationIsCorrectFlag(configPropertyValues, "rest", enableGlobalRest);
-                ValidateConfigurationIsNotNull(configPropertyValues, "graphql");
-                ValidateConfigurationIsCorrectFlag(configPropertyValues, "graphql", enableGlobalGraphQL);
-                ValidateConfigurationIsNotNull(configPropertyValues, "caching");
-                ValidateConfigurationIsNotNull(configPropertyValues, "telemetry");
-                ValidateConfigurationIsNotNull(configPropertyValues, "mode");
-            }
-            else
-            {
-                Assert.Fail("Missing 'configuration' object in Health Check Response.");
-            }
-        }
-
-        private static void ValidateBasicDetailsHealthCheckResponse(Dictionary<string, JsonElement> responseProperties)
-        {
-            // Validate value of 'status' property in reponse.
-            if (responseProperties.TryGetValue(key: "status", out JsonElement statusValue))
-            {
-                Assert.IsTrue(statusValue.ValueKind == JsonValueKind.String, "Unexpected or missing status value as string.");
-            }
-            else
-            {
-                Assert.Fail();
-            }
-
-            // Validate value of 'version' property in response.
-            if (responseProperties.TryGetValue(key: BasicHealthCheck.DAB_VERSION_KEY, out JsonElement versionValue))
-            {
-                Assert.AreEqual(
-                    expected: ProductInfo.GetProductVersion(),
-                    actual: versionValue.ToString(),
-                    message: "Unexpected or missing version value.");
-            }
-            else
-            {
-                Assert.Fail();
-            }
-
-            // Validate value of 'app-name' property in response.
-            if (responseProperties.TryGetValue(key: BasicHealthCheck.DAB_APPNAME_KEY, out JsonElement appNameValue))
-            {
-                Assert.AreEqual(
-                    expected: ProductInfo.GetDataApiBuilderUserAgent(),
-                    actual: appNameValue.ToString(),
-                    message: "Unexpected or missing DAB user agent string.");
-            }
-            else
-            {
-                Assert.Fail();
-            }
+            HealthEndpointTests.ValidateBasicDetailsHealthCheckResponse(responseProperties);
path: src/Service.Tests/Configuration/ConfigurationTests.cs
user: login: Aniruddh25
body: nit: missing tab to align with previous code 
created_at: 2025-05-01T00:50:25Z
author_association: COLLABORATOR
diff_hunk: @@ -4667,22 +4454,20 @@ public async Task TestNoDepthLimitOnGrahQLInNonHostedMode(int? depthLimit)
         /// </summary>
         /// <param name="entityMap">Collection of entityName -> Entity object.</param>
         /// <param name="enableGlobalRest">flag to enable or disabled REST globally.</param>
-        private static void CreateCustomConfigFile(Dictionary<string, Entity> entityMap, bool enableGlobalRest = true, bool enableGlobalGraphql = true, bool enableGlobalHealth = true, bool enableDatasourceHealth = true, HostMode hostMode = HostMode.Production)
+        private static void CreateCustomConfigFile(Dictionary<string, Entity> entityMap, bool enableGlobalRest = true)
path: src/Service.Tests/Configuration/ConfigurationTests.cs
user: login: Aniruddh25
body: Is `enableGlobalGraphQL` not used by any of the existing tests?
created_at: 2025-05-01T00:52:19Z
author_association: COLLABORATOR
diff_hunk: @@ -270,6 +271,27 @@ public void ConfigureServices(IServiceCollection services)
             //Enable accessing HttpContext in RestService to get ClaimsPrincipal.
             services.AddHttpContextAccessor();
 
+            services.AddHttpClient("ContextConfiguredHealthCheckClient")
+                .ConfigureHttpClient((serviceProvider, client) =>
+                {
path: src/Service/Startup.cs
user: login: Aniruddh25
body: does adding HttpClient to the service provider help with testing? 
created_at: 2025-05-01T01:05:06Z
author_association: COLLABORATOR
diff_hunk: @@ -0,0 +1,437 @@
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT License.
+
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.IO.Abstractions.TestingHelpers;
+using System.Linq;
+using System.Net;
+using System.Net.Http;
+using System.Text.Json;
+using System.Threading;
+using System.Threading.Tasks;
+using Azure.DataApiBuilder.Config;
+using Azure.DataApiBuilder.Config.DatabasePrimitives;
+using Azure.DataApiBuilder.Config.HealthCheck;
+using Azure.DataApiBuilder.Config.ObjectModel;
+using Azure.DataApiBuilder.Core.Authorization;
+using Azure.DataApiBuilder.Core.Configurations;
+using Azure.DataApiBuilder.Core.Services;
+using Azure.DataApiBuilder.Core.Services.MetadataProviders;
+using Azure.DataApiBuilder.Product;
+using Azure.DataApiBuilder.Service.HealthCheck;
+using Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.TestHost;
+using Microsoft.Extensions.Logging;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Moq;
+using Moq.Protected;
+
+namespace Azure.DataApiBuilder.Service.Tests.Configuration
+{
+    [TestClass]
+    public class HealthEndpointTests
+    {
+        private const string CUSTOM_CONFIG_FILENAME = "custom_config.json";
+
+        [TestCleanup]
+        public void CleanupAfterEachTest()
+        {
+            if (File.Exists(CUSTOM_CONFIG_FILENAME))
+            {
+                File.Delete(CUSTOM_CONFIG_FILENAME);
+            }
+
+            TestHelper.UnsetAllDABEnvironmentVariables();
+        }
+
+        /// <summary>
+        /// Simulates a GET request to DAB's comprehensive health check endpoint ('/health') and validates the contents of the response.
+        /// The expected format of the response is the comprehensive health check response.
+        /// </summary>
+        [TestMethod]
+        [TestCategory(TestCategory.MSSQL)]
+        [DataRow(true, true, true, true, true, true, true, DisplayName = "Validate Health Report all enabled.")]
+        [DataRow(false, true, true, true, true, true, true, DisplayName = "Validate when Comprehensive Health Report is disabled")]
+        [DataRow(true, true, true, false, true, true, true, DisplayName = "Validate Health Report when data-source health is disabled")]
+        [DataRow(true, true, true, true, false, true, true, DisplayName = "Validate Health Report when entity health is disabled")]
+        [DataRow(true, false, true, true, true, true, true, DisplayName = "Validate Health Report when global rest health is disabled")]
+        [DataRow(true, true, true, true, true, false, true, DisplayName = "Validate Health Report when entity rest health is disabled")]
+        [DataRow(true, true, false, true, true, true, true, DisplayName = "Validate Health Report when global graphql health is disabled")]
+        [DataRow(true, true, true, true, true, true, false, DisplayName = "Validate Health Report when entity graphql health is disabled")]
+        public async Task ComprehensiveHealthEndpoint_ValidateContents(bool enableGlobalHealth, bool enableGlobalRest, bool enableGlobalGraphql, bool enableDatasourceHealth, bool enableEntityHealth, bool enableEntityRest, bool enableEntityGraphQL)
+        {
+            // Arrange
+            // Create a mock entity map with a single entity for testing
+            RuntimeConfig runtimeConfig = SetupCustomConfigFile(enableGlobalHealth, enableGlobalRest, enableGlobalGraphql, enableDatasourceHealth, enableEntityHealth, enableEntityRest, enableEntityGraphQL);
+            WriteToCustomConfigFile(runtimeConfig);
+
+            string[] args = new[]
+            {
+                $"--ConfigFileName={CUSTOM_CONFIG_FILENAME}"
+            };
+
+            using (TestServer server = new(Program.CreateWebHostBuilder(args)))
+            using (HttpClient client = server.CreateClient())
+            {
+                HttpRequestMessage healthRequest = new(HttpMethod.Get, "http://localhost:5000/health");
+                HttpResponseMessage response = await client.SendAsync(healthRequest);
+
+                if (!enableGlobalHealth)
+                {
+                    Assert.AreEqual(expected: HttpStatusCode.NotFound, actual: response.StatusCode, message: "Received unexpected HTTP code from health check endpoint.");
+                }
+                else
+                {
+                    string responseBody = await response.Content.ReadAsStringAsync();
+                    Dictionary<string, JsonElement> responseProperties = JsonSerializer.Deserialize<Dictionary<string, JsonElement>>(responseBody);
+                    Assert.AreEqual(expected: HttpStatusCode.OK, actual: response.StatusCode, message: "Received unexpected HTTP code from health check endpoint.");
+
+                    ValidateBasicDetailsHealthCheckResponse(responseProperties);
+                    ValidateConfigurationDetailsHealthCheckResponse(responseProperties, enableGlobalRest, enableGlobalGraphql);
+                    ValidateIfAttributePresentInResponse(responseProperties, enableDatasourceHealth, HealthCheckConstants.DATASOURCE);
+                    ValidateIfAttributePresentInResponse(responseProperties, enableEntityHealth, HealthCheckConstants.ENDPOINT);
+                    if (enableEntityHealth)
+                    {
+                        ValidateEntityRestAndGraphQLResponse(responseProperties, enableEntityRest, enableEntityGraphQL, enableGlobalRest, enableGlobalGraphql);
+                    }
+                }
+            }
+        }
+
+        [TestMethod]
+        public async Task TestHealthCheckRestResponse()
+        {
+            // Arrange
+            // Create a mock entity map with a single entity for testing and load in RuntimeConfigProvider
+            RuntimeConfig runtimeConfig = SetupCustomConfigFile(true, true, true, true, true, true, true);
+            Mock<IMetadataProviderFactory> metadataProviderFactory = new();
+            MockFileSystem fileSystem = new();
+            fileSystem.AddFile(FileSystemRuntimeConfigLoader.DEFAULT_CONFIG_FILE_NAME, new MockFileData(runtimeConfig.ToJson()));
+            FileSystemRuntimeConfigLoader loader = new(fileSystem);
+            RuntimeConfigProvider provider = new(loader);
+
+            // Create a Mock of HttpMessageHandler
+            Mock<HttpMessageHandler> mockHandler = new();
+            // Mocking the handler to return a specific response for SendAsync
+            mockHandler.Protected()
+                .Setup<Task<HttpResponseMessage>>(
+                    "SendAsync",
+                    ItExpr.Is<HttpRequestMessage>(req =>
+                        req.Method == HttpMethod.Get
+                        && req.RequestUri.Equals($"http://localhost:5000/{runtimeConfig.RestPath.Trim('/')}/{runtimeConfig.Entities.First().Key}?$first={runtimeConfig.Entities.First().Value.Health.First}")),
+                    ItExpr.IsAny<CancellationToken>())
+                .ReturnsAsync(new HttpResponseMessage(System.Net.HttpStatusCode.OK)
+                {
+                    Content = new StringContent("{\"message\":\"Rest response\"}")
+                });
+
+            // Mocking IHttpClientFactory
+            Mock<IHttpClientFactory> mockHttpClientFactory = new();
+            mockHttpClientFactory.Setup(x => x.CreateClient("ContextConfiguredHealthCheckClient"))
+                .Returns(new HttpClient(mockHandler.Object)
+                {
+                    BaseAddress = new Uri("http://localhost:5000")
+                });
+
+            Mock<ILogger<HttpUtilities>> _logger = new();
+
+            // Create the mock HttpContext to return the expected scheme and host
+            // when the ConfigureApiRoute method is called.
+            Mock<HttpContext> mockHttpContext = new();
+            Mock<HttpRequest> mockHttpRequest = new();
+            mockHttpRequest.Setup(r => r.Scheme).Returns("http");
+            mockHttpRequest.Setup(r => r.Host).Returns(new HostString("localhost", 5000));
+            mockHttpContext.Setup(c => c.Request).Returns(mockHttpRequest.Object);
+
+            HttpUtilities httpUtilities = new(
+                _logger.Object,
+                metadataProviderFactory.Object,
+                provider,
+                mockHttpClientFactory.Object);
+
+            // Act
+            // Call the ExecuteRestQuery method with the mock HttpClient
+            // Simulate a REST API call to the endpoint
+            // Response should be null as error message is not expected to be returned
+            string errorMessageFromRest = await httpUtilities.ExecuteRestQuery(
+                restUriSuffix: runtimeConfig.RestPath,
+                entityName: runtimeConfig.Entities.First().Key,
+                first: runtimeConfig.Entities.First().Value.Health.First,
+                incomingRoleHeader: string.Empty,
+                incomingRoleToken: string.Empty
+            );
+
+            // Assert
+            // Validate the null response from the REST API call 
+            Assert.IsNull(errorMessageFromRest);
+        }
+
+        [TestMethod]
+        public void TestHealthCheckGraphQLResponse()
+        {
+            // Arrange
+            // Create a mock entity map with a single entity for testing and load in RuntimeConfigProvider
+            RuntimeConfig runtimeConfig = SetupCustomConfigFile(true, true, true, true, true, true, true);
+            MockFileSystem fileSystem = new();
+            fileSystem.AddFile(FileSystemRuntimeConfigLoader.DEFAULT_CONFIG_FILE_NAME, new MockFileData(runtimeConfig.ToJson()));
+            FileSystemRuntimeConfigLoader loader = new(fileSystem);
+            RuntimeConfigProvider provider = new(loader);
+            Mock<IMetadataProviderFactory> metadataProviderFactory = new();
+            Mock<ISqlMetadataProvider> sqlMetadataProvider = new();
+
+            // Setup the mock database object with a source definition
+            SourceDefinition sourceDef = new();
+            sourceDef.Columns.Add("id", new ColumnDefinition());
+            sourceDef.Columns.Add("title", new ColumnDefinition());
+            // Mock DB Object to return the source definition
+            Mock<DatabaseObject> mockDbObject = new();
+            mockDbObject.SetupGet(x => x.SourceDefinition).Returns(sourceDef);
+            // Mocking the metadata provider to return the mock database object
+            sqlMetadataProvider.Setup(x => x.GetDatabaseObjectByKey(runtimeConfig.Entities.First().Key)).Returns(mockDbObject.Object);
+            metadataProviderFactory.Setup(x => x.GetMetadataProvider(It.IsAny<string>())).Returns(sqlMetadataProvider.Object);
+
+            Mock<HttpMessageHandler> mockHandler = new();
+            mockHandler.Protected()
+                .Setup<Task<HttpResponseMessage>>(
+                    "SendAsync",
+                    ItExpr.Is<HttpRequestMessage>(req =>
+                        req.Method == HttpMethod.Post &&
+                        req.RequestUri == new Uri("http://localhost:5000/graphql") &&
+                        req.Content.ReadAsStringAsync().Result.Equals("{\"query\":\"{books (first: 100) {items { id title }}}\"}")), // Use the correct GraphQL query format
+                    ItExpr.IsAny<CancellationToken>())
+                .ReturnsAsync(new HttpResponseMessage(System.Net.HttpStatusCode.OK)
+                {
+                    Content = new StringContent("{\"data\":{\"books\":[{\"id\":1,\"title\":\"Test Book\"}]}}")
+                });
+
+            Mock<IHttpClientFactory> mockHttpClientFactory = new();
+            mockHttpClientFactory.Setup(x => x.CreateClient("ContextConfiguredHealthCheckClient"))
+                .Returns(new HttpClient(mockHandler.Object)
+                {
+                    BaseAddress = new Uri("http://localhost:5000")
+                });
+
+            Mock<ILogger<HttpUtilities>> logger = new();
+
+            HttpUtilities httpUtilities = new(
+                logger.Object,
+                metadataProviderFactory.Object,
+                provider,
+                mockHttpClientFactory.Object);
+
+            // Act
+            string errorMessageFromGraphQL = httpUtilities.ExecuteGraphQLQuery(
+                graphqlUriSuffix: "/graphql",
+                entityName: runtimeConfig.Entities.First().Key,
path: src/Service.Tests/Configuration/HealthEndpointTests.cs
user: login: Aniruddh25
body: Would this test have caught the bug reported in this https://github.com/Azure/data-api-builder/issues/2645 ?
created_at: 2025-05-01T01:18:04Z
author_association: COLLABORATOR
diff_hunk: @@ -0,0 +1,437 @@
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT License.
+
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.IO.Abstractions.TestingHelpers;
+using System.Linq;
+using System.Net;
+using System.Net.Http;
+using System.Text.Json;
+using System.Threading;
+using System.Threading.Tasks;
+using Azure.DataApiBuilder.Config;
+using Azure.DataApiBuilder.Config.DatabasePrimitives;
+using Azure.DataApiBuilder.Config.HealthCheck;
+using Azure.DataApiBuilder.Config.ObjectModel;
+using Azure.DataApiBuilder.Core.Authorization;
+using Azure.DataApiBuilder.Core.Configurations;
+using Azure.DataApiBuilder.Core.Services;
+using Azure.DataApiBuilder.Core.Services.MetadataProviders;
+using Azure.DataApiBuilder.Product;
+using Azure.DataApiBuilder.Service.HealthCheck;
+using Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.TestHost;
+using Microsoft.Extensions.Logging;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Moq;
+using Moq.Protected;
+
+namespace Azure.DataApiBuilder.Service.Tests.Configuration
+{
+    [TestClass]
+    public class HealthEndpointTests
+    {
+        private const string CUSTOM_CONFIG_FILENAME = "custom_config.json";
+
+        [TestCleanup]
+        public void CleanupAfterEachTest()
+        {
+            if (File.Exists(CUSTOM_CONFIG_FILENAME))
+            {
+                File.Delete(CUSTOM_CONFIG_FILENAME);
+            }
+
+            TestHelper.UnsetAllDABEnvironmentVariables();
+        }
+
+        /// <summary>
+        /// Simulates a GET request to DAB's comprehensive health check endpoint ('/health') and validates the contents of the response.
+        /// The expected format of the response is the comprehensive health check response.
+        /// </summary>
+        [TestMethod]
+        [TestCategory(TestCategory.MSSQL)]
+        [DataRow(true, true, true, true, true, true, true, DisplayName = "Validate Health Report all enabled.")]
+        [DataRow(false, true, true, true, true, true, true, DisplayName = "Validate when Comprehensive Health Report is disabled")]
+        [DataRow(true, true, true, false, true, true, true, DisplayName = "Validate Health Report when data-source health is disabled")]
+        [DataRow(true, true, true, true, false, true, true, DisplayName = "Validate Health Report when entity health is disabled")]
+        [DataRow(true, false, true, true, true, true, true, DisplayName = "Validate Health Report when global rest health is disabled")]
+        [DataRow(true, true, true, true, true, false, true, DisplayName = "Validate Health Report when entity rest health is disabled")]
+        [DataRow(true, true, false, true, true, true, true, DisplayName = "Validate Health Report when global graphql health is disabled")]
+        [DataRow(true, true, true, true, true, true, false, DisplayName = "Validate Health Report when entity graphql health is disabled")]
+        public async Task ComprehensiveHealthEndpoint_ValidateContents(bool enableGlobalHealth, bool enableGlobalRest, bool enableGlobalGraphql, bool enableDatasourceHealth, bool enableEntityHealth, bool enableEntityRest, bool enableEntityGraphQL)
+        {
+            // Arrange
+            // Create a mock entity map with a single entity for testing
+            RuntimeConfig runtimeConfig = SetupCustomConfigFile(enableGlobalHealth, enableGlobalRest, enableGlobalGraphql, enableDatasourceHealth, enableEntityHealth, enableEntityRest, enableEntityGraphQL);
+            WriteToCustomConfigFile(runtimeConfig);
+
+            string[] args = new[]
+            {
+                $"--ConfigFileName={CUSTOM_CONFIG_FILENAME}"
+            };
+
+            using (TestServer server = new(Program.CreateWebHostBuilder(args)))
+            using (HttpClient client = server.CreateClient())
+            {
+                HttpRequestMessage healthRequest = new(HttpMethod.Get, "http://localhost:5000/health");
+                HttpResponseMessage response = await client.SendAsync(healthRequest);
+
+                if (!enableGlobalHealth)
+                {
+                    Assert.AreEqual(expected: HttpStatusCode.NotFound, actual: response.StatusCode, message: "Received unexpected HTTP code from health check endpoint.");
+                }
+                else
+                {
+                    string responseBody = await response.Content.ReadAsStringAsync();
+                    Dictionary<string, JsonElement> responseProperties = JsonSerializer.Deserialize<Dictionary<string, JsonElement>>(responseBody);
+                    Assert.AreEqual(expected: HttpStatusCode.OK, actual: response.StatusCode, message: "Received unexpected HTTP code from health check endpoint.");
+
+                    ValidateBasicDetailsHealthCheckResponse(responseProperties);
+                    ValidateConfigurationDetailsHealthCheckResponse(responseProperties, enableGlobalRest, enableGlobalGraphql);
+                    ValidateIfAttributePresentInResponse(responseProperties, enableDatasourceHealth, HealthCheckConstants.DATASOURCE);
+                    ValidateIfAttributePresentInResponse(responseProperties, enableEntityHealth, HealthCheckConstants.ENDPOINT);
+                    if (enableEntityHealth)
+                    {
+                        ValidateEntityRestAndGraphQLResponse(responseProperties, enableEntityRest, enableEntityGraphQL, enableGlobalRest, enableGlobalGraphql);
+                    }
+                }
+            }
+        }
+
+        [TestMethod]
+        public async Task TestHealthCheckRestResponse()
+        {
+            // Arrange
+            // Create a mock entity map with a single entity for testing and load in RuntimeConfigProvider
+            RuntimeConfig runtimeConfig = SetupCustomConfigFile(true, true, true, true, true, true, true);
+            Mock<IMetadataProviderFactory> metadataProviderFactory = new();
+            MockFileSystem fileSystem = new();
+            fileSystem.AddFile(FileSystemRuntimeConfigLoader.DEFAULT_CONFIG_FILE_NAME, new MockFileData(runtimeConfig.ToJson()));
+            FileSystemRuntimeConfigLoader loader = new(fileSystem);
+            RuntimeConfigProvider provider = new(loader);
+
+            // Create a Mock of HttpMessageHandler
+            Mock<HttpMessageHandler> mockHandler = new();
+            // Mocking the handler to return a specific response for SendAsync
+            mockHandler.Protected()
+                .Setup<Task<HttpResponseMessage>>(
+                    "SendAsync",
+                    ItExpr.Is<HttpRequestMessage>(req =>
+                        req.Method == HttpMethod.Get
+                        && req.RequestUri.Equals($"http://localhost:5000/{runtimeConfig.RestPath.Trim('/')}/{runtimeConfig.Entities.First().Key}?$first={runtimeConfig.Entities.First().Value.Health.First}")),
+                    ItExpr.IsAny<CancellationToken>())
+                .ReturnsAsync(new HttpResponseMessage(System.Net.HttpStatusCode.OK)
+                {
+                    Content = new StringContent("{\"message\":\"Rest response\"}")
+                });
+
+            // Mocking IHttpClientFactory
+            Mock<IHttpClientFactory> mockHttpClientFactory = new();
+            mockHttpClientFactory.Setup(x => x.CreateClient("ContextConfiguredHealthCheckClient"))
+                .Returns(new HttpClient(mockHandler.Object)
+                {
+                    BaseAddress = new Uri("http://localhost:5000")
+                });
+
+            Mock<ILogger<HttpUtilities>> _logger = new();
+
+            // Create the mock HttpContext to return the expected scheme and host
+            // when the ConfigureApiRoute method is called.
+            Mock<HttpContext> mockHttpContext = new();
+            Mock<HttpRequest> mockHttpRequest = new();
+            mockHttpRequest.Setup(r => r.Scheme).Returns("http");
+            mockHttpRequest.Setup(r => r.Host).Returns(new HostString("localhost", 5000));
+            mockHttpContext.Setup(c => c.Request).Returns(mockHttpRequest.Object);
+
+            HttpUtilities httpUtilities = new(
+                _logger.Object,
+                metadataProviderFactory.Object,
+                provider,
+                mockHttpClientFactory.Object);
+
+            // Act
+            // Call the ExecuteRestQuery method with the mock HttpClient
+            // Simulate a REST API call to the endpoint
+            // Response should be null as error message is not expected to be returned
+            string errorMessageFromRest = await httpUtilities.ExecuteRestQuery(
+                restUriSuffix: runtimeConfig.RestPath,
+                entityName: runtimeConfig.Entities.First().Key,
+                first: runtimeConfig.Entities.First().Value.Health.First,
+                incomingRoleHeader: string.Empty,
+                incomingRoleToken: string.Empty
+            );
+
+            // Assert
+            // Validate the null response from the REST API call 
+            Assert.IsNull(errorMessageFromRest);
+        }
+
+        [TestMethod]
+        public void TestHealthCheckGraphQLResponse()
+        {
+            // Arrange
+            // Create a mock entity map with a single entity for testing and load in RuntimeConfigProvider
+            RuntimeConfig runtimeConfig = SetupCustomConfigFile(true, true, true, true, true, true, true);
+            MockFileSystem fileSystem = new();
+            fileSystem.AddFile(FileSystemRuntimeConfigLoader.DEFAULT_CONFIG_FILE_NAME, new MockFileData(runtimeConfig.ToJson()));
+            FileSystemRuntimeConfigLoader loader = new(fileSystem);
+            RuntimeConfigProvider provider = new(loader);
+            Mock<IMetadataProviderFactory> metadataProviderFactory = new();
+            Mock<ISqlMetadataProvider> sqlMetadataProvider = new();
+
+            // Setup the mock database object with a source definition
+            SourceDefinition sourceDef = new();
+            sourceDef.Columns.Add("id", new ColumnDefinition());
+            sourceDef.Columns.Add("title", new ColumnDefinition());
+            // Mock DB Object to return the source definition
+            Mock<DatabaseObject> mockDbObject = new();
+            mockDbObject.SetupGet(x => x.SourceDefinition).Returns(sourceDef);
+            // Mocking the metadata provider to return the mock database object
+            sqlMetadataProvider.Setup(x => x.GetDatabaseObjectByKey(runtimeConfig.Entities.First().Key)).Returns(mockDbObject.Object);
+            metadataProviderFactory.Setup(x => x.GetMetadataProvider(It.IsAny<string>())).Returns(sqlMetadataProvider.Object);
+
+            Mock<HttpMessageHandler> mockHandler = new();
+            mockHandler.Protected()
+                .Setup<Task<HttpResponseMessage>>(
+                    "SendAsync",
+                    ItExpr.Is<HttpRequestMessage>(req =>
+                        req.Method == HttpMethod.Post &&
+                        req.RequestUri == new Uri("http://localhost:5000/graphql") &&
+                        req.Content.ReadAsStringAsync().Result.Equals("{\"query\":\"{books (first: 100) {items { id title }}}\"}")), // Use the correct GraphQL query format
+                    ItExpr.IsAny<CancellationToken>())
+                .ReturnsAsync(new HttpResponseMessage(System.Net.HttpStatusCode.OK)
+                {
+                    Content = new StringContent("{\"data\":{\"books\":[{\"id\":1,\"title\":\"Test Book\"}]}}")
+                });
+
+            Mock<IHttpClientFactory> mockHttpClientFactory = new();
+            mockHttpClientFactory.Setup(x => x.CreateClient("ContextConfiguredHealthCheckClient"))
+                .Returns(new HttpClient(mockHandler.Object)
+                {
+                    BaseAddress = new Uri("http://localhost:5000")
+                });
+
+            Mock<ILogger<HttpUtilities>> logger = new();
+
+            HttpUtilities httpUtilities = new(
+                logger.Object,
+                metadataProviderFactory.Object,
+                provider,
+                mockHttpClientFactory.Object);
+
+            // Act
+            string errorMessageFromGraphQL = httpUtilities.ExecuteGraphQLQuery(
+                graphqlUriSuffix: "/graphql",
+                entityName: runtimeConfig.Entities.First().Key,
+                entity: runtimeConfig.Entities.First().Value,
+                incomingRoleHeader: string.Empty,
+                incomingRoleToken: string.Empty);
+
+            // Assert
+            Assert.IsNull(errorMessageFromGraphQL);
path: src/Service.Tests/Configuration/HealthEndpointTests.cs
user: login: Aniruddh25
body: We should have a test for the failure case as well. Mock a failed response, and verify the httputilities returns the error
created_at: 2025-05-01T01:19:48Z
author_association: COLLABORATOR
diff_hunk: @@ -4017,219 +4016,7 @@ public async Task HealthEndpoint_ValidateContents()
             Dictionary<string, JsonElement> responseProperties = JsonSerializer.Deserialize<Dictionary<string, JsonElement>>(responseBody);
             Assert.AreEqual(expected: HttpStatusCode.OK, actual: response.StatusCode, message: "Received unexpected HTTP code from health check endpoint.");
 
-            ValidateBasicDetailsHealthCheckResponse(responseProperties);
-        }
-
-        /// <summary>
-        /// Simulates a GET request to DAB's comprehensive health check endpoint ('/health') and validates the contents of the response.
-        /// The expected format of the response is the comprehensive health check response.
-        /// </summary>
-        [TestMethod]
-        [TestCategory(TestCategory.MSSQL)]
-        [DataRow(true, true, true, true, true, true, true, DisplayName = "Validate Health Report all enabled.")]
-        [DataRow(false, true, true, true, true, true, true, DisplayName = "Validate when Comprehensive Health Report is disabled")]
-        [DataRow(true, true, true, false, true, true, true, DisplayName = "Validate Health Report when data-source health is disabled")]
-        [DataRow(true, true, true, true, false, true, true, DisplayName = "Validate Health Report when entity health is disabled")]
-        [DataRow(true, false, true, true, true, true, true, DisplayName = "Validate Health Report when global rest health is disabled")]
-        [DataRow(true, true, true, true, true, false, true, DisplayName = "Validate Health Report when entity rest health is disabled")]
-        [DataRow(true, true, false, true, true, true, true, DisplayName = "Validate Health Report when global graphql health is disabled")]
-        [DataRow(true, true, true, true, true, true, false, DisplayName = "Validate Health Report when entity graphql health is disabled")]
-        public async Task ComprehensiveHealthEndpoint_ValidateContents(bool enableGlobalHealth, bool enableGlobalRest, bool enableGlobalGraphql, bool enableDatasourceHealth, bool enableEntityHealth, bool enableEntityRest, bool enableEntityGraphQL)
-        {
-            // Arrange
-            // At least one entity is required in the runtime config for the engine to start.
-            // Even though this entity is not under test, it must be supplied enable successful
-            // config file creation.
-            Entity requiredEntity = new(
-                Health: new(Enabled: enableEntityHealth),
-                Source: new("books", EntitySourceType.Table, null, null),
-                Rest: new(Enabled: enableEntityRest),
-                GraphQL: new("book", "books", enableEntityGraphQL),
-                Permissions: new[] { GetMinimalPermissionConfig(AuthorizationResolver.ROLE_ANONYMOUS) },
-                Relationships: null,
-                Mappings: null);
-
-            Dictionary<string, Entity> entityMap = new()
-            {
-                { "Book", requiredEntity }
-            };
-
-            CreateCustomConfigFile(entityMap, enableGlobalRest, enableGlobalGraphql, enableGlobalHealth, enableDatasourceHealth, HostMode.Development);
-
-            string[] args = new[]
-            {
-                $"--ConfigFileName={CUSTOM_CONFIG_FILENAME}"
-            };
-
-            using (TestServer server = new(Program.CreateWebHostBuilder(args)))
-            using (HttpClient client = server.CreateClient())
-            {
-                HttpRequestMessage healthRequest = new(HttpMethod.Get, "/health");
-                HttpResponseMessage response = await client.SendAsync(healthRequest);
-
-                if (!enableGlobalHealth)
-                {
-                    Assert.AreEqual(expected: HttpStatusCode.NotFound, actual: response.StatusCode, message: "Received unexpected HTTP code from health check endpoint.");
-                }
-                else
-                {
-                    string responseBody = await response.Content.ReadAsStringAsync();
-                    Dictionary<string, JsonElement> responseProperties = JsonSerializer.Deserialize<Dictionary<string, JsonElement>>(responseBody);
-                    Assert.AreEqual(expected: HttpStatusCode.OK, actual: response.StatusCode, message: "Received unexpected HTTP code from health check endpoint.");
-
-                    ValidateBasicDetailsHealthCheckResponse(responseProperties);
-                    ValidateConfigurationDetailsHealthCheckResponse(responseProperties, enableGlobalRest, enableGlobalGraphql);
-                    ValidateIfAttributePresentInResponse(responseProperties, enableDatasourceHealth, HealthCheckConstants.DATASOURCE);
-                    ValidateIfAttributePresentInResponse(responseProperties, enableEntityHealth, HealthCheckConstants.ENDPOINT);
-                    if (enableEntityHealth)
-                    {
-                        ValidateEntityRestAndGraphQLResponse(responseProperties, enableEntityRest, enableEntityGraphQL, enableGlobalRest, enableGlobalGraphql);
-                    }
-                }
-            }
-        }
-
-        private static void ValidateEntityRestAndGraphQLResponse(
-            Dictionary<string, JsonElement> responseProperties,
-            bool enableEntityRest,
-            bool enableEntityGraphQL,
-            bool enableGlobalRest,
-            bool enableGlobalGraphQL)
-        {
-            bool hasRestTag = false, hasGraphQLTag = false;
-            if (responseProperties.TryGetValue("checks", out JsonElement checksElement) && checksElement.ValueKind == JsonValueKind.Array)
-            {
-                checksElement.EnumerateArray().ToList().ForEach(entityCheck =>
-                {
-                    // Check if the 'tags' property exists and is of type array
-                    if (entityCheck.TryGetProperty("tags", out JsonElement tagsElement) && tagsElement.ValueKind == JsonValueKind.Array)
-                    {
-                        hasRestTag = hasRestTag || tagsElement.EnumerateArray().Any(tag => tag.ToString() == HealthCheckConstants.REST);
-                        hasGraphQLTag = hasGraphQLTag || tagsElement.EnumerateArray().Any(tag => tag.ToString() == HealthCheckConstants.GRAPHQL);
-                    }
-                });
-
-                if (enableGlobalRest)
-                {
-                    // When both enableEntityRest and hasRestTag match the same value
-                    Assert.AreEqual(enableEntityRest, hasRestTag);
-                }
-                else
-                {
-                    Assert.IsFalse(hasRestTag);
-                }
-
-                if (enableGlobalGraphQL)
-                {
-                    // When both enableEntityGraphQL and hasGraphQLTag match the same value
-                    Assert.AreEqual(enableEntityGraphQL, hasGraphQLTag);
-                }
-                else
-                {
-                    Assert.IsFalse(hasGraphQLTag);
-                }
-            }
-        }
-
-        private static void ValidateIfAttributePresentInResponse(
-            Dictionary<string, JsonElement> responseProperties,
-            bool enableFlag,
-            string checkString)
-        {
-            if (responseProperties.TryGetValue("checks", out JsonElement checksElement) && checksElement.ValueKind == JsonValueKind.Array)
-            {
-                bool checksTags = checksElement.EnumerateArray().Any(entityCheck =>
-                {
-                    if (entityCheck.TryGetProperty("tags", out JsonElement tagsElement) && tagsElement.ValueKind == JsonValueKind.Array)
-                    {
-                        return tagsElement.EnumerateArray().Any(tag => tag.ToString() == checkString);
-                    }
-
-                    return false;
-                });
-
-                Assert.AreEqual(enableFlag, checksTags);
-            }
-            else
-            {
-                Assert.Fail("Checks array is not present in the Comprehensive Health Check Report.");
-            }
-        }
-
-        private static void ValidateConfigurationIsNotNull(Dictionary<string, JsonElement> configPropertyValues, string objectKey)
-        {
-            Assert.IsTrue(configPropertyValues.ContainsKey(objectKey), $"Expected {objectKey} to be present in the configuration object.");
-            Assert.IsNotNull(configPropertyValues[objectKey], $"Expected {objectKey} to be non-null.");
-        }
-
-        private static void ValidateConfigurationIsCorrectFlag(Dictionary<string, JsonElement> configElement, string objectKey, bool enableFlag)
-        {
-            Assert.AreEqual(enableFlag, configElement[objectKey].GetBoolean(), $"Expected {objectKey} to be set to {enableFlag}.");
-        }
-
-        private static void ValidateConfigurationDetailsHealthCheckResponse(Dictionary<string, JsonElement> responseProperties, bool enableGlobalRest, bool enableGlobalGraphQL)
-        {
-            if (responseProperties.TryGetValue("configuration", out JsonElement configElement) && configElement.ValueKind == JsonValueKind.Object)
-            {
-                Dictionary<string, JsonElement> configPropertyValues = new();
-
-                // Enumerate through the configProperty's object properties and add them to the dictionary
-                foreach (JsonProperty property in configElement.EnumerateObject().ToList())
-                {
-                    configPropertyValues[property.Name] = property.Value;
-                }
-
-                ValidateConfigurationIsNotNull(configPropertyValues, "rest");
-                ValidateConfigurationIsCorrectFlag(configPropertyValues, "rest", enableGlobalRest);
-                ValidateConfigurationIsNotNull(configPropertyValues, "graphql");
-                ValidateConfigurationIsCorrectFlag(configPropertyValues, "graphql", enableGlobalGraphQL);
-                ValidateConfigurationIsNotNull(configPropertyValues, "caching");
-                ValidateConfigurationIsNotNull(configPropertyValues, "telemetry");
-                ValidateConfigurationIsNotNull(configPropertyValues, "mode");
-            }
-            else
-            {
-                Assert.Fail("Missing 'configuration' object in Health Check Response.");
-            }
-        }
-
-        private static void ValidateBasicDetailsHealthCheckResponse(Dictionary<string, JsonElement> responseProperties)
-        {
-            // Validate value of 'status' property in reponse.
-            if (responseProperties.TryGetValue(key: "status", out JsonElement statusValue))
-            {
-                Assert.IsTrue(statusValue.ValueKind == JsonValueKind.String, "Unexpected or missing status value as string.");
-            }
-            else
-            {
-                Assert.Fail();
-            }
-
-            // Validate value of 'version' property in response.
-            if (responseProperties.TryGetValue(key: BasicHealthCheck.DAB_VERSION_KEY, out JsonElement versionValue))
-            {
-                Assert.AreEqual(
-                    expected: ProductInfo.GetProductVersion(),
-                    actual: versionValue.ToString(),
-                    message: "Unexpected or missing version value.");
-            }
-            else
-            {
-                Assert.Fail();
-            }
-
-            // Validate value of 'app-name' property in response.
-            if (responseProperties.TryGetValue(key: BasicHealthCheck.DAB_APPNAME_KEY, out JsonElement appNameValue))
-            {
-                Assert.AreEqual(
-                    expected: ProductInfo.GetDataApiBuilderUserAgent(),
-                    actual: appNameValue.ToString(),
-                    message: "Unexpected or missing DAB user agent string.");
-            }
-            else
-            {
-                Assert.Fail();
-            }
+            HealthEndpointTests.ValidateBasicDetailsHealthCheckResponse(responseProperties);
path: src/Service.Tests/Configuration/ConfigurationTests.cs
user: login: sezal98
body: I dont see any missing tab in this line. Doesnt show up in formatting as well. 
created_at: 2025-05-08T07:30:09Z
author_association: CONTRIBUTOR
diff_hunk: @@ -4667,22 +4454,20 @@ public async Task TestNoDepthLimitOnGrahQLInNonHostedMode(int? depthLimit)
         /// </summary>
         /// <param name="entityMap">Collection of entityName -> Entity object.</param>
         /// <param name="enableGlobalRest">flag to enable or disabled REST globally.</param>
-        private static void CreateCustomConfigFile(Dictionary<string, Entity> entityMap, bool enableGlobalRest = true, bool enableGlobalGraphql = true, bool enableGlobalHealth = true, bool enableDatasourceHealth = true, HostMode hostMode = HostMode.Production)
+        private static void CreateCustomConfigFile(Dictionary<string, Entity> entityMap, bool enableGlobalRest = true)
path: src/Service.Tests/Configuration/ConfigurationTests.cs
user: login: sezal98
body: GraphQL was always enabled by default. Rest was switched on and off in multiple tests.
created_at: 2025-05-08T07:30:38Z
author_association: CONTRIBUTOR
diff_hunk: @@ -270,6 +271,27 @@ public void ConfigureServices(IServiceCollection services)
             //Enable accessing HttpContext in RestService to get ClaimsPrincipal.
             services.AddHttpContextAccessor();
 
+            services.AddHttpClient("ContextConfiguredHealthCheckClient")
+                .ConfigureHttpClient((serviceProvider, client) =>
+                {
path: src/Service/Startup.cs
user: login: sezal98
body: yes we can create a mock httpclient now and pass it to the Httputilities. Before this I was creating httpclient internally in this file and hence mocking was not possible. 
created_at: 2025-05-08T07:31:22Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,437 @@
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT License.
+
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.IO.Abstractions.TestingHelpers;
+using System.Linq;
+using System.Net;
+using System.Net.Http;
+using System.Text.Json;
+using System.Threading;
+using System.Threading.Tasks;
+using Azure.DataApiBuilder.Config;
+using Azure.DataApiBuilder.Config.DatabasePrimitives;
+using Azure.DataApiBuilder.Config.HealthCheck;
+using Azure.DataApiBuilder.Config.ObjectModel;
+using Azure.DataApiBuilder.Core.Authorization;
+using Azure.DataApiBuilder.Core.Configurations;
+using Azure.DataApiBuilder.Core.Services;
+using Azure.DataApiBuilder.Core.Services.MetadataProviders;
+using Azure.DataApiBuilder.Product;
+using Azure.DataApiBuilder.Service.HealthCheck;
+using Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.TestHost;
+using Microsoft.Extensions.Logging;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Moq;
+using Moq.Protected;
+
+namespace Azure.DataApiBuilder.Service.Tests.Configuration
+{
+    [TestClass]
+    public class HealthEndpointTests
+    {
+        private const string CUSTOM_CONFIG_FILENAME = "custom_config.json";
+
+        [TestCleanup]
+        public void CleanupAfterEachTest()
+        {
+            if (File.Exists(CUSTOM_CONFIG_FILENAME))
+            {
+                File.Delete(CUSTOM_CONFIG_FILENAME);
+            }
+
+            TestHelper.UnsetAllDABEnvironmentVariables();
+        }
+
+        /// <summary>
+        /// Simulates a GET request to DAB's comprehensive health check endpoint ('/health') and validates the contents of the response.
+        /// The expected format of the response is the comprehensive health check response.
+        /// </summary>
+        [TestMethod]
+        [TestCategory(TestCategory.MSSQL)]
+        [DataRow(true, true, true, true, true, true, true, DisplayName = "Validate Health Report all enabled.")]
+        [DataRow(false, true, true, true, true, true, true, DisplayName = "Validate when Comprehensive Health Report is disabled")]
+        [DataRow(true, true, true, false, true, true, true, DisplayName = "Validate Health Report when data-source health is disabled")]
+        [DataRow(true, true, true, true, false, true, true, DisplayName = "Validate Health Report when entity health is disabled")]
+        [DataRow(true, false, true, true, true, true, true, DisplayName = "Validate Health Report when global rest health is disabled")]
+        [DataRow(true, true, true, true, true, false, true, DisplayName = "Validate Health Report when entity rest health is disabled")]
+        [DataRow(true, true, false, true, true, true, true, DisplayName = "Validate Health Report when global graphql health is disabled")]
+        [DataRow(true, true, true, true, true, true, false, DisplayName = "Validate Health Report when entity graphql health is disabled")]
+        public async Task ComprehensiveHealthEndpoint_ValidateContents(bool enableGlobalHealth, bool enableGlobalRest, bool enableGlobalGraphql, bool enableDatasourceHealth, bool enableEntityHealth, bool enableEntityRest, bool enableEntityGraphQL)
+        {
+            // Arrange
+            // Create a mock entity map with a single entity for testing
+            RuntimeConfig runtimeConfig = SetupCustomConfigFile(enableGlobalHealth, enableGlobalRest, enableGlobalGraphql, enableDatasourceHealth, enableEntityHealth, enableEntityRest, enableEntityGraphQL);
+            WriteToCustomConfigFile(runtimeConfig);
+
+            string[] args = new[]
+            {
+                $"--ConfigFileName={CUSTOM_CONFIG_FILENAME}"
+            };
+
+            using (TestServer server = new(Program.CreateWebHostBuilder(args)))
+            using (HttpClient client = server.CreateClient())
+            {
+                HttpRequestMessage healthRequest = new(HttpMethod.Get, "http://localhost:5000/health");
+                HttpResponseMessage response = await client.SendAsync(healthRequest);
+
+                if (!enableGlobalHealth)
+                {
+                    Assert.AreEqual(expected: HttpStatusCode.NotFound, actual: response.StatusCode, message: "Received unexpected HTTP code from health check endpoint.");
+                }
+                else
+                {
+                    string responseBody = await response.Content.ReadAsStringAsync();
+                    Dictionary<string, JsonElement> responseProperties = JsonSerializer.Deserialize<Dictionary<string, JsonElement>>(responseBody);
+                    Assert.AreEqual(expected: HttpStatusCode.OK, actual: response.StatusCode, message: "Received unexpected HTTP code from health check endpoint.");
+
+                    ValidateBasicDetailsHealthCheckResponse(responseProperties);
+                    ValidateConfigurationDetailsHealthCheckResponse(responseProperties, enableGlobalRest, enableGlobalGraphql);
+                    ValidateIfAttributePresentInResponse(responseProperties, enableDatasourceHealth, HealthCheckConstants.DATASOURCE);
+                    ValidateIfAttributePresentInResponse(responseProperties, enableEntityHealth, HealthCheckConstants.ENDPOINT);
+                    if (enableEntityHealth)
+                    {
+                        ValidateEntityRestAndGraphQLResponse(responseProperties, enableEntityRest, enableEntityGraphQL, enableGlobalRest, enableGlobalGraphql);
+                    }
+                }
+            }
+        }
+
+        [TestMethod]
+        public async Task TestHealthCheckRestResponse()
+        {
+            // Arrange
+            // Create a mock entity map with a single entity for testing and load in RuntimeConfigProvider
+            RuntimeConfig runtimeConfig = SetupCustomConfigFile(true, true, true, true, true, true, true);
+            Mock<IMetadataProviderFactory> metadataProviderFactory = new();
+            MockFileSystem fileSystem = new();
+            fileSystem.AddFile(FileSystemRuntimeConfigLoader.DEFAULT_CONFIG_FILE_NAME, new MockFileData(runtimeConfig.ToJson()));
+            FileSystemRuntimeConfigLoader loader = new(fileSystem);
+            RuntimeConfigProvider provider = new(loader);
+
+            // Create a Mock of HttpMessageHandler
+            Mock<HttpMessageHandler> mockHandler = new();
+            // Mocking the handler to return a specific response for SendAsync
+            mockHandler.Protected()
+                .Setup<Task<HttpResponseMessage>>(
+                    "SendAsync",
+                    ItExpr.Is<HttpRequestMessage>(req =>
+                        req.Method == HttpMethod.Get
+                        && req.RequestUri.Equals($"http://localhost:5000/{runtimeConfig.RestPath.Trim('/')}/{runtimeConfig.Entities.First().Key}?$first={runtimeConfig.Entities.First().Value.Health.First}")),
+                    ItExpr.IsAny<CancellationToken>())
+                .ReturnsAsync(new HttpResponseMessage(System.Net.HttpStatusCode.OK)
+                {
+                    Content = new StringContent("{\"message\":\"Rest response\"}")
+                });
+
+            // Mocking IHttpClientFactory
+            Mock<IHttpClientFactory> mockHttpClientFactory = new();
+            mockHttpClientFactory.Setup(x => x.CreateClient("ContextConfiguredHealthCheckClient"))
+                .Returns(new HttpClient(mockHandler.Object)
+                {
+                    BaseAddress = new Uri("http://localhost:5000")
+                });
+
+            Mock<ILogger<HttpUtilities>> _logger = new();
+
+            // Create the mock HttpContext to return the expected scheme and host
+            // when the ConfigureApiRoute method is called.
+            Mock<HttpContext> mockHttpContext = new();
+            Mock<HttpRequest> mockHttpRequest = new();
+            mockHttpRequest.Setup(r => r.Scheme).Returns("http");
+            mockHttpRequest.Setup(r => r.Host).Returns(new HostString("localhost", 5000));
+            mockHttpContext.Setup(c => c.Request).Returns(mockHttpRequest.Object);
+
+            HttpUtilities httpUtilities = new(
+                _logger.Object,
+                metadataProviderFactory.Object,
+                provider,
+                mockHttpClientFactory.Object);
+
+            // Act
+            // Call the ExecuteRestQuery method with the mock HttpClient
+            // Simulate a REST API call to the endpoint
+            // Response should be null as error message is not expected to be returned
+            string errorMessageFromRest = await httpUtilities.ExecuteRestQuery(
+                restUriSuffix: runtimeConfig.RestPath,
+                entityName: runtimeConfig.Entities.First().Key,
+                first: runtimeConfig.Entities.First().Value.Health.First,
+                incomingRoleHeader: string.Empty,
+                incomingRoleToken: string.Empty
+            );
+
+            // Assert
+            // Validate the null response from the REST API call 
+            Assert.IsNull(errorMessageFromRest);
+        }
+
+        [TestMethod]
+        public void TestHealthCheckGraphQLResponse()
+        {
+            // Arrange
+            // Create a mock entity map with a single entity for testing and load in RuntimeConfigProvider
+            RuntimeConfig runtimeConfig = SetupCustomConfigFile(true, true, true, true, true, true, true);
+            MockFileSystem fileSystem = new();
+            fileSystem.AddFile(FileSystemRuntimeConfigLoader.DEFAULT_CONFIG_FILE_NAME, new MockFileData(runtimeConfig.ToJson()));
+            FileSystemRuntimeConfigLoader loader = new(fileSystem);
+            RuntimeConfigProvider provider = new(loader);
+            Mock<IMetadataProviderFactory> metadataProviderFactory = new();
+            Mock<ISqlMetadataProvider> sqlMetadataProvider = new();
+
+            // Setup the mock database object with a source definition
+            SourceDefinition sourceDef = new();
+            sourceDef.Columns.Add("id", new ColumnDefinition());
+            sourceDef.Columns.Add("title", new ColumnDefinition());
+            // Mock DB Object to return the source definition
+            Mock<DatabaseObject> mockDbObject = new();
+            mockDbObject.SetupGet(x => x.SourceDefinition).Returns(sourceDef);
+            // Mocking the metadata provider to return the mock database object
+            sqlMetadataProvider.Setup(x => x.GetDatabaseObjectByKey(runtimeConfig.Entities.First().Key)).Returns(mockDbObject.Object);
+            metadataProviderFactory.Setup(x => x.GetMetadataProvider(It.IsAny<string>())).Returns(sqlMetadataProvider.Object);
+
+            Mock<HttpMessageHandler> mockHandler = new();
+            mockHandler.Protected()
+                .Setup<Task<HttpResponseMessage>>(
+                    "SendAsync",
+                    ItExpr.Is<HttpRequestMessage>(req =>
+                        req.Method == HttpMethod.Post &&
+                        req.RequestUri == new Uri("http://localhost:5000/graphql") &&
+                        req.Content.ReadAsStringAsync().Result.Equals("{\"query\":\"{books (first: 100) {items { id title }}}\"}")), // Use the correct GraphQL query format
+                    ItExpr.IsAny<CancellationToken>())
+                .ReturnsAsync(new HttpResponseMessage(System.Net.HttpStatusCode.OK)
+                {
+                    Content = new StringContent("{\"data\":{\"books\":[{\"id\":1,\"title\":\"Test Book\"}]}}")
+                });
+
+            Mock<IHttpClientFactory> mockHttpClientFactory = new();
+            mockHttpClientFactory.Setup(x => x.CreateClient("ContextConfiguredHealthCheckClient"))
+                .Returns(new HttpClient(mockHandler.Object)
+                {
+                    BaseAddress = new Uri("http://localhost:5000")
+                });
+
+            Mock<ILogger<HttpUtilities>> logger = new();
+
+            HttpUtilities httpUtilities = new(
+                logger.Object,
+                metadataProviderFactory.Object,
+                provider,
+                mockHttpClientFactory.Object);
+
+            // Act
+            string errorMessageFromGraphQL = httpUtilities.ExecuteGraphQLQuery(
+                graphqlUriSuffix: "/graphql",
+                entityName: runtimeConfig.Entities.First().Key,
path: src/Service.Tests/Configuration/HealthEndpointTests.cs
user: login: sezal98
body: yes it would have
created_at: 2025-05-08T07:36:59Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,437 @@
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT License.
+
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.IO.Abstractions.TestingHelpers;
+using System.Linq;
+using System.Net;
+using System.Net.Http;
+using System.Text.Json;
+using System.Threading;
+using System.Threading.Tasks;
+using Azure.DataApiBuilder.Config;
+using Azure.DataApiBuilder.Config.DatabasePrimitives;
+using Azure.DataApiBuilder.Config.HealthCheck;
+using Azure.DataApiBuilder.Config.ObjectModel;
+using Azure.DataApiBuilder.Core.Authorization;
+using Azure.DataApiBuilder.Core.Configurations;
+using Azure.DataApiBuilder.Core.Services;
+using Azure.DataApiBuilder.Core.Services.MetadataProviders;
+using Azure.DataApiBuilder.Product;
+using Azure.DataApiBuilder.Service.HealthCheck;
+using Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.TestHost;
+using Microsoft.Extensions.Logging;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Moq;
+using Moq.Protected;
+
+namespace Azure.DataApiBuilder.Service.Tests.Configuration
+{
+    [TestClass]
+    public class HealthEndpointTests
+    {
+        private const string CUSTOM_CONFIG_FILENAME = "custom_config.json";
+
+        [TestCleanup]
+        public void CleanupAfterEachTest()
+        {
+            if (File.Exists(CUSTOM_CONFIG_FILENAME))
+            {
+                File.Delete(CUSTOM_CONFIG_FILENAME);
+            }
+
+            TestHelper.UnsetAllDABEnvironmentVariables();
+        }
+
+        /// <summary>
+        /// Simulates a GET request to DAB's comprehensive health check endpoint ('/health') and validates the contents of the response.
+        /// The expected format of the response is the comprehensive health check response.
+        /// </summary>
+        [TestMethod]
+        [TestCategory(TestCategory.MSSQL)]
+        [DataRow(true, true, true, true, true, true, true, DisplayName = "Validate Health Report all enabled.")]
+        [DataRow(false, true, true, true, true, true, true, DisplayName = "Validate when Comprehensive Health Report is disabled")]
+        [DataRow(true, true, true, false, true, true, true, DisplayName = "Validate Health Report when data-source health is disabled")]
+        [DataRow(true, true, true, true, false, true, true, DisplayName = "Validate Health Report when entity health is disabled")]
+        [DataRow(true, false, true, true, true, true, true, DisplayName = "Validate Health Report when global rest health is disabled")]
+        [DataRow(true, true, true, true, true, false, true, DisplayName = "Validate Health Report when entity rest health is disabled")]
+        [DataRow(true, true, false, true, true, true, true, DisplayName = "Validate Health Report when global graphql health is disabled")]
+        [DataRow(true, true, true, true, true, true, false, DisplayName = "Validate Health Report when entity graphql health is disabled")]
+        public async Task ComprehensiveHealthEndpoint_ValidateContents(bool enableGlobalHealth, bool enableGlobalRest, bool enableGlobalGraphql, bool enableDatasourceHealth, bool enableEntityHealth, bool enableEntityRest, bool enableEntityGraphQL)
+        {
+            // Arrange
+            // Create a mock entity map with a single entity for testing
+            RuntimeConfig runtimeConfig = SetupCustomConfigFile(enableGlobalHealth, enableGlobalRest, enableGlobalGraphql, enableDatasourceHealth, enableEntityHealth, enableEntityRest, enableEntityGraphQL);
+            WriteToCustomConfigFile(runtimeConfig);
+
+            string[] args = new[]
+            {
+                $"--ConfigFileName={CUSTOM_CONFIG_FILENAME}"
+            };
+
+            using (TestServer server = new(Program.CreateWebHostBuilder(args)))
+            using (HttpClient client = server.CreateClient())
+            {
+                HttpRequestMessage healthRequest = new(HttpMethod.Get, "http://localhost:5000/health");
+                HttpResponseMessage response = await client.SendAsync(healthRequest);
+
+                if (!enableGlobalHealth)
+                {
+                    Assert.AreEqual(expected: HttpStatusCode.NotFound, actual: response.StatusCode, message: "Received unexpected HTTP code from health check endpoint.");
+                }
+                else
+                {
+                    string responseBody = await response.Content.ReadAsStringAsync();
+                    Dictionary<string, JsonElement> responseProperties = JsonSerializer.Deserialize<Dictionary<string, JsonElement>>(responseBody);
+                    Assert.AreEqual(expected: HttpStatusCode.OK, actual: response.StatusCode, message: "Received unexpected HTTP code from health check endpoint.");
+
+                    ValidateBasicDetailsHealthCheckResponse(responseProperties);
+                    ValidateConfigurationDetailsHealthCheckResponse(responseProperties, enableGlobalRest, enableGlobalGraphql);
+                    ValidateIfAttributePresentInResponse(responseProperties, enableDatasourceHealth, HealthCheckConstants.DATASOURCE);
+                    ValidateIfAttributePresentInResponse(responseProperties, enableEntityHealth, HealthCheckConstants.ENDPOINT);
+                    if (enableEntityHealth)
+                    {
+                        ValidateEntityRestAndGraphQLResponse(responseProperties, enableEntityRest, enableEntityGraphQL, enableGlobalRest, enableGlobalGraphql);
+                    }
+                }
+            }
+        }
+
+        [TestMethod]
+        public async Task TestHealthCheckRestResponse()
+        {
+            // Arrange
+            // Create a mock entity map with a single entity for testing and load in RuntimeConfigProvider
+            RuntimeConfig runtimeConfig = SetupCustomConfigFile(true, true, true, true, true, true, true);
+            Mock<IMetadataProviderFactory> metadataProviderFactory = new();
+            MockFileSystem fileSystem = new();
+            fileSystem.AddFile(FileSystemRuntimeConfigLoader.DEFAULT_CONFIG_FILE_NAME, new MockFileData(runtimeConfig.ToJson()));
+            FileSystemRuntimeConfigLoader loader = new(fileSystem);
+            RuntimeConfigProvider provider = new(loader);
+
+            // Create a Mock of HttpMessageHandler
+            Mock<HttpMessageHandler> mockHandler = new();
+            // Mocking the handler to return a specific response for SendAsync
+            mockHandler.Protected()
+                .Setup<Task<HttpResponseMessage>>(
+                    "SendAsync",
+                    ItExpr.Is<HttpRequestMessage>(req =>
+                        req.Method == HttpMethod.Get
+                        && req.RequestUri.Equals($"http://localhost:5000/{runtimeConfig.RestPath.Trim('/')}/{runtimeConfig.Entities.First().Key}?$first={runtimeConfig.Entities.First().Value.Health.First}")),
+                    ItExpr.IsAny<CancellationToken>())
+                .ReturnsAsync(new HttpResponseMessage(System.Net.HttpStatusCode.OK)
+                {
+                    Content = new StringContent("{\"message\":\"Rest response\"}")
+                });
+
+            // Mocking IHttpClientFactory
+            Mock<IHttpClientFactory> mockHttpClientFactory = new();
+            mockHttpClientFactory.Setup(x => x.CreateClient("ContextConfiguredHealthCheckClient"))
+                .Returns(new HttpClient(mockHandler.Object)
+                {
+                    BaseAddress = new Uri("http://localhost:5000")
+                });
+
+            Mock<ILogger<HttpUtilities>> _logger = new();
+
+            // Create the mock HttpContext to return the expected scheme and host
+            // when the ConfigureApiRoute method is called.
+            Mock<HttpContext> mockHttpContext = new();
+            Mock<HttpRequest> mockHttpRequest = new();
+            mockHttpRequest.Setup(r => r.Scheme).Returns("http");
+            mockHttpRequest.Setup(r => r.Host).Returns(new HostString("localhost", 5000));
+            mockHttpContext.Setup(c => c.Request).Returns(mockHttpRequest.Object);
+
+            HttpUtilities httpUtilities = new(
+                _logger.Object,
+                metadataProviderFactory.Object,
+                provider,
+                mockHttpClientFactory.Object);
+
+            // Act
+            // Call the ExecuteRestQuery method with the mock HttpClient
+            // Simulate a REST API call to the endpoint
+            // Response should be null as error message is not expected to be returned
+            string errorMessageFromRest = await httpUtilities.ExecuteRestQuery(
+                restUriSuffix: runtimeConfig.RestPath,
+                entityName: runtimeConfig.Entities.First().Key,
+                first: runtimeConfig.Entities.First().Value.Health.First,
+                incomingRoleHeader: string.Empty,
+                incomingRoleToken: string.Empty
+            );
+
+            // Assert
+            // Validate the null response from the REST API call 
+            Assert.IsNull(errorMessageFromRest);
+        }
+
+        [TestMethod]
+        public void TestHealthCheckGraphQLResponse()
+        {
+            // Arrange
+            // Create a mock entity map with a single entity for testing and load in RuntimeConfigProvider
+            RuntimeConfig runtimeConfig = SetupCustomConfigFile(true, true, true, true, true, true, true);
+            MockFileSystem fileSystem = new();
+            fileSystem.AddFile(FileSystemRuntimeConfigLoader.DEFAULT_CONFIG_FILE_NAME, new MockFileData(runtimeConfig.ToJson()));
+            FileSystemRuntimeConfigLoader loader = new(fileSystem);
+            RuntimeConfigProvider provider = new(loader);
+            Mock<IMetadataProviderFactory> metadataProviderFactory = new();
+            Mock<ISqlMetadataProvider> sqlMetadataProvider = new();
+
+            // Setup the mock database object with a source definition
+            SourceDefinition sourceDef = new();
+            sourceDef.Columns.Add("id", new ColumnDefinition());
+            sourceDef.Columns.Add("title", new ColumnDefinition());
+            // Mock DB Object to return the source definition
+            Mock<DatabaseObject> mockDbObject = new();
+            mockDbObject.SetupGet(x => x.SourceDefinition).Returns(sourceDef);
+            // Mocking the metadata provider to return the mock database object
+            sqlMetadataProvider.Setup(x => x.GetDatabaseObjectByKey(runtimeConfig.Entities.First().Key)).Returns(mockDbObject.Object);
+            metadataProviderFactory.Setup(x => x.GetMetadataProvider(It.IsAny<string>())).Returns(sqlMetadataProvider.Object);
+
+            Mock<HttpMessageHandler> mockHandler = new();
+            mockHandler.Protected()
+                .Setup<Task<HttpResponseMessage>>(
+                    "SendAsync",
+                    ItExpr.Is<HttpRequestMessage>(req =>
+                        req.Method == HttpMethod.Post &&
+                        req.RequestUri == new Uri("http://localhost:5000/graphql") &&
+                        req.Content.ReadAsStringAsync().Result.Equals("{\"query\":\"{books (first: 100) {items { id title }}}\"}")), // Use the correct GraphQL query format
+                    ItExpr.IsAny<CancellationToken>())
+                .ReturnsAsync(new HttpResponseMessage(System.Net.HttpStatusCode.OK)
+                {
+                    Content = new StringContent("{\"data\":{\"books\":[{\"id\":1,\"title\":\"Test Book\"}]}}")
+                });
+
+            Mock<IHttpClientFactory> mockHttpClientFactory = new();
+            mockHttpClientFactory.Setup(x => x.CreateClient("ContextConfiguredHealthCheckClient"))
+                .Returns(new HttpClient(mockHandler.Object)
+                {
+                    BaseAddress = new Uri("http://localhost:5000")
+                });
+
+            Mock<ILogger<HttpUtilities>> logger = new();
+
+            HttpUtilities httpUtilities = new(
+                logger.Object,
+                metadataProviderFactory.Object,
+                provider,
+                mockHttpClientFactory.Object);
+
+            // Act
+            string errorMessageFromGraphQL = httpUtilities.ExecuteGraphQLQuery(
+                graphqlUriSuffix: "/graphql",
+                entityName: runtimeConfig.Entities.First().Key,
+                entity: runtimeConfig.Entities.First().Value,
+                incomingRoleHeader: string.Empty,
+                incomingRoleToken: string.Empty);
+
+            // Assert
+            Assert.IsNull(errorMessageFromGraphQL);
path: src/Service.Tests/Configuration/HealthEndpointTests.cs
user: login: sezal98
body: Added negative test cases
created_at: 2025-05-08T07:52:54Z
author_association: CONTRIBUTOR
diff_hunk: @@ -132,6 +132,12 @@ bool VerifyForeignKeyExistsInDB(
         /// <returns></returns>
         DatabaseType GetDatabaseType();
 
+        // Method to access the dictionary since DatabaseObject is abstract class
path: src/Core/Services/MetadataProviders/ISqlMetadataProvider.cs
user: login: RubenCerna2079
body: 
```suggestion
        /// <summary>
        /// Method to access the dictionary since DatabaseObject is abstract class.
        /// </summary>
        /// <param name="key">String used to access specific database object.</param>
        /// <returns>Database object.</returns>
```
created_at: 2025-05-12T17:56:53Z
author_association: CONTRIBUTOR
diff_hunk: @@ -132,6 +132,12 @@ bool VerifyForeignKeyExistsInDB(
         /// <returns></returns>
path: src/Core/Services/MetadataProviders/ISqlMetadataProvider.cs
user: login: RubenCerna2079
body: Line 124, `<param name="name"/> <param>` if you can please change the `/` so that it is in the end of the tag. Like `<param name="name"> </param>`
created_at: 2025-05-12T18:11:46Z
author_association: CONTRIBUTOR
diff_hunk: @@ -249,7 +248,7 @@ private void PopulateEntityHealth(ComprehensiveHealthCheckReport ComprehensiveHe
                 {
                     ComprehensiveHealthCheckReport.Checks ??= new List<HealthCheckResultEntry>();
 
-                    (int, string?) response = ExecuteGraphQLEntityQuery(runtimeConfig.GraphQLPath, entityValue, entityKeyName);
+                    (int, string?) response = await ExecuteGraphQLEntityQueryAsync(runtimeConfig.GraphQLPath, entityValue, entityKeyName);
path: src/Service/HealthCheck/HealthCheckHelper.cs
user: login: RubenCerna2079
body: Why only change the name for this one by adding `Async` and not the rest of the functions?
created_at: 2025-05-12T23:06:25Z
author_association: CONTRIBUTOR
diff_hunk: @@ -88,50 +74,44 @@ public void ConfigureApiRoute(HttpContext httpContext)
         }
 
         // Executes the REST query by sending a GET request to the API.
-        public string? ExecuteRestQuery(string restUriSuffix, string entityName, int first, string incomingRoleHeader, string incomingRoleToken)
+        public async Task<string?> ExecuteRestQuery(string restUriSuffix, string entityName, int first, string incomingRoleHeader, string incomingRoleToken)
         {
             string? errorMessage = null;
             try
             {
                 // Base URL of the API that handles SQL operations
-                string apiRoute = Utilities.GetServiceRoute(_apiRoute, restUriSuffix);
+                string apiRoute = $"{restUriSuffix}{Utilities.CreateHttpRestQuery(entityName, first)}";
                 if (string.IsNullOrEmpty(apiRoute))
                 {
                     LogTrace("The API route is not available, hence HealthEndpoint is not available.");
                     return errorMessage;
                 }
 
-                if (!Program.CheckSanityOfUrl(apiRoute))
+                if (!Program.CheckSanityOfUrl($"{_httpClient.BaseAddress}{restUriSuffix}"))
path: src/Service/HealthCheck/HttpUtilities.cs
user: login: RubenCerna2079
body: Why was the variable `apiRoute` changed?
created_at: 2025-05-12T23:28:02Z
author_association: CONTRIBUTOR
diff_hunk: @@ -145,18 +125,11 @@ public void ConfigureApiRoute(HttpContext httpContext)
 
         // Executes the GraphQL query by sending a POST request to the API.
         // Internally calls the metadata provider to fetch the column names to create the graphql payload.
-        public string? ExecuteGraphQLQuery(string graphqlUriSuffix, string entityName, Entity entity, string incomingRoleHeader, string incomingRoleToken)
+        public async Task<string?> ExecuteGraphQLQuery(string graphqlUriSuffix, string entityName, Entity entity, string incomingRoleHeader, string incomingRoleToken)
         {
             string? errorMessage = null;
-            // Base URL of the API that handles SQL operations
-            string apiRoute = Utilities.GetServiceRoute(_apiRoute, graphqlUriSuffix);
-            if (string.IsNullOrEmpty(apiRoute))
path: src/Service/HealthCheck/HttpUtilities.cs
user: login: RubenCerna2079
body: Why was this check removed while in the RestQuery it is still there?
created_at: 2025-05-12T23:45:01Z
author_association: CONTRIBUTOR
diff_hunk: @@ -270,6 +271,27 @@ public void ConfigureServices(IServiceCollection services)
             //Enable accessing HttpContext in RestService to get ClaimsPrincipal.
             services.AddHttpContextAccessor();
 
+            services.AddHttpClient("ContextConfiguredHealthCheckClient")
+                .ConfigureHttpClient((serviceProvider, client) =>
+                {
+                    IHttpContextAccessor httpContextAccessor = serviceProvider.GetRequiredService<IHttpContextAccessor>();
+                    HttpContext? httpContext = httpContextAccessor.HttpContext;
+
+                    if (httpContext != null)
+                    {
+                        // Build base address from request
+                        string baseUri = $"{httpContext.Request.Scheme}://{httpContext.Request.Host}";
+                        client.BaseAddress = new Uri(baseUri);
+
+                        // Set default Accept header
+                        client.DefaultRequestHeaders.Accept.Clear();
+                        client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
+                    }
+
+                    // Optional: Set a timeout
+                    client.Timeout = TimeSpan.FromSeconds(200);
path: src/Service/Startup.cs
user: login: RubenCerna2079
body: How is this optional and why would we want it optional?
created_at: 2025-05-13T00:00:50Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,492 @@
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT License.
+
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.IO.Abstractions.TestingHelpers;
+using System.Linq;
+using System.Net;
+using System.Net.Http;
+using System.Text.Json;
+using System.Threading;
+using System.Threading.Tasks;
+using Azure.DataApiBuilder.Config;
+using Azure.DataApiBuilder.Config.DatabasePrimitives;
+using Azure.DataApiBuilder.Config.HealthCheck;
+using Azure.DataApiBuilder.Config.ObjectModel;
+using Azure.DataApiBuilder.Core.Authorization;
+using Azure.DataApiBuilder.Core.Configurations;
+using Azure.DataApiBuilder.Core.Services;
+using Azure.DataApiBuilder.Core.Services.MetadataProviders;
+using Azure.DataApiBuilder.Product;
+using Azure.DataApiBuilder.Service.HealthCheck;
+using Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.TestHost;
+using Microsoft.Extensions.Logging;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Moq;
+using Moq.Protected;
+
+namespace Azure.DataApiBuilder.Service.Tests.Configuration
+{
+    [TestClass]
+    public class HealthEndpointTests
+    {
+        private const string CUSTOM_CONFIG_FILENAME = "custom_config.json";
+        private const string BASE_DAB_URL = "http://localhost:5000";
+
+        [TestCleanup]
+        public void CleanupAfterEachTest()
+        {
+            if (File.Exists(CUSTOM_CONFIG_FILENAME))
+            {
+                File.Delete(CUSTOM_CONFIG_FILENAME);
+            }
+
+            TestHelper.UnsetAllDABEnvironmentVariables();
+        }
+
+        /// <summary>
+        /// Simulates a GET request to DAB's comprehensive health check endpoint ('/health') and validates the contents of the response.
+        /// The expected format of the response is the comprehensive health check response.
+        /// </summary>
+        [TestMethod]
+        [TestCategory(TestCategory.MSSQL)]
+        [DataRow(true, true, true, true, true, true, true, DisplayName = "Validate Health Report all enabled.")]
+        [DataRow(false, true, true, true, true, true, true, DisplayName = "Validate when Comprehensive Health Report is disabled")]
+        [DataRow(true, true, true, false, true, true, true, DisplayName = "Validate Health Report when data-source health is disabled")]
+        [DataRow(true, true, true, true, false, true, true, DisplayName = "Validate Health Report when entity health is disabled")]
+        [DataRow(true, false, true, true, true, true, true, DisplayName = "Validate Health Report when global rest health is disabled")]
+        [DataRow(true, true, true, true, true, false, true, DisplayName = "Validate Health Report when entity rest health is disabled")]
+        [DataRow(true, true, false, true, true, true, true, DisplayName = "Validate Health Report when global graphql health is disabled")]
+        [DataRow(true, true, true, true, true, true, false, DisplayName = "Validate Health Report when entity graphql health is disabled")]
+        public async Task ComprehensiveHealthEndpoint_ValidateContents(bool enableGlobalHealth, bool enableGlobalRest, bool enableGlobalGraphql, bool enableDatasourceHealth, bool enableEntityHealth, bool enableEntityRest, bool enableEntityGraphQL)
+        {
+            // Arrange
+            // Create a mock entity map with a single entity for testing
+            RuntimeConfig runtimeConfig = SetupCustomConfigFile(enableGlobalHealth, enableGlobalRest, enableGlobalGraphql, enableDatasourceHealth, enableEntityHealth, enableEntityRest, enableEntityGraphQL);
+            WriteToCustomConfigFile(runtimeConfig);
+
+            string[] args = new[]
+            {
+                $"--ConfigFileName={CUSTOM_CONFIG_FILENAME}"
+            };
+
+            using (TestServer server = new(Program.CreateWebHostBuilder(args)))
+            using (HttpClient client = server.CreateClient())
+            {
+                HttpRequestMessage healthRequest = new(HttpMethod.Get, $"{BASE_DAB_URL}/health");
+                HttpResponseMessage response = await client.SendAsync(healthRequest);
+
+                if (!enableGlobalHealth)
+                {
+                    Assert.AreEqual(expected: HttpStatusCode.NotFound, actual: response.StatusCode, message: "Received unexpected HTTP code from health check endpoint.");
+                }
+                else
+                {
+                    string responseBody = await response.Content.ReadAsStringAsync();
+                    Dictionary<string, JsonElement> responseProperties = JsonSerializer.Deserialize<Dictionary<string, JsonElement>>(responseBody);
+                    Assert.AreEqual(expected: HttpStatusCode.OK, actual: response.StatusCode, message: "Received unexpected HTTP code from health check endpoint.");
+
+                    ValidateBasicDetailsHealthCheckResponse(responseProperties);
+                    ValidateConfigurationDetailsHealthCheckResponse(responseProperties, enableGlobalRest, enableGlobalGraphql);
+                    ValidateIfAttributePresentInResponse(responseProperties, enableDatasourceHealth, HealthCheckConstants.DATASOURCE);
+                    ValidateIfAttributePresentInResponse(responseProperties, enableEntityHealth, HealthCheckConstants.ENDPOINT);
+                    if (enableEntityHealth)
+                    {
+                        ValidateEntityRestAndGraphQLResponse(responseProperties, enableEntityRest, enableEntityGraphQL, enableGlobalRest, enableGlobalGraphql);
+                    }
+                }
+            }
+        }
+
+        [TestMethod]
+        public async Task TestHealthCheckRestResponseAsync()
path: src/Service.Tests/Configuration/HealthEndpointTests.cs
user: login: RubenCerna2079
body: I think you should add a comment explaining what this test does
created_at: 2025-05-13T00:10:12Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,492 @@
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT License.
+
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.IO.Abstractions.TestingHelpers;
+using System.Linq;
+using System.Net;
+using System.Net.Http;
+using System.Text.Json;
+using System.Threading;
+using System.Threading.Tasks;
+using Azure.DataApiBuilder.Config;
+using Azure.DataApiBuilder.Config.DatabasePrimitives;
+using Azure.DataApiBuilder.Config.HealthCheck;
+using Azure.DataApiBuilder.Config.ObjectModel;
+using Azure.DataApiBuilder.Core.Authorization;
+using Azure.DataApiBuilder.Core.Configurations;
+using Azure.DataApiBuilder.Core.Services;
+using Azure.DataApiBuilder.Core.Services.MetadataProviders;
+using Azure.DataApiBuilder.Product;
+using Azure.DataApiBuilder.Service.HealthCheck;
+using Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.TestHost;
+using Microsoft.Extensions.Logging;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Moq;
+using Moq.Protected;
+
+namespace Azure.DataApiBuilder.Service.Tests.Configuration
+{
+    [TestClass]
+    public class HealthEndpointTests
+    {
+        private const string CUSTOM_CONFIG_FILENAME = "custom_config.json";
+        private const string BASE_DAB_URL = "http://localhost:5000";
+
+        [TestCleanup]
+        public void CleanupAfterEachTest()
+        {
+            if (File.Exists(CUSTOM_CONFIG_FILENAME))
+            {
+                File.Delete(CUSTOM_CONFIG_FILENAME);
+            }
+
+            TestHelper.UnsetAllDABEnvironmentVariables();
+        }
+
+        /// <summary>
+        /// Simulates a GET request to DAB's comprehensive health check endpoint ('/health') and validates the contents of the response.
+        /// The expected format of the response is the comprehensive health check response.
+        /// </summary>
+        [TestMethod]
+        [TestCategory(TestCategory.MSSQL)]
+        [DataRow(true, true, true, true, true, true, true, DisplayName = "Validate Health Report all enabled.")]
+        [DataRow(false, true, true, true, true, true, true, DisplayName = "Validate when Comprehensive Health Report is disabled")]
+        [DataRow(true, true, true, false, true, true, true, DisplayName = "Validate Health Report when data-source health is disabled")]
+        [DataRow(true, true, true, true, false, true, true, DisplayName = "Validate Health Report when entity health is disabled")]
+        [DataRow(true, false, true, true, true, true, true, DisplayName = "Validate Health Report when global rest health is disabled")]
+        [DataRow(true, true, true, true, true, false, true, DisplayName = "Validate Health Report when entity rest health is disabled")]
+        [DataRow(true, true, false, true, true, true, true, DisplayName = "Validate Health Report when global graphql health is disabled")]
+        [DataRow(true, true, true, true, true, true, false, DisplayName = "Validate Health Report when entity graphql health is disabled")]
+        public async Task ComprehensiveHealthEndpoint_ValidateContents(bool enableGlobalHealth, bool enableGlobalRest, bool enableGlobalGraphql, bool enableDatasourceHealth, bool enableEntityHealth, bool enableEntityRest, bool enableEntityGraphQL)
+        {
+            // Arrange
+            // Create a mock entity map with a single entity for testing
+            RuntimeConfig runtimeConfig = SetupCustomConfigFile(enableGlobalHealth, enableGlobalRest, enableGlobalGraphql, enableDatasourceHealth, enableEntityHealth, enableEntityRest, enableEntityGraphQL);
+            WriteToCustomConfigFile(runtimeConfig);
+
+            string[] args = new[]
+            {
+                $"--ConfigFileName={CUSTOM_CONFIG_FILENAME}"
+            };
+
+            using (TestServer server = new(Program.CreateWebHostBuilder(args)))
+            using (HttpClient client = server.CreateClient())
+            {
+                HttpRequestMessage healthRequest = new(HttpMethod.Get, $"{BASE_DAB_URL}/health");
+                HttpResponseMessage response = await client.SendAsync(healthRequest);
+
+                if (!enableGlobalHealth)
+                {
+                    Assert.AreEqual(expected: HttpStatusCode.NotFound, actual: response.StatusCode, message: "Received unexpected HTTP code from health check endpoint.");
+                }
+                else
+                {
+                    string responseBody = await response.Content.ReadAsStringAsync();
+                    Dictionary<string, JsonElement> responseProperties = JsonSerializer.Deserialize<Dictionary<string, JsonElement>>(responseBody);
+                    Assert.AreEqual(expected: HttpStatusCode.OK, actual: response.StatusCode, message: "Received unexpected HTTP code from health check endpoint.");
+
+                    ValidateBasicDetailsHealthCheckResponse(responseProperties);
+                    ValidateConfigurationDetailsHealthCheckResponse(responseProperties, enableGlobalRest, enableGlobalGraphql);
+                    ValidateIfAttributePresentInResponse(responseProperties, enableDatasourceHealth, HealthCheckConstants.DATASOURCE);
+                    ValidateIfAttributePresentInResponse(responseProperties, enableEntityHealth, HealthCheckConstants.ENDPOINT);
+                    if (enableEntityHealth)
+                    {
+                        ValidateEntityRestAndGraphQLResponse(responseProperties, enableEntityRest, enableEntityGraphQL, enableGlobalRest, enableGlobalGraphql);
+                    }
+                }
+            }
+        }
+
+        [TestMethod]
+        public async Task TestHealthCheckRestResponseAsync()
+        {
+            // Arrange
+            RuntimeConfig runtimeConfig = SetupCustomConfigFile(true, true, true, true, true, true, true);
+            HttpUtilities httpUtilities = SetupRestTest(runtimeConfig);
+
+            // Act
+            // Call the ExecuteRestQuery method with the mock HttpClient
+            // Simulate a REST API call to the endpoint
+            // Response should be null as error message is not expected to be returned
+            string errorMessageFromRest = await httpUtilities.ExecuteRestQuery(
+                restUriSuffix: runtimeConfig.RestPath,
+                entityName: runtimeConfig.Entities.First().Key,
+                first: runtimeConfig.Entities.First().Value.Health.First,
+                incomingRoleHeader: string.Empty,
+                incomingRoleToken: string.Empty
+            );
+
+            // Assert
+            // Validate the null response from the REST API call 
+            Assert.IsNull(errorMessageFromRest);
+        }
+
+        [TestMethod]
+        public async Task TestFailureHealthCheckRestResponseAsync()
path: src/Service.Tests/Configuration/HealthEndpointTests.cs
user: login: RubenCerna2079
body: I think there should also be a comment here
created_at: 2025-05-13T00:12:23Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,492 @@
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT License.
+
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.IO.Abstractions.TestingHelpers;
+using System.Linq;
+using System.Net;
+using System.Net.Http;
+using System.Text.Json;
+using System.Threading;
+using System.Threading.Tasks;
+using Azure.DataApiBuilder.Config;
+using Azure.DataApiBuilder.Config.DatabasePrimitives;
+using Azure.DataApiBuilder.Config.HealthCheck;
+using Azure.DataApiBuilder.Config.ObjectModel;
+using Azure.DataApiBuilder.Core.Authorization;
+using Azure.DataApiBuilder.Core.Configurations;
+using Azure.DataApiBuilder.Core.Services;
+using Azure.DataApiBuilder.Core.Services.MetadataProviders;
+using Azure.DataApiBuilder.Product;
+using Azure.DataApiBuilder.Service.HealthCheck;
+using Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.TestHost;
+using Microsoft.Extensions.Logging;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Moq;
+using Moq.Protected;
+
+namespace Azure.DataApiBuilder.Service.Tests.Configuration
+{
+    [TestClass]
+    public class HealthEndpointTests
+    {
+        private const string CUSTOM_CONFIG_FILENAME = "custom_config.json";
+        private const string BASE_DAB_URL = "http://localhost:5000";
+
+        [TestCleanup]
+        public void CleanupAfterEachTest()
+        {
+            if (File.Exists(CUSTOM_CONFIG_FILENAME))
+            {
+                File.Delete(CUSTOM_CONFIG_FILENAME);
+            }
+
+            TestHelper.UnsetAllDABEnvironmentVariables();
+        }
+
+        /// <summary>
+        /// Simulates a GET request to DAB's comprehensive health check endpoint ('/health') and validates the contents of the response.
+        /// The expected format of the response is the comprehensive health check response.
+        /// </summary>
+        [TestMethod]
+        [TestCategory(TestCategory.MSSQL)]
+        [DataRow(true, true, true, true, true, true, true, DisplayName = "Validate Health Report all enabled.")]
+        [DataRow(false, true, true, true, true, true, true, DisplayName = "Validate when Comprehensive Health Report is disabled")]
+        [DataRow(true, true, true, false, true, true, true, DisplayName = "Validate Health Report when data-source health is disabled")]
+        [DataRow(true, true, true, true, false, true, true, DisplayName = "Validate Health Report when entity health is disabled")]
+        [DataRow(true, false, true, true, true, true, true, DisplayName = "Validate Health Report when global rest health is disabled")]
+        [DataRow(true, true, true, true, true, false, true, DisplayName = "Validate Health Report when entity rest health is disabled")]
+        [DataRow(true, true, false, true, true, true, true, DisplayName = "Validate Health Report when global graphql health is disabled")]
+        [DataRow(true, true, true, true, true, true, false, DisplayName = "Validate Health Report when entity graphql health is disabled")]
+        public async Task ComprehensiveHealthEndpoint_ValidateContents(bool enableGlobalHealth, bool enableGlobalRest, bool enableGlobalGraphql, bool enableDatasourceHealth, bool enableEntityHealth, bool enableEntityRest, bool enableEntityGraphQL)
+        {
+            // Arrange
+            // Create a mock entity map with a single entity for testing
+            RuntimeConfig runtimeConfig = SetupCustomConfigFile(enableGlobalHealth, enableGlobalRest, enableGlobalGraphql, enableDatasourceHealth, enableEntityHealth, enableEntityRest, enableEntityGraphQL);
+            WriteToCustomConfigFile(runtimeConfig);
+
+            string[] args = new[]
+            {
+                $"--ConfigFileName={CUSTOM_CONFIG_FILENAME}"
+            };
+
+            using (TestServer server = new(Program.CreateWebHostBuilder(args)))
+            using (HttpClient client = server.CreateClient())
+            {
+                HttpRequestMessage healthRequest = new(HttpMethod.Get, $"{BASE_DAB_URL}/health");
+                HttpResponseMessage response = await client.SendAsync(healthRequest);
+
+                if (!enableGlobalHealth)
+                {
+                    Assert.AreEqual(expected: HttpStatusCode.NotFound, actual: response.StatusCode, message: "Received unexpected HTTP code from health check endpoint.");
+                }
+                else
+                {
+                    string responseBody = await response.Content.ReadAsStringAsync();
+                    Dictionary<string, JsonElement> responseProperties = JsonSerializer.Deserialize<Dictionary<string, JsonElement>>(responseBody);
+                    Assert.AreEqual(expected: HttpStatusCode.OK, actual: response.StatusCode, message: "Received unexpected HTTP code from health check endpoint.");
+
+                    ValidateBasicDetailsHealthCheckResponse(responseProperties);
+                    ValidateConfigurationDetailsHealthCheckResponse(responseProperties, enableGlobalRest, enableGlobalGraphql);
+                    ValidateIfAttributePresentInResponse(responseProperties, enableDatasourceHealth, HealthCheckConstants.DATASOURCE);
+                    ValidateIfAttributePresentInResponse(responseProperties, enableEntityHealth, HealthCheckConstants.ENDPOINT);
+                    if (enableEntityHealth)
+                    {
+                        ValidateEntityRestAndGraphQLResponse(responseProperties, enableEntityRest, enableEntityGraphQL, enableGlobalRest, enableGlobalGraphql);
+                    }
+                }
+            }
+        }
+
+        [TestMethod]
+        public async Task TestHealthCheckRestResponseAsync()
+        {
+            // Arrange
+            RuntimeConfig runtimeConfig = SetupCustomConfigFile(true, true, true, true, true, true, true);
+            HttpUtilities httpUtilities = SetupRestTest(runtimeConfig);
+
+            // Act
+            // Call the ExecuteRestQuery method with the mock HttpClient
+            // Simulate a REST API call to the endpoint
+            // Response should be null as error message is not expected to be returned
+            string errorMessageFromRest = await httpUtilities.ExecuteRestQuery(
+                restUriSuffix: runtimeConfig.RestPath,
+                entityName: runtimeConfig.Entities.First().Key,
+                first: runtimeConfig.Entities.First().Value.Health.First,
+                incomingRoleHeader: string.Empty,
+                incomingRoleToken: string.Empty
+            );
+
+            // Assert
+            // Validate the null response from the REST API call 
+            Assert.IsNull(errorMessageFromRest);
+        }
+
+        [TestMethod]
+        public async Task TestFailureHealthCheckRestResponseAsync()
+        {
+            // Arrange
+            RuntimeConfig runtimeConfig = SetupCustomConfigFile(true, true, true, true, true, true, true);
+            HttpUtilities httpUtilities = SetupGraphQLTest(runtimeConfig, HttpStatusCode.BadRequest);
+
+            // Act
+            // Call the ExecuteRestQuery method with the mock HttpClient
+            // Simulate a REST API call to the endpoint
+            // Response should be null as error message is not expected to be returned
+            string errorMessageFromRest = await httpUtilities.ExecuteRestQuery(
+                restUriSuffix: runtimeConfig.RestPath,
+                entityName: runtimeConfig.Entities.First().Key,
+                first: runtimeConfig.Entities.First().Value.Health.First,
+                incomingRoleHeader: string.Empty,
+                incomingRoleToken: string.Empty
+            );
+
+            // Assert
+            Assert.IsNotNull(errorMessageFromRest);
+        }
+
+        [TestMethod]
+        public async Task TestHealthCheckGraphQLResponseAsync()
path: src/Service.Tests/Configuration/HealthEndpointTests.cs
user: login: RubenCerna2079
body: At the very least the test methods should have a comment summarizing what they do.
created_at: 2025-05-13T00:15:28Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,492 @@
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT License.
+
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.IO.Abstractions.TestingHelpers;
+using System.Linq;
+using System.Net;
+using System.Net.Http;
+using System.Text.Json;
+using System.Threading;
+using System.Threading.Tasks;
+using Azure.DataApiBuilder.Config;
+using Azure.DataApiBuilder.Config.DatabasePrimitives;
+using Azure.DataApiBuilder.Config.HealthCheck;
+using Azure.DataApiBuilder.Config.ObjectModel;
+using Azure.DataApiBuilder.Core.Authorization;
+using Azure.DataApiBuilder.Core.Configurations;
+using Azure.DataApiBuilder.Core.Services;
+using Azure.DataApiBuilder.Core.Services.MetadataProviders;
+using Azure.DataApiBuilder.Product;
+using Azure.DataApiBuilder.Service.HealthCheck;
+using Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.TestHost;
+using Microsoft.Extensions.Logging;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Moq;
+using Moq.Protected;
+
+namespace Azure.DataApiBuilder.Service.Tests.Configuration
+{
+    [TestClass]
+    public class HealthEndpointTests
+    {
+        private const string CUSTOM_CONFIG_FILENAME = "custom_config.json";
+        private const string BASE_DAB_URL = "http://localhost:5000";
+
+        [TestCleanup]
+        public void CleanupAfterEachTest()
+        {
+            if (File.Exists(CUSTOM_CONFIG_FILENAME))
+            {
+                File.Delete(CUSTOM_CONFIG_FILENAME);
+            }
+
+            TestHelper.UnsetAllDABEnvironmentVariables();
+        }
+
+        /// <summary>
+        /// Simulates a GET request to DAB's comprehensive health check endpoint ('/health') and validates the contents of the response.
+        /// The expected format of the response is the comprehensive health check response.
+        /// </summary>
+        [TestMethod]
+        [TestCategory(TestCategory.MSSQL)]
+        [DataRow(true, true, true, true, true, true, true, DisplayName = "Validate Health Report all enabled.")]
+        [DataRow(false, true, true, true, true, true, true, DisplayName = "Validate when Comprehensive Health Report is disabled")]
+        [DataRow(true, true, true, false, true, true, true, DisplayName = "Validate Health Report when data-source health is disabled")]
+        [DataRow(true, true, true, true, false, true, true, DisplayName = "Validate Health Report when entity health is disabled")]
+        [DataRow(true, false, true, true, true, true, true, DisplayName = "Validate Health Report when global rest health is disabled")]
+        [DataRow(true, true, true, true, true, false, true, DisplayName = "Validate Health Report when entity rest health is disabled")]
+        [DataRow(true, true, false, true, true, true, true, DisplayName = "Validate Health Report when global graphql health is disabled")]
+        [DataRow(true, true, true, true, true, true, false, DisplayName = "Validate Health Report when entity graphql health is disabled")]
+        public async Task ComprehensiveHealthEndpoint_ValidateContents(bool enableGlobalHealth, bool enableGlobalRest, bool enableGlobalGraphql, bool enableDatasourceHealth, bool enableEntityHealth, bool enableEntityRest, bool enableEntityGraphQL)
+        {
+            // Arrange
+            // Create a mock entity map with a single entity for testing
+            RuntimeConfig runtimeConfig = SetupCustomConfigFile(enableGlobalHealth, enableGlobalRest, enableGlobalGraphql, enableDatasourceHealth, enableEntityHealth, enableEntityRest, enableEntityGraphQL);
+            WriteToCustomConfigFile(runtimeConfig);
+
+            string[] args = new[]
+            {
+                $"--ConfigFileName={CUSTOM_CONFIG_FILENAME}"
+            };
+
+            using (TestServer server = new(Program.CreateWebHostBuilder(args)))
+            using (HttpClient client = server.CreateClient())
+            {
+                HttpRequestMessage healthRequest = new(HttpMethod.Get, $"{BASE_DAB_URL}/health");
+                HttpResponseMessage response = await client.SendAsync(healthRequest);
+
+                if (!enableGlobalHealth)
+                {
+                    Assert.AreEqual(expected: HttpStatusCode.NotFound, actual: response.StatusCode, message: "Received unexpected HTTP code from health check endpoint.");
+                }
+                else
+                {
+                    string responseBody = await response.Content.ReadAsStringAsync();
+                    Dictionary<string, JsonElement> responseProperties = JsonSerializer.Deserialize<Dictionary<string, JsonElement>>(responseBody);
+                    Assert.AreEqual(expected: HttpStatusCode.OK, actual: response.StatusCode, message: "Received unexpected HTTP code from health check endpoint.");
+
+                    ValidateBasicDetailsHealthCheckResponse(responseProperties);
+                    ValidateConfigurationDetailsHealthCheckResponse(responseProperties, enableGlobalRest, enableGlobalGraphql);
+                    ValidateIfAttributePresentInResponse(responseProperties, enableDatasourceHealth, HealthCheckConstants.DATASOURCE);
+                    ValidateIfAttributePresentInResponse(responseProperties, enableEntityHealth, HealthCheckConstants.ENDPOINT);
+                    if (enableEntityHealth)
+                    {
+                        ValidateEntityRestAndGraphQLResponse(responseProperties, enableEntityRest, enableEntityGraphQL, enableGlobalRest, enableGlobalGraphql);
+                    }
+                }
+            }
+        }
+
+        [TestMethod]
+        public async Task TestHealthCheckRestResponseAsync()
+        {
+            // Arrange
+            RuntimeConfig runtimeConfig = SetupCustomConfigFile(true, true, true, true, true, true, true);
+            HttpUtilities httpUtilities = SetupRestTest(runtimeConfig);
+
+            // Act
+            // Call the ExecuteRestQuery method with the mock HttpClient
+            // Simulate a REST API call to the endpoint
+            // Response should be null as error message is not expected to be returned
+            string errorMessageFromRest = await httpUtilities.ExecuteRestQuery(
+                restUriSuffix: runtimeConfig.RestPath,
+                entityName: runtimeConfig.Entities.First().Key,
+                first: runtimeConfig.Entities.First().Value.Health.First,
+                incomingRoleHeader: string.Empty,
+                incomingRoleToken: string.Empty
+            );
+
+            // Assert
+            // Validate the null response from the REST API call 
+            Assert.IsNull(errorMessageFromRest);
+        }
+
+        [TestMethod]
+        public async Task TestFailureHealthCheckRestResponseAsync()
+        {
+            // Arrange
+            RuntimeConfig runtimeConfig = SetupCustomConfigFile(true, true, true, true, true, true, true);
+            HttpUtilities httpUtilities = SetupGraphQLTest(runtimeConfig, HttpStatusCode.BadRequest);
+
+            // Act
+            // Call the ExecuteRestQuery method with the mock HttpClient
+            // Simulate a REST API call to the endpoint
+            // Response should be null as error message is not expected to be returned
+            string errorMessageFromRest = await httpUtilities.ExecuteRestQuery(
+                restUriSuffix: runtimeConfig.RestPath,
+                entityName: runtimeConfig.Entities.First().Key,
+                first: runtimeConfig.Entities.First().Value.Health.First,
+                incomingRoleHeader: string.Empty,
+                incomingRoleToken: string.Empty
+            );
+
+            // Assert
+            Assert.IsNotNull(errorMessageFromRest);
+        }
+
+        [TestMethod]
+        public async Task TestHealthCheckGraphQLResponseAsync()
+        {
+            // Arrange
+            RuntimeConfig runtimeConfig = SetupCustomConfigFile(true, true, true, true, true, true, true);
+            HttpUtilities httpUtilities = SetupGraphQLTest(runtimeConfig);
+
+            // Act
+            string errorMessageFromGraphQL = await httpUtilities.ExecuteGraphQLQuery(
+                graphqlUriSuffix: "/graphql",
+                entityName: runtimeConfig.Entities.First().Key,
+                entity: runtimeConfig.Entities.First().Value,
+                incomingRoleHeader: string.Empty,
+                incomingRoleToken: string.Empty);
+
+            // Assert
+            Assert.IsNull(errorMessageFromGraphQL);
+        }
+
+        [TestMethod]
+        public async Task TestFailureHealthCheckGraphQLResponseAsync()
+        {
+            // Arrange
+            RuntimeConfig runtimeConfig = SetupCustomConfigFile(true, true, true, true, true, true, true);
+            HttpUtilities httpUtilities = SetupGraphQLTest(runtimeConfig, HttpStatusCode.InternalServerError);
+
+            // Act
+            string errorMessageFromGraphQL = await httpUtilities.ExecuteGraphQLQuery(
+                graphqlUriSuffix: "/graphql",
+                entityName: runtimeConfig.Entities.First().Key,
+                entity: runtimeConfig.Entities.First().Value,
+                incomingRoleHeader: string.Empty,
+                incomingRoleToken: string.Empty);
+
+            // Assert
+            Assert.IsNotNull(errorMessageFromGraphQL);
+        }
+
+        private static HttpUtilities SetupRestTest(RuntimeConfig runtimeConfig, HttpStatusCode httpStatusCode = HttpStatusCode.OK)
path: src/Service.Tests/Configuration/HealthEndpointTests.cs
user: login: RubenCerna2079
body: I think it would be a good idea to create a region for the helper methods, so it is easier to identify them
created_at: 2025-05-13T00:16:06Z
author_association: CONTRIBUTOR
diff_hunk: @@ -88,50 +74,44 @@ public void ConfigureApiRoute(HttpContext httpContext)
         }
 
         // Executes the REST query by sending a GET request to the API.
-        public string? ExecuteRestQuery(string restUriSuffix, string entityName, int first, string incomingRoleHeader, string incomingRoleToken)
+        public async Task<string?> ExecuteRestQuery(string restUriSuffix, string entityName, int first, string incomingRoleHeader, string incomingRoleToken)
         {
             string? errorMessage = null;
             try
             {
                 // Base URL of the API that handles SQL operations
-                string apiRoute = Utilities.GetServiceRoute(_apiRoute, restUriSuffix);
+                string apiRoute = $"{restUriSuffix}{Utilities.CreateHttpRestQuery(entityName, first)}";
                 if (string.IsNullOrEmpty(apiRoute))
                 {
                     LogTrace("The API route is not available, hence HealthEndpoint is not available.");
                     return errorMessage;
                 }
 
-                if (!Program.CheckSanityOfUrl(apiRoute))
+                if (!Program.CheckSanityOfUrl($"{_httpClient.BaseAddress}{restUriSuffix}"))
path: src/Service/HealthCheck/HttpUtilities.cs
user: login: sezal98
body: Not needed anymore
created_at: 2025-05-14T07:23:40Z
author_association: CONTRIBUTOR
diff_hunk: @@ -145,18 +125,11 @@ public void ConfigureApiRoute(HttpContext httpContext)
 
         // Executes the GraphQL query by sending a POST request to the API.
         // Internally calls the metadata provider to fetch the column names to create the graphql payload.
-        public string? ExecuteGraphQLQuery(string graphqlUriSuffix, string entityName, Entity entity, string incomingRoleHeader, string incomingRoleToken)
+        public async Task<string?> ExecuteGraphQLQuery(string graphqlUriSuffix, string entityName, Entity entity, string incomingRoleHeader, string incomingRoleToken)
         {
             string? errorMessage = null;
-            // Base URL of the API that handles SQL operations
-            string apiRoute = Utilities.GetServiceRoute(_apiRoute, graphqlUriSuffix);
-            if (string.IsNullOrEmpty(apiRoute))
path: src/Service/HealthCheck/HttpUtilities.cs
user: login: sezal98
body: In rest we create the entire query in the URI itself. However, in GraphQL we take the basic query of /graphql and add parameters in payload. 
`CheckSanityOfUrl` already validates the URi of null or empty so we dont need to do again.
created_at: 2025-05-14T07:26:30Z
author_association: CONTRIBUTOR
diff_hunk: @@ -270,6 +271,27 @@ public void ConfigureServices(IServiceCollection services)
             //Enable accessing HttpContext in RestService to get ClaimsPrincipal.
             services.AddHttpContextAccessor();
 
+            services.AddHttpClient("ContextConfiguredHealthCheckClient")
+                .ConfigureHttpClient((serviceProvider, client) =>
+                {
+                    IHttpContextAccessor httpContextAccessor = serviceProvider.GetRequiredService<IHttpContextAccessor>();
+                    HttpContext? httpContext = httpContextAccessor.HttpContext;
+
+                    if (httpContext != null)
+                    {
+                        // Build base address from request
+                        string baseUri = $"{httpContext.Request.Scheme}://{httpContext.Request.Host}";
+                        client.BaseAddress = new Uri(baseUri);
+
+                        // Set default Accept header
+                        client.DefaultRequestHeaders.Accept.Clear();
+                        client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
+                    }
+
+                    // Optional: Set a timeout
+                    client.Timeout = TimeSpan.FromSeconds(200);
path: src/Service/Startup.cs
user: login: sezal98
body: If you don’t set client.Timeout manually, the HttpClient will use the default timeout, which is:
`TimeSpan.FromSeconds(100)`
This means every HTTP request made by this client will wait a maximum of 100 seconds for a response before throwing a TaskCanceledException. Hence, I am setting 200 here. We can change if we want.
created_at: 2025-05-14T07:28:06Z
author_association: CONTRIBUTOR

PR comments:
user: login: sezal98
created_at: 2025-04-28T11:43:11Z
body: /azp run
author_association: CONTRIBUTOR
user: login: azure-pipelines[bot]
created_at: 2025-04-28T11:43:33Z
body: <samp>
Azure Pipelines successfully started running 6 pipeline(s).<br>

</samp>
author_association: NONE
user: login: sezal98
created_at: 2025-04-30T15:32:32Z
body: /azp run
author_association: CONTRIBUTOR
user: login: azure-pipelines[bot]
created_at: 2025-04-30T15:32:57Z
body: <samp>
Azure Pipelines successfully started running 6 pipeline(s).<br>

</samp>
author_association: NONE
user: login: sezal98
created_at: 2025-05-08T07:53:04Z
body: /azp run
author_association: CONTRIBUTOR
user: login: azure-pipelines[bot]
created_at: 2025-05-08T07:53:26Z
body: <samp>
Azure Pipelines successfully started running 6 pipeline(s).<br>

</samp>
author_association: NONE
user: login: sezal98
created_at: 2025-05-08T07:57:41Z
body: /azp run
author_association: CONTRIBUTOR
user: login: azure-pipelines[bot]
created_at: 2025-05-08T07:58:01Z
body: <samp>
Azure Pipelines successfully started running 6 pipeline(s).<br>

</samp>
author_association: NONE
user: login: sezal98
created_at: 2025-05-09T09:15:24Z
body: /azp run
author_association: CONTRIBUTOR
user: login: azure-pipelines[bot]
created_at: 2025-05-09T09:15:48Z
body: <samp>
Azure Pipelines successfully started running 6 pipeline(s).<br>

</samp>
author_association: NONE
user: login: sezal98
created_at: 2025-05-14T09:14:16Z
body: /azp run
author_association: CONTRIBUTOR
user: login: azure-pipelines[bot]
created_at: 2025-05-14T09:14:41Z
body: <samp>
Azure Pipelines successfully started running 6 pipeline(s).<br>

</samp>
author_association: NONE
user: login: Aniruddh25
created_at: 2025-05-14T17:03:16Z
body: /azp run
author_association: COLLABORATOR
user: login: azure-pipelines[bot]
created_at: 2025-05-14T17:03:39Z
body: <samp>
Azure Pipelines successfully started running 6 pipeline(s).<br>

</samp>
author_association: NONE