Azure Functions 101: Publishing Azure Functions Using GitHub Actions

2 minute read

This is the fifth post in a series: Azure Functions 101. In this series, I will be covering the following topics:

In the previous post we created our Todo API using the Azure Functions Core Tools and ran it locally. Now we need to deploy it to Azure. In this post I will be showing you how to publish Azure Functions using GitHub Actions. This is going to be a very short post. Let’s get started.

Get the Publish Profile

The first thing we need to do is get the publish profile for our Azure Function. To do this, navigate to your Azure Function in the Azure Portal – the one you deployed in part 3 if you were following along this series. Click on the Get publish profile button. This will download a file containing the publish profile for your Azure Function. Copy the contents of this file and add them to a GitHub secret called AZURE_FUNCTIONAPP_PUBLISH_PROFILE. You can read more about GitHub secrets here.

I really would have loved to get the publishing profile in the Bicep template and add it to the GitHub workflow as an output to the ‘publish’ job. Unfortunately, after numerous attempts, I couldn’t get it working. If you know how to do this, please let me know in the comments section below. I will greatly appreciate it.

Update the GitHub Workflow

Now we need to update the GitHub workflow we created in part 3 to publish our Azure Function. Update it so it looks like this:

GitHub workflow

We have added another job to the workflow called publish-function. This job will run after the deploy-infrastructure job since it needs to wait for the resources to be successfully deployed before it can publish the Azure Function. The publish-function jobs gets the function app name from the deploy-infrastructure job – the output we declared in our Bicep template. If we push our code to GitHub now, the workflow will run and publish our Azure Function.


That’s it. Now when you push your code to GitHub, the GitHub workflow will run and publish your Azure Function. You can find the code for this series on GitHub. This is the last post in this series. I hope you enjoyed it. If you have any questions or comments, please leave them in the comments section below.