Azure Functions App | Certificate Based API Calls

Abhay Chandramouli 1,026 Reputation points
2023-12-08T14:31:24.0066667+00:00

Hi

I have a Azure Function App. I have a target system api call to be made from the function app.
It needs to be a mTLS api call.

  1. Please guide me how to send a certificate in api call from function apps ?
  2. Where to store the certificate and how to access it ?
  3. How to achieve mTLS from function app to target systems ?

Thanks !

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
5,083 questions
.NET
.NET
Microsoft Technologies based on the .NET software framework.
3,908 questions
ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,604 questions
{count} votes

2 answers

Sort by: Most helpful
  1. MuthuKumaranMurugaachari-MSFT 22,336 Reputation points
    2023-12-08T16:52:31.52+00:00

    Abhay Chandramouli Thanks for posting your question in Microsoft Q&A. Based on the description, you are looking to add TLS/SSL certificate to function app and then access the certificate and send it when making API call.

    1. You can upload TLS/SSL certificate directly to Azure Functions, but the recommended way is to keep it in Azure Key Vault and import the certificate in the Function app. Here is the detailed doc: https://learn.microsoft.com/en-us/azure/app-service/configure-ssl-certificate?toc=%2Fazure%2Fazure-functions%2Ftoc.json&tabs=apex for App service which is applicable for Functions too.
    2. To access the certificate in your app code, add setting "WEBSITE_LOAD_CERTIFICATES" as described in the doc: https://learn.microsoft.com/en-us/azure/app-service/configure-ssl-certificate-in-code or simply add * to access all added certificates.
    3. Then using the code snippet shared in the doc, you can retrieve the certificate info in your application code and make targeted HTTP call which vary depending on the implementation. Here is reference guide for ASP.NET core Implement an HttpClient using a certificate and IHttpClientFactory.

    Check out similar discussion in SO thread (other discussion) with the sample code snippet that will help you get started. I hope this helps and let me know if any questions.


    If you found the answer to your question helpful, please take a moment to mark it as Yes for others to benefit from your experience. Or simply add a comment tagging me and would be happy to answer your questions.

    1 person found this answer helpful.

  2. Bruce (SqlWork.com) 66,226 Reputation points
    2023-12-08T16:34:30.6466667+00:00
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.