In this short blog post, I have a look at the possibility to deploy Azure Functions from an external GIT repository. In my specific example, the repository is located in a DevOps repo in a different tenant. If the DevOps instance would be in the same tenant we could actually connect it using the full CI/CD functionality where your changes are pushed automatically using webhooks. But since this is not the case I had a closer look at the very easy deployment using “External GIT”.
Although the update in this case is only manual and at the push of a sync-button, which is perfectly sufficient in my case. This might be the use-case for an Azure Function running in your customers tenant but the source code is kept in your companies DevOps.
We start the setup in the Azure Portal. In the fist step navigate to your Azure Function and go to the Deployment Center.
In this Deployment Center you can find various possibilities to sync your Azure Function with some kind of repository. Here we use the probably easiest, but manual way to sync the app using a private “External Git” repository.
To access the repository, we need to create the appropriate credentials.
Generate GIT credentials
To create these credentials we browse to our repository in DevOps and hit the Clone button.
Here we could now generate the Git credentials we will use to authenticate from our deployment.
We use this information to fill in the required fields in the Deployment Center, so move back to the Azure Portal.
Whenever you change your code, you could now hit the Sync button to fetch the Azure Function from the repository and rebuild it.
This is how you could deploy Azure Functions from an external GIT repository.