Im running Python scripts inside a windows container and encounter the following error
ServiceRequestError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1056)
I am using the following from azure.storage.blob import BlobServiceClient
Container Base Image --- python3.7.2windows:ltsc2019-202302
Issue doesn't happen on my local machine
What I have tried:
pip install --upgrade certifi
It turns out the Windows Container Image i used does not have the Trusted Root Certificates.
How i fixed it:
Here are the Dockerfile - Powershell commands that I used to import for both LocalMachine and CurrentUser Certificate Stores.
RUN Import-Certificate -FilePath "\MySolution\CertificateFolder\ExportedCertificate.cer" -CertStoreLocation cert:\LocalMachine\Root
RUN Import-Certificate -FilePath "\MySolution\CertificateFolder\ExportedCertificate.cer" -CertStoreLocation cert:\CurrentUser\Root