I have a certificate file in my Azure Function (.NET Core 3.1) solution that resides at this location in my solution:
C:\Users\me\Documents\Code\Test\TestSolution\Test.Subproject\Certificates\cert.p12
The file is set to Copy if newer
and Build Action is Content
.
I reference the file like this in my code:
_client.Certificates.Add(new Certificate("Certificates/cert.p12", "ssl_094243"));
It works fine in the Azure Function Emulator but when deployed to Azure it can't find the file. In my publish output the folder structure is flattened somewhat so now the file is found at:
C:\Users\me\Downloads\Test.Functions.zip\Content\D_C\a\1\s\Test\Test.Functions\obj\Release\netcoreapp3.1\PubTmp\Out\Certificates\cert.p12
How can I reference this file in my code? I think I need the application route. I tried the code below but it didn't work unfortunately.
_client.Certificates.Add(new Certificate(Path.Combine(Environment.CurrentDirectory, "Certificates/cert.p12"), "ssl_094243"));