Running Local Azure Functions in Visual Studio with HTTPS

This article shows how to setup a Visual Studio Azure Functions project to work with HTTPS for local development. HTTP is configured per default and not HTTPS. The command line arguments need to be set correctly, and then the Azure Functions can be started in Visual Studio with HTTPS and take advantage of the break point debugging without having to attach the func process in Visual Studio.

Install the tools for local Azure Function development

To get Azure Functions to run locally, the following tools need to be installed. (As well as Visual Studio with the Azure components).

Microsoft Azure Storage Explorer

Microsoft Azure Storage Emulator

Install the Azure Functions Core Tools

npm install -g azure-functions-core-tools

Install the Azure Functions Visual Studio Extensions

Azure Functions and Web Jobs Tools need to be installed as an extension in Visual Studio.

Configure the Azure Functions project to use HTTPS

Create a certificate and add this to the operating system.

openssl genrsa -des3 -passout pass:x -out server.pass.key 2048
openssl rsa -passin pass:x -in server.pass.key -out server.key
openssl req -new -key server.key -out server.csr
openssl x509 -req -sha256 -days 365 -in server.csr -signkey server.key -out server.crt


New-SelfSignedCertificate -DnsName "", "" -CertStoreLocation "cert:\LocalMachine\My"

Get the thumbprint for later use

$mypwd = ConvertTo-SecureString -String "1111" -Force -AsPlainText

Get-ChildItem -Path cert:\localMachine\my\"thumbprint  from above" | Export-PfxCertificate -FilePath C:\server.pfx -Password $mypwd

Copy the pfx file to the Function project, and configure the properties to copy this to the output.

Configure the command line arguments for Debug. The application arguments starts with host in Visual Studio and not func! This would be func in the command line.

Or just set this in the launchSettings.json

  "profiles": {
    "FunctionApp1": {
      "commandName": "Project",
      "commandLineArgs": "host start --useHttps --cert \"server.pfx\" --password \"1111\""

When you start the Azure Function project with Visual Studio, the HTTPS URL will be used. This can be checked in the command line window which opens up after starting. Break point debugging is now possible as we started from Visual Studio.

If you start this from the console using the func start –useHttps –cert “server.pfx” –password “1111”, you need to attach the func process for break point debugging for using Visual Studio.


One comment

  1. […] Running Local Azure Functions in Visual Studio with HTTPS – Damien Bowden […]

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: