Setting up continuous deployment of an Azure Function from GitHub is straightforward.
In this article, I already had an Azure Function (created using Visual Studio) in a GitHub repository and an empty Azure Function App.
See this article for information on GitHub
See this article to learn how to create an Azure Function App.
Open the Azure Function App in the Azure portal, as shown in Fig. 1.
Click the "Platform features" link (Fig. 2) to display the "Platform features" page, as shown in Fig. 3.
Under "Code Deployment", click the "Deployment Center" link to open the "Deployment Center" page, as shown in Fig. 4.
On the "Deployment Center" page, select the "GitHub " tile and click the [Continue] button, as shown in Fig. 5.
The wizard advances to the "Configure" page of the "Deployment Center" wizard, as shown in Fig. 6.
At the "Organization" dropdown, select the GitHub account where your code resides. If you don't see the account, you may need to give your Azure account permission to view your GitHub repository.
At the "Repository" dropdown, select the code repository containing your Azure Functions.
At the "Branch" dropdown, select the code branch you wish to deploy whenever a change is pushed to the repository. I almost always select "master" for this.
Click the [Continue] button to advance to the "Summary" page of the "Deployment Center" wizard, as shown in Fig. 7.
On the "Summary" page, review your choices and click the [Finish] button if they are correct. (If they are not correct, click the [Back] button and make the necessary corrections.
In a few minutes, the function or functions in your repository will appear under your Function App in the Azure portal, as shown in Fig. 8.
Any future changes pushed to the repository will automatically be added to the Function App.
For example, I can open my Visual Studio project and add a second function, as shown in Fig. 9
After testing the change, I can push it to my GitHub repository with the following commands:
git add .
git commit -m "Added a new function"
git push origin master
Because a webhook was added to my GitHub repository, this change will be pushed to my Azure Function App. Fig. 10 shows the Function app a few minutes after I pushed my change to GitHub .
In this article, you learned how to configure continuous deployment of your Azure Function App from a GitHub repository.