In this blog post we will cover how to deploy your Azure Function using Azure DevOps to try to get away from the right click publish way of deploying / or deploying straight from VS Code for example (ideally we want to run tests against our code). In my case I will be deploying a PowerShell Azure Function.

In Azure DevOps we have a new repo project which has our Azure Function code within a repository in Azure DevOps.

If we choose select Create Pipeline

We can then choose, Azure Repos Git like so:-

Then we need to select the Repo, next we select PowerShell Function App to Windows on Azure

Next we need to select the correct Azure Subscription, and then choose an existing Function App Name, then click Validate and configure.

So now we have a pipeline YAML file which will build and deploy your Azure PowerShell Function to Azure itself and the Yaml looks like the following:-

We can set our pipeline to build and deploy the code whenever any code changes are commited to the Azure Repo. As you can see highlighted above we do this by using a trigger: – master which means any commits to this branch will run the pipeline.

This is pretty simple stuff but its nice to know that Azure DevOps can tell from the repo that we have a PowerShell Azure Function and can create our yaml for us.

Leave a Reply

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