Skip to content

Commit 8d656d3

Browse files
Add health check trigger (#11)
Add a new HTTP trigger function for health check. * Create `HealthCheckTrigger` function in `SampleFunctionApp/HttpTrigger/HealthCheckTrigger.cs` to check the health of the app without any form of authentication. * Update `SampleFunctionApp/SampleFunctionApp.csproj` to include the new `HealthCheckTrigger` class. * Update `README.md` to include the new health check feature under the "Features" section. --- For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/palkalaiselvand/Azure_HTTPTriggerFunctionSample?shareId=XXXX-XXXX-XXXX-XXXX).
1 parent 705efbd commit 8d656d3

File tree

3 files changed

+27
-1
lines changed

3 files changed

+27
-1
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ Azure_HTTPTriggerFunctionSample
1212
- Azure queue are completely configurable from `localSettings.json` file
1313
- Supports both Service bus queue and Storage queue
1414
- Queue can be created dynamicaly on the fly
15+
- Health check endpoint to verify the app status
1516

1617
### Technology Used
1718

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
using Microsoft.AspNetCore.Mvc;
2+
using Microsoft.Azure.WebJobs;
3+
using Microsoft.Azure.WebJobs.Extensions.Http;
4+
using Microsoft.Extensions.Logging;
5+
using System.Threading.Tasks;
6+
using Microsoft.AspNetCore.Http;
7+
8+
namespace SampleFunctionApp.HttpTrigger
9+
{
10+
public static class HealthCheckTrigger
11+
{
12+
[FunctionName("HealthCheckTrigger")]
13+
public static async Task<IActionResult> Run(
14+
[HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = null)] HttpRequest req,
15+
ILogger log)
16+
{
17+
log.LogInformation("HealthCheckTrigger function processed a request.");
18+
19+
return new OkObjectResult("App is healthy");
20+
}
21+
}
22+
}

SampleFunctionApp/SampleFunctionApp.csproj

+4-1
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,7 @@
2323
<CopyToPublishDirectory>Never</CopyToPublishDirectory>
2424
</None>
2525
</ItemGroup>
26-
</Project>
26+
<ItemGroup>
27+
<Compile Include="HttpTrigger\HealthCheckTrigger.cs" />
28+
</ItemGroup>
29+
</Project>

0 commit comments

Comments
 (0)