New-SelfSignedCertificate not recognized in Powershell script of azure function

Sachin Dev Tomar 0 Reputation points
2024-07-13T07:32:17.1633333+00:00

I want to create self signed certificate using my run.ps1 under my Azure function but it is throughing error saying that "New-SelfSignedCertificate cmdlet is not recognized". AFAIK this command is available by default.

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
5,114 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Luke Murray 11,091 Reputation points MVP
    2024-07-13T08:44:09.45+00:00

    New-SelfSignedCertificate is not part of the Modules that are implemented in Azure Functions.

    You will need to install/add the module to the: requirements.psd1 file the PKI module.

    Try adding PKI (the module name).

    I noticed this as well: https://www.powershellgallery.com/packages/SelfSignedCertificate/0.0.4.

    Reference: Dependency Management

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.