Azure / Azure/Azure-Functions

Linux Flex Consumption plans don't load Certificates for use in code

Open
#2,658 4 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
PowerShell
Stars
1.1k
Forks
215
Avg merge
4h 2m
Merged PRs (30d)
1

Description

In the documentation on this page:

[Load certificates in Linux/Windows containers
](https://learn.microsoft.com/en-us/azure/app-service/configure-ssl-certificate-in-code?tabs=linux#load-certificates-in-linuxwindows-containers)

It says to load certificates you load directly from file:

```
var cert = X509CertificateLoader.LoadCertificateFromFile("/var/ssl/certs/.der");
```

or for keys:

```
var cert = X509CertificateLoader.LoadCertificateFromFile("/var/ssl/private/.p12");
```

However, neither of these appear to work. I'm trying to load a private key to be able to authenticate to SharePoint using an AppId and a Certificate, but the error being thrown here is `ASN1 corrupted data`.

The certificate has been loaded into Bring Your Own .pfx and imported via Azure Key Vault. All checks are green on the certificate details within BYO. The thumbprint is added to `WEBSITE_LOAD_CERTIFICATES` in Environment Variables. The function app has been restarted several times, but for whatever reason, the certificate is unable to load.

I do note that on here: https://stackoverflow.com/questions/79642574/azure-certificates-are-unable-to-copy-to-linux-app-service there appeared to be a similar issue with the paths not being created, however I did get a similar "Not found" issue until I realised I had the path wrong (certs vs private for loading the private key).

Is there something missing from Flex Consumption Plan implementation, or a difference in the documentation that needs to be updated?

Does there need to be a page on the Azure Functions documentation to call out using certificates in Flex Consumption plans?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.