Skip to content

Commit 313c0db

Browse files
committed
Freshness Edit: Functions
1 parent 15ac51b commit 313c0db

2 files changed

Lines changed: 51 additions & 47 deletions

File tree

articles/azure-functions/functions-how-to-github-actions.md

Lines changed: 50 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
11
---
22
title: Use GitHub Actions to make code updates in Azure Functions
33
description: Learn how to use GitHub Actions to define a workflow to build and deploy Azure Functions projects in GitHub.
4-
ms.topic: conceptual
5-
ms.date: 09/27/2024
4+
ms.topic: how-to
5+
ms.date: 03/02/2026
66
ms.custom: devx-track-csharp, github-actions-azure
77
zone_pivot_groups: github-actions-deployment-options
88
---
99

1010
# Continuous delivery by using GitHub Actions
1111

12-
You can use a [GitHub Actions workflow](https://docs.github.com/actions/learn-github-actions/introduction-to-github-actions#the-components-of-github-actions) to define a workflow to automatically build and deploy code to your function app in Azure Functions.
12+
You can use a [GitHub Actions workflow](https://docs.github.com/actions/learn-github-actions/introduction-to-github-actions#the-components-of-github-actions) to define a workflow to automatically build and deploy code to your function app in Azure Functions.
1313

14-
A YAML file (.yml) that defines the workflow configuration is maintained in the `/.github/workflows/` path in your repository. This definition contains the actions and parameters that make up the workflow, which is specific to the development language of your functions. A GitHub Actions workflow for Functions performs the following tasks, regardless of language:
14+
A YAML file (.yml) that defines the workflow configuration is maintained in the `/.github/workflows/` path in your repository. This definition contains the actions and parameters that make up the workflow, which is specific to the development language of your functions. A GitHub Actions workflow for Functions performs the following tasks, regardless of language:
1515

1616
1. Set up the environment.
1717
1. Build the code project.
1818
1. Deploy the package to a function app in Azure.
1919

20-
The Azure Functions action handles the deployment to an existing function app in Azure.
20+
The Azure Functions action handles the deployment to an existing function app in Azure.
2121

2222
You can create a workflow configuration file for your deployment manually. You can also generate the file from a set of language-specific templates in one of these ways:
2323

2424
+ In the Azure portal
25-
+ Using the Azure CLI
26-
+ From your GitHub repository
25+
+ Using the Azure CLI
26+
+ From your GitHub repository
2727

2828
If you don't want to create your YAML file by hand, select a different method at the top of the article.
2929

@@ -33,15 +33,17 @@ If you don't want to create your YAML file by hand, select a different method at
3333

3434
+ A GitHub account. If you don't have one, sign up for [free](https://github.com/join).
3535

36-
+ A working function app hosted on Azure with source code in a GitHub repository.
36+
+ A working function app hosted on Azure with source code in a GitHub repository.
3737
:::zone pivot="method-cli"
38+
3839
+ [Azure CLI](/cli/azure/install-azure-cli), when developing locally. You can also use the Azure CLI in Azure Cloud Shell.
40+
3941
:::zone-end
4042
::: zone pivot="method-manual,method-template"
4143

4244
## Generate deployment credentials
4345

44-
Since GitHub Actions uses your publish profile to access your function app during deployment, you first need to get your publish profile and store it securely as a [GitHub secret](https://docs.github.com/en/actions/reference/encrypted-secrets).
46+
Since GitHub Actions uses your publish profile to access your function app during deployment, you first need to get your publish profile and store it securely as a [GitHub secret](https://docs.github.com/actions/how-tos/write-workflows/choose-what-workflows-do/use-secrets).
4547

4648
>[!IMPORTANT]
4749
>The publish profile is a valuable credential that allows access to Azure resources. Make sure you always transport and store it securely. In GitHub, the publish profile must only be stored in GitHub secrets.
@@ -54,7 +56,7 @@ Since GitHub Actions uses your publish profile to access your function app durin
5456

5557
1. In [GitHub](https://github.com/), go to your repository.
5658

57-
1. Go to **Settings**.
59+
1. Go to **Settings**.
5860

5961
1. Select **Secrets and variables > Actions**.
6062

@@ -70,7 +72,7 @@ GitHub can now authenticate to your function app in Azure.
7072

7173
## Create the workflow from a template
7274

73-
The best way to manually create a workflow configuration is to start from the officially supported template.
75+
The best way to manually create a workflow configuration is to start from the officially supported template.
7476

7577
1. Choose either **Windows** or **Linux** to make sure that you get the template for the correct operating system.
7678

@@ -104,7 +106,7 @@ The best way to manually create a workflow configuration is to start from the of
104106

105107
# [JavaScript](#tab/javascript/windows)
106108

107-
<https://github.com/Azure/actions-workflow-samples/blob/master/FunctionApp/windows-node.js-functionapp-on-azure.yml>
109+
<https://github.com/Azure/actions-workflow-samples/blob/master/FunctionApp/windows-node.js-functionapp-on-azure.yml>
108110

109111
# [JavaScript](#tab/javascript/linux)
110112

@@ -124,13 +126,13 @@ The best way to manually create a workflow configuration is to start from the of
124126

125127
# [PowerShell](#tab/powershell/linux)
126128

127-
<https://github.com/Azure/actions-workflow-samples/blob/master/FunctionApp/linux-powershell-functionapp-on-azure.yml>
129+
<https://github.com/Azure/actions-workflow-samples/blob/master/FunctionApp/linux-powershell-functionapp-on-azure.yml>
128130

129131
---
130132

131-
1. Update the `env.AZURE_FUNCTIONAPP_NAME` parameter with the name of your function app resource in Azure. You may optionally need to update the parameter that sets the language version used by your app, such as `DOTNET_VERSION` for C#.
133+
1. Update the `env.AZURE_FUNCTIONAPP_NAME` parameter with the name of your function app resource in Azure. You may optionally need to update the parameter that sets the language version used by your app, such as `DOTNET_VERSION` for C#.
132134

133-
1. Add this new YAML file in the `/.github/workflows/` path in your repository.
135+
1. Add this new YAML file in the `/.github/workflows/` path in your repository.
134136

135137
::: zone-end
136138
::: zone pivot="method-portal"
@@ -145,27 +147,28 @@ The portal automatically gets your publish profile and adds it to the GitHub sec
145147

146148
You can get started quickly with GitHub Actions through the Deployment tab when you create a function in Azure portal. To add a GitHub Actions workflow when you create a new function app:
147149

148-
1. In the [Azure portal], select **Deployment** in the **Create Function App** flow.
150+
1. In the [Azure portal], select **Deployment** in the **Create Function App** flow.
149151

150152
:::image type="content" source="media/functions-how-to-github-actions/github-actions-deployment.png" alt-text="Screenshot of Deployment option in Functions menu.":::
151153

152-
1. Enable **Continuous Deployment** if you want each code update to trigger a code push to Azure portal.
154+
1. Enable **Continuous Deployment** if you want each code update to trigger a code push to Azure portal.
153155

154-
1. Enter your GitHub organization, repository, and branch.
156+
1. Enter your GitHub organization, repository, and branch.
155157

156158
:::image type="content" source="media/functions-how-to-github-actions/github-actions-github-account-details.png" alt-text="Screenshot of GitHub user account details.":::
157159

158-
1. Complete configuring your function app. Your GitHub repository now includes a new workflow file in `/.github/workflows/`.
160+
1. Complete configuring your function app. Your GitHub repository now includes a new workflow file in `/.github/workflows/`.
159161

160-
### For an existing function app
162+
### For an existing function app
161163

162164
[!INCLUDE [functions-deploy-github-actions](../../includes/functions-deploy-github-actions.md)]
163165

164166
::: zone-end
165167
::: zone pivot="method-cli"
168+
166169
## Add workflow configuration to your repository
167170

168-
You can use the [`az functionapp deployment github-actions add`](/cli/azure/functionapp/deployment/github-actions) command to generate a workflow configuration file from the correct template for your function app. The new YAML file is then stored in the correct location (`/.github/workflows/`) in the GitHub repository you provide, while the publish profile file for your app is added to GitHub secrets in the same repository.
171+
You can use the [`az functionapp deployment github-actions add`](/cli/azure/functionapp/deployment/github-actions) command to generate a workflow configuration file from the correct template for your function app. The new YAML file is then stored in the correct location (`/.github/workflows/`) in the GitHub repository you provide, while the publish profile file for your app is added to GitHub secrets in the same repository.
169172

170173
1. Run this `az functionapp` command, replacing the values `githubUser/githubRepo`, `MyResourceGroup`, and `MyFunctionapp`:
171174

@@ -175,7 +178,7 @@ You can use the [`az functionapp deployment github-actions add`](/cli/azure/func
175178
176179
This command uses an interactive method to retrieve a personal access token for your GitHub account.
177180
178-
1. In your terminal window, you should see something like the following message:
181+
1. In your terminal window, you should see something like the following message:
179182
180183
```output
181184
Please navigate to https://github.com/login/device and enter the user code XXXX-XXXX to activate and retrieve your GitHub personal access token.
@@ -192,23 +195,24 @@ You can use the [`az functionapp deployment github-actions add`](/cli/azure/func
192195
Creating new workflow file: .github/workflows/master_func-app-123.yml
193196
```
194197
195-
1. Go to your GitHub repository and select **Actions**. Verify that your workflow ran.
198+
1. Go to your GitHub repository and select **Actions**. Verify that your workflow ran.
196199
197200
::: zone-end
198201
::: zone pivot="method-template"
202+
199203
## Create the workflow configuration file
200204
201-
You can create the GitHub Actions workflow configuration file from the Azure Functions templates directly from your GitHub repository.
205+
You can create the GitHub Actions workflow configuration file from the Azure Functions templates directly from your GitHub repository.
202206
203207
1. In [GitHub](https://github.com/), go to your repository.
204208
205-
1. Select **Actions** and **New workflow**.
209+
1. Select **Actions** and **New workflow**.
206210
207-
1. Search for *functions*.
211+
1. Search for *functions*.
208212
209213
:::image type="content" source="media/functions-how-to-github-actions/github-actions-functions-templates.png" alt-text="Screenshot of search for GitHub Actions functions templates. ":::
210214
211-
1. In the displayed functions app workflows authored by Microsoft Azure, find the one that matches your code language and select **Configure**.
215+
1. In the displayed functions app workflows authored by Microsoft Azure, find the one that matches your code language and select **Configure**.
212216
213217
1. In the newly created YAML file, update the `env.AZURE_FUNCTIONAPP_NAME` parameter with the name of your function app resource in Azure. You may optionally need to update the parameter that sets the language version used by your app, such as `DOTNET_VERSION` for C#.
214218
@@ -235,56 +239,56 @@ If your function app runs on Windows, select **Windows**.
235239
236240
# [.NET](#tab/dotnet/windows)
237241
238-
:::code language="yml" source="~/azure-actions-workflow-samples/FunctionApp/windows-dotnet-functionapp-on-azure.yml" range="1-5,13-44":::
242+
:::code language="yml" source="~/azure-actions-workflow-samples/FunctionApp/windows-dotnet-functionapp-on-azure.yml" range="1-5,13-44":::
239243
240244
# [.NET](#tab/dotnet/linux)
241245
242-
:::code language="yml" source="~/azure-actions-workflow-samples/FunctionApp/linux-dotnet-functionapp-on-azure.yml" range="1-5,13-44":::
246+
:::code language="yml" source="~/azure-actions-workflow-samples/FunctionApp/linux-dotnet-functionapp-on-azure.yml" range="1-5,13-44":::
243247
244248
# [Java](#tab/java/windows)
245249
246-
:::code language="yml" source="~/azure-actions-workflow-samples/FunctionApp/windows-java-functionapp-on-azure.yml" range="1-5,13-45":::
250+
:::code language="yml" source="~/azure-actions-workflow-samples/FunctionApp/windows-java-functionapp-on-azure.yml" range="1-5,13-45":::
247251
248252
# [Java](#tab/java/linux)
249253
250-
:::code language="yml" source="~/azure-actions-workflow-samples/FunctionApp/linux-java-functionapp-on-azure.yml" range="1-5,13-45":::
254+
:::code language="yml" source="~/azure-actions-workflow-samples/FunctionApp/linux-java-functionapp-on-azure.yml" range="1-5,13-45":::
251255
252256
# [JavaScript](#tab/javascript/windows)
253257
254-
:::code language="yml" source="~/azure-actions-workflow-samples/FunctionApp/windows-node.js-functionapp-on-azure.yml" range="1-5,13-46":::
258+
:::code language="yml" source="~/azure-actions-workflow-samples/FunctionApp/windows-node.js-functionapp-on-azure.yml" range="1-5,13-46":::
255259
256260
# [JavaScript](#tab/javascript/linux)
257261
258-
:::code language="yml" source="~/azure-actions-workflow-samples/FunctionApp/linux-node.js-functionapp-on-azure.yml" range="1-5,13-46":::
262+
:::code language="yml" source="~/azure-actions-workflow-samples/FunctionApp/linux-node.js-functionapp-on-azure.yml" range="1-5,13-46":::
259263
260264
# [Python](#tab/python/windows)
261265
262266
Python functions aren't supported on Windows. Choose Linux instead.
263267
264268
# [Python](#tab/python/linux)
265269
266-
:::code language="yml" source="~/azure-actions-workflow-samples/FunctionApp/linux-python-functionapp-on-azure.yml" range="1-5,13-47":::
270+
:::code language="yml" source="~/azure-actions-workflow-samples/FunctionApp/linux-python-functionapp-on-azure.yml" range="1-5,13-47":::
267271
268272
# [PowerShell](#tab/powershell/windows)
269273
270-
:::code language="yml" source="~/azure-actions-workflow-samples/FunctionApp/windows-powershell-functionapp-on-azure.yml" range="1-5,13-31":::
274+
:::code language="yml" source="~/azure-actions-workflow-samples/FunctionApp/windows-powershell-functionapp-on-azure.yml" range="1-5,13-31":::
271275
272276
# [PowerShell](#tab/powershell/linux)
273277
274-
:::code language="yml" source="~/azure-actions-workflow-samples/FunctionApp/linux-powershell-functionapp-on-azure.yml" range="1-5,13-31":::
278+
:::code language="yml" source="~/azure-actions-workflow-samples/FunctionApp/linux-powershell-functionapp-on-azure.yml" range="1-5,13-31":::
275279
276-
---
280+
---
277281
278282
## Azure Functions action
279283
280-
The Azure Functions action (`Azure/functions-action`) defines how your code is published to an existing function app in Azure, or to a specific slot in your app.
284+
The Azure Functions action (`Azure/functions-action`) defines how your code is published to an existing function app in Azure, or to a specific slot in your app.
281285
282286
### Parameters
283287
284288
The following parameters are required for all function app plans:
285289
286290
|Parameter |Explanation |
287-
|---------|---------|
291+
|--------- | --------- |
288292
|_**app-name**_ | The name of your function app. |
289293
|***package*** | This is the location in your project to be published. By default, this value is set to `.`, which means all files and folders in the GitHub repository will be deployed.|
290294
@@ -298,22 +302,22 @@ The following parameters are required for the Flex Consumption plan:
298302
The following parameters are specific to the Consumption, Elastic Premium, and App Service (Dedicated) plans:
299303
300304
|Parameter |Explanation |
301-
|---------|---------|
305+
|--------- |--------- |
302306
|_**scm-do-build-during-deployment**_ | (Optional) Allow the Kudu site (e.g. `https://<APP_NAME>.scm.azurewebsites.net/`) to perform pre-deployment operations, such as [remote builds](functions-deployment-technologies.md#remote-build). By default, this is set to `false`. Set this to `true` when you do want to control deployment behaviors using Kudu instead of resolving dependencies in your GitHub workflow. For more information, see the [`SCM_DO_BUILD_DURING_DEPLOYMENT`](./functions-app-settings.md#scm_do_build_during_deployment) setting.|
303307
|_**enable-oryx-build**_ | (Optional) Allow Kudu site to resolve your project dependencies with Oryx. By default, this is set to `false`. If you want to use [Oryx](https://github.com/Microsoft/Oryx) to resolve your dependencies instead of the GitHub Workflow, set both **scm-do-build-during-deployment** and **enable-oryx-build** to `true`.|
304308
305309
Optional parameters for all function app plans:
306310
307-
|Parameter |Explanation |
308-
|---------|---------|
311+
|Parameter | Explanation |
312+
| --------- | --------- |
309313
| ***slot-name*** | This is the [deployment slot](functions-deployment-slots.md) name to be deployed to. By default, this value is empty, which means the GitHub Action will deploy to your production site. When this setting points to a non-production slot, please ensure the **publish-profile** parameter contains the credentials for the slot instead of the production site. _Currently not supported in Flex Consumption_. |
310314
|***publish-profile*** | The name of the GitHub secret that contains your publish profile.|
311315
| _**respect-pom-xml**_ | Used only for Java functions. Whether it's required for your app's deployment artifact to be derived from the pom.xml file. When deploying Java function apps, you should set this parameter to `true` and set `package` to `.`. By default, this parameter is set to `false`, which means that the `package` parameter must point to your app's artifact location, such as `./target/azure-functions/` |
312316
| _**respect-funcignore**_ | Whether GitHub Actions honors your .funcignore file to exclude files and folders defined in it. Set this value to `true` when your repository has a .funcignore file and you want to use it exclude paths and files, such as text editor configurations, .vscode/, or a Python virtual environment (.venv/). The default setting is `false`. |
313317
314318
### Considerations
315319
316-
Keep the following considerations in mind when using the Azure Functions action:
320+
Keep the following considerations in mind when using the Azure Functions action:
317321
318322
+ When using GitHub Actions, the way that your code is deployed depends on your hosting plan, as shown in this table:
319323
@@ -322,13 +326,13 @@ Keep the following considerations in mind when using the Azure Functions action:
322326
| [Flex Consumption](./flex-consumption-plan.md) | [One deploy](./functions-deployment-technologies.md#one-deploy) |
323327
| [Elastic Premium](./functions-premium-plan.md) | [Zip deploy](deployment-zip-push.md) to apps on the [Consumption](./consumption-plan.md) |
324328
| [Dedicated (App Service)](./dedicated-plan.md) | [Zip deploy](deployment-zip-push.md) to apps on the [Consumption](./consumption-plan.md) |
325-
| [Consumption](./consumption-plan.md) | Windows: [Zip deploy](deployment-zip-push.md)<br/>Linux: [external package URL](./functions-deployment-technologies.md#external-package-url)<sup>*</sup> |
329+
| [Consumption](./consumption-plan.md) | Windows: [Zip deploy](deployment-zip-push.md)<br/>Linux: [external package URL](./functions-deployment-technologies.md#external-package-url)<sup>*</sup> |
326330
327-
\* The ability to run your apps on Linux in a Consumption plan is planned for retirement. For more information, see [Azure Functions Consumption plan hosting](consumption-plan.md).
331+
\* The ability to run your apps on Linux in a Consumption plan is planned for retirement. For more information, see [Azure Functions Consumption plan hosting](consumption-plan.md).
328332
329333
+ The credentials required by GitHub to connection to Azure for deployment are stored as Secrets in your GitHub repository and accessed in the deployment as `secrets.<SECRET_NAME>`.
330334
331-
+ The easiest way for GitHub Actions to authenticate with Azure Functions for deployment is by using a publish profile. You can also authenticate using a service principal. To learn more, see [this GitHub Actions repository](https://github.com/Azure/functions-action).
335+
+ The easiest way for GitHub Actions to authenticate with Azure Functions for deployment is by using a publish profile. You can also authenticate using a service principal. To learn more, see [this GitHub Actions repository](https://github.com/Azure/functions-action).
332336
333337
+ The actions for setting up the environment and running a build are generated from the templates, and are language specific.
334338

0 commit comments

Comments
 (0)