Python Azure Function throws "SSLCertVerificationError" when try to invoke on-prem API endpoint

Béla Tóth 20 Reputation points
2024-05-27T07:55:44.9133333+00:00

We have an azure function (linux) which runs python functions, one function should reach one of our on-prem servers (phpIPAM) via REST API. The server has valid certification, issued by our CA (we have 2 level CA environment: root CA-intermediate CA-host). When I try to invoke the API endpoint, I got the following message:

'Error: HTTPSConnectionPool(host=<host fqdn>, port=443): Max retries exceeded with url: /api/<APIAppName>/user (Caused by SSLError(SSLCertVerificationError(1, [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain
Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
4,487 questions
{count} votes

Accepted answer
  1. Ryan Hill 26,771 Reputation points Microsoft Employee
    2024-05-27T22:01:29.7+00:00

    Hi @Béla Tóth

    Thank you for posting your question on the Q&A platform. I'm glad that you were able to resolve your issue and thank you for posting your solution so that others experiencing the same thing can easily reference this!

    Since the Microsoft Q&A community has a policy that the question author cannot accept their own answer, they can only accept answers by others, I'll repost your solution in case you'd like to Accept the answer.


    You have an Azure Function running on a Linux-based hosting plan. This function interacts with a on-premises server through a REST API. Your on-premises server uses a valid certificate issued by your CA and when issuing a request, the request ends in an error message, 'Error: HTTPSConnectionPool(host=.

    To resolve your issue, you configured REQUESTS_CA_BUNDLE environment variable to the functions local certificate path, /etc/ssl/certs/.

    0 comments No comments

0 additional answers

Sort by: Most helpful