Skip to content

Commit 2725ded

Browse files
authored
Merge pull request #1 from ggailey777/ahmed
Suggested revisions to the Actions article
2 parents 1a8a3d7 + 5f8250e commit 2725ded

File tree

5 files changed

+43
-44
lines changed

5 files changed

+43
-44
lines changed

articles/azure-functions/TOC.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,10 +186,10 @@
186186
href: functions-continuous-deployment.md
187187
- name: Deployment slots
188188
href: functions-deployment-slots.md
189-
- name: Build and deploy using GitHub Actions
190-
href: functions-how-to-github-actions.md
191189
- name: Build and deploy using Azure Pipelines
192190
href: functions-how-to-azure-devops.md
191+
- name: Build and deploy using GitHub Actions
192+
href: functions-how-to-github-actions.md
193193
- name: Zip deployment
194194
href: deployment-zip-push.md
195195
- name: Run from package
Lines changed: 41 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
---
2-
title: Continuously deliver function code updates by using GitHub Actions - Azure Functions
3-
description: Learn how to set up GitHub Action that targets Azure Functions.
2+
title: Use GitHub Actions to make code updates in Azure Functions
3+
description: Learn how to use GitHub Actions to define a workflow to build and deploy Azure Functions projects in GitHub.
44
author: ahmedelnably
5-
manager: jeconnoc
6-
5+
manager: gwallace
76
ms.service: azure-functions
87
ms.topic: conceptual
98
ms.date: 09/16/2019
@@ -12,58 +11,56 @@ ms.author: aelnably
1211

1312
# Continuous delivery by using GitHub Action
1413

15-
You can automatically deploy your function to an Azure Functions app by using [GitHub Actions](https://github.com/features/actions). As GitHub Actions still in a closed beta, you'll need to sign up [here](https://github.com/features/actions).
14+
[GitHub Actions](https://github.com/features/actions) lets you define a workflow to automatically build and deploy your functions code to function app in Azure.
15+
16+
> [!IMPORTANT]
17+
> GitHub Actions is currently in beta. You must first [sign-up to join the preview](https://github.com/features/actions) using your GitHub account.
1618
17-
## Create a Workflow
19+
In GitHub Actions, a [workflow](https://help.github.com/articles/about-github-actions#workflow) is an automated process that you define in your GitHub repository. This process tells GitHub how to build and deploy your functions app project on GitHub.
1820

19-
For a Workflow to be executed, you need a `{whatever name you like}.yml` file under the `/.github/workflows/` path in your repo, this file contains the different steps and parameters for that workflow. For Azure Functions, we separate that file in three sections: authentication, build section, and deploy section.
21+
A workflow is defined by a YAML (.yml) file in the `/.github/workflows/` path in your repository. This definition contains the various steps and parameters that make up the workflow.
2022

21-
### Authentication
23+
For an Azure Functions workflow, the file has three sections:
2224

23-
To give the workflow the ability to deploy to your function app, you will need to set up two things: 1- A service principal 2- A secret under your GitHub repo called **AZURE_CREDENTIALS**
25+
| Section | Tasks |
26+
| ------- | ----- |
27+
| **Authentication** | <ol><li>Define a service principal.</li><li>Create a GitHub secret.</li></ol>|
28+
| **Build** | <ol><li>Set up the environment.</li><li>Build the function app.</li></ol> |
29+
| **Deploy** | <ol><li>Deploy the function app.</li></ol>|
2430

25-
**Setting up a service principal**
31+
## Create a service principal
2632

27-
You can do that by executing the following [Azure CLI](https://docs.microsoft.com/cli/azure/), this can be done from the [Azure Cloud Shell](https://shell.azure.com).
33+
You can create a [service principal](../active-directory/develop/app-objects-and-service-principals.md#service-principal-object) by using the [az ad sp create-for-rbac](/cli/azure/ad/sp?view=azure-cli-latest#az-ad-sp-create-for-rbac) command in the [Azure CLI](/cli/azure/). You can run this command using [Azure Cloud Shell](https://shell.azure.com) in the Azure portal or by selecting the **Try it** button.
2834

2935
```azurecli-interactive
3036
az ad sp create-for-rbac --name "myApp" --role contributor --scopes /subscriptions/<SUBSCRIPTION_ID>/resourceGroups/<RESOURCE_GROUP>/providers/Microsoft.Web/sites/<APP_NAME> --sdk-auth
3137
```
3238

33-
> [!IMPORTANT]
34-
> It is always a good practice to grant minimum access, in this case only for the site not the whole resource group.
35-
36-
**Setting up a GitHub secret**
37-
38-
Using the output of the Azure CLI command, browse your repo webpage.
39-
40-
Click on Settings
39+
In this example, replace the placeholders in the resource with your subscription ID, resource group, and function app name. The output is the role assignment credentials that provides access to your function app. Copy this JSON object, which you can use to authenticate from GitHub.
4140

42-
![Click Settings](media/functions-how-to-github-actions/click-settings.png)
43-
44-
Click on Secrets
45-
46-
![Click Secrets](media/functions-how-to-github-actions/click-secrets.png)
41+
> [!IMPORTANT]
42+
> It is always a good practice to grant minimum access. This is why the scope in the previous example is limited to the specific function app and not the entire resource group.
4743
48-
Add the **AZURE_CREDENTIALS** secret with the value from the output from the Azure CLI command
44+
## Configure the GitHub secret
4945

50-
![Add Secret](media/functions-how-to-github-actions/add-secret.png)
46+
1. In [GitHub](https://github/com), browse your repository, select **Settings** > **Secrets** > **Add a new secret**.
5147

48+
![Add Secret](media/functions-how-to-github-actions/add-secret.png)
5249

53-
### Build
50+
1. Use `AZURE_CREDENTIALS` for the **Name** and the copied command output for **Value**, then select **Add secret**.
5451

55-
To build you functionapp, you'll need to: 1- setup the environment, 2- build your app
52+
GitHub can now authenticate to your function app in Azure.
5653

57-
**Setting up**
54+
## Set up the environment
5855

5956
Setting up the environment can be done using one of the publish setup actions.
6057

6158
|Language | Setup Action |
6259
|---------|---------|
63-
|.Net | actions/setup-dotnet |
64-
|NodeJS | actions/setup-node |
65-
|Python | actions/setup-python |
66-
|Java | actions/setup-java |
60+
|**.NET** | `actions/setup-dotnet` |
61+
|**Java** | `actions/setup-java` |
62+
|**JavaScript** | `actions/setup-node` |
63+
|**Python** | `actions/setup-python` |
6764

6865
A snippet from the yaml file for a Node JS app that uses version 10
6966

@@ -78,7 +75,7 @@ A snippet from the yaml file for a Node JS app that uses version 10
7875
node-version: '10.x'
7976
```
8077
81-
**Build the app**
78+
## Build the function app
8279
8380
This depends on the language and for languages supported by Azure Functions, this section should be the standard build steps of each language.
8481
As an example for Node JS
@@ -98,15 +95,17 @@ A snippet from the yaml file for a Node JS app
9895
popd
9996
```
10097
101-
### Deploy
98+
This depends on the language and for languages supported by Azure Functions, this section should be the standard build steps of each language
10299
103-
To deploy your code to a function app, you will need to use the `Azure/functions-action` action, there are two parameters that this action uses:
100+
## Deploy the function app
104101
102+
To deploy your code to a function app, you will need to use the `Azure/functions-action` action. This action has two parameters:
105103

106104
|Parameter |Explanation |
107105
|---------|---------|
108-
|app-name | mandatory: that's the name of the azure function app |
109-
|slot-name | optional: that's the name of the slot you want to deploy to, it should already be created under `app-name` |
106+
|**_app-name_** | (Mandatory) The name of your function app. |
107+
|_**slot-name**_ | (Optional) The name of the [deployment slot](functions-deployment-slots.md) you want to deploy to. The slot must already be defined in your function app. |
108+
110109

111110
The following snippet show how to use version 1 of the action
112111

@@ -118,9 +117,9 @@ The following snippet show how to use version 1 of the action
118117
app-name: PLEASE_REPLACE_THIS_WITH_YOUR_FUNCTION_APP_NAME
119118
```
120119

121-
There are a number of samples available under the [Azure GitHub Actions workflow samples repo](https://github.com/Azure/actions-workflow-samples), you can use these samples a starting point for your workflow.
122-
123120
## Next steps
124121

125-
- Review the [Azure Functions overview](functions-overview.md).
126-
- Review the [GitHub Actions page](https://github.com/features/actions).
122+
There are a number of samples available in the [Azure GitHub Actions workflow samples repo](https://github.com/Azure/actions-workflow-samples). You can use these samples a starting point for your workflow.
123+
124+
> [!div class="nextstepaction"]
125+
> [Learn more about GitHub Actions](https://help.github.com/en/articles/about-github-actions)
35 Bytes
Loading
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)