web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)
Answered

Read .pfx certificate file in Azure Function/D365 CRM online

(0) ShareShare
ReportReport
Posted on by 1,829

Hi All,

I am working on azure function and I have to read the .pfx certificate file. Can some one please guide where to store the .pfx certificate and use in azure function?

I tried the below approaches but always I get the error "specified file could not find":
1) Tried uploading the file in KeyValut certificate, It restrict me to upload the .pfx file, it gives the error "Unsupported key size (1024). Supported sizes are [2048, 3072, 4096]".
2) Uploaded the file in AzureBlob and read the file by url in azure function, unfortunately it doesn't help.
3)Reading the file from kudo bin(azure function) doesnt work

 X509Certificate2 cert = new X509Certificate2("certificatepath", "password");


Thanks
Hemant

*This post is locked for comments

I have the same question (0)
  • Verified answer
    RaviKashyap Profile Picture
    55,410 Moderator on at

    Hi,

    I worked on the similar scenario where I wanted run my code recusivly. I used Azure function app and configure a timer trigger. The App was console application which uses the Certificate.  Whithin the console app, I retrieved the certificate path from config. The actual certificate file I stored in in Kudo under the Resource folder and the updated the path in config like this-

    <add key="SigningCertificate" value="D:\home\site\wwwroot\MyAzureFunction\Resources\cert\mycertificatefile.pfx" />

    I referred the below blog for this-

    anthonychu.ca/.../

    Hopefully this will help you as well.

  • Hemant Kumar Sahu Profile Picture
    1,829 on at

    Thanks Ravi for your reply.

    Did you create a folder "Resources" in kudo?

    I can not find the folder 'Resources' in kudo when I open it so I created folder manually in kudo but whenever I build my Azure Function and publish from visual studio , the folder gets removed.

    Regards

    Hemant

  • Suggested answer
    RaviKashyap Profile Picture
    55,410 Moderator on at

    No,

    I had that folder in my solution itself. Refer below screenshot. By the way, it does not have to be a same folder structure as long as you provide the correct path while reading the certificate file.

    visual-studio.png

    Hope this helps.

  • Hemant Kumar Sahu Profile Picture
    1,829 on at

    Thanks Ravi, I am able to manage it.

    Regards

    Hemant

  • Hrishikesh Sawalkar Profile Picture
    30 on at

    Hello Hemant,

    I have same problem. How you manage this. I created folder inside my project as cert but when i deploy i can't find same in deployed version.

    Can you please help to check this issue

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans