You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/actions/guides/deploying-to-azure-app-service.md
+71-57Lines changed: 71 additions & 57 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,56 +11,69 @@ versions:
11
11
{% data reusables.actions.enterprise-github-hosted-runners %}
12
12
13
13
### Introduction
14
-
[Azure App Service](https://azure.microsoft.com/en-us/services/app-service/) is a Platform-as-a-Service (PaaS) offering from Microsoft, a “fully managed platform for building, deploying and scaling your web apps”. It is a great way to run web apps in several languages including JavaScript, which will be shown here.
15
14
16
-
This guide assumes you are in the directory of an existing [Node.js](https://nodejs.org/en/) project.
15
+
This guide explains how to use {% data variables.product.prodname_actions %} to build, test, and deploy an application to [Azure App Service](https://azure.microsoft.com/en-us/services/app-service/).
16
+
17
+
Azure App Service can run web apps in several languages, but this guide demonstrates deploying an existing Node.js project.
17
18
18
19
### Prerequisites
19
-
To adopt this workflow, you will first need to complete the following setup steps:
20
20
21
-
#### Create an App Service plan
22
-
For example, after [authenticating](https://docs.microsoft.com/en-us/cli/azure/authenticate-azure-cli) with `az`, the [Azure CLI](https://docs.microsoft.com/en-us/cli/azure/):
21
+
Before creating your {% data variables.product.prodname_actions %} workflow, you will first need to complete the following setup steps:
23
22
24
-
{% raw %}
25
-
```bash{:copy}
26
-
az appservice plan create \
27
-
--resource-group $AZ_RESOURCE_GROUP \
28
-
--name $AZ_APP_SERVICE_PLAN \
29
-
--is-linux
30
-
```
31
-
{% endraw %}
23
+
1. Create an Azure App Service plan.
32
24
33
-
where `$AZ_RESOURCE_GROUP` is a pre-existing Azure Resource Group and `$AZ_APP_SERVICE_PLAN` is a name of your choosing. If you need to set up a new Resource Group, follow [these instructions](https://docs.microsoft.com/en-us/cli/azure/group?view=azure-cli-latest#az_group_create).
25
+
For example, you can use the Azure CLI to create a new App Service plan:
34
26
35
-
#### Create a Web App
36
-
Create an [App Service Web App](https://azure.microsoft.com/en-us/services/app-service/web/) with a [node runtime](https://docs.microsoft.com/en-us/cli/azure/webapp?view=azure-cli-latest#az_webapp_list_runtimes), for example, using the Azure CLI:
27
+
```bash{:copy}
28
+
az appservice plan create \
29
+
--resource-group MY_RESOURCE_GROUP \
30
+
--name MY_APP_SERVICE_PLAN \
31
+
--is-linux
32
+
```
37
33
38
-
{% raw %}
39
-
```bash{:copy}
40
-
az webapp create \
41
-
--name $AZURE_WEBAPP_NAME \
42
-
--plan $AZ_APP_SERVICE_PLAN \
43
-
--resource-group $AZ_RESOURCE_GROUP \
44
-
--runtime "node|10.14"
45
-
```
46
-
{% endraw %}
34
+
In the command above, replace `MY_RESOURCE_GROUP` with your pre-existing Azure Resource Group, and `MY_APP_SERVICE_PLAN` with a new name for the App Service plan.
35
+
36
+
See the Azure documentation for more information on using the [Azure CLI](https://docs.microsoft.com/en-us/cli/azure/):
37
+
38
+
* For authentication, see "[Sign in with Azure CLI](https://docs.microsoft.com/en-us/cli/azure/authenticate-azure-cli)".
39
+
* If you need to create a new resource group, see "[az group](https://docs.microsoft.com/en-us/cli/azure/group?view=azure-cli-latest#az_group_create)."
47
40
48
-
where `$AZURE_WEBAPP_NAME` is a webapp name of your choosing.
41
+
2. Create a web app.
49
42
50
-
#### Configure publish profile and store as `AZURE_WEBAPP_PUBLISH_PROFILE` secret
51
-
Next, we will generate Azure deployment credentials via a publish profile using [these instructions](https://docs.microsoft.com/en-us/azure/app-service/deploy-github-actions?tabs=applevel#generate-deployment-credentials), adding them as a [GitHub repository secret](https://docs.github.com/en/free-pro-team@latest/actions/reference/encrypted-secrets) named `AZURE_WEBAPP_PUBLISH_PROFILE`.
43
+
For example, you can use the Azure CLI to create an Azure App Service web app with a node runtime:
52
44
53
-
### Workflow
54
-
Now that the prerequisite steps are done, consider the following workflow, which will build, test, and deploy the Node.js project to Azure App Service.
45
+
```bash{:copy}
46
+
az webapp create \
47
+
--name MY_WEBAPP_NAME \
48
+
--plan MY_APP_SERVICE_PLAN \
49
+
--resource-group MY_RESOURCE_GROUP \
50
+
--runtime "node|10.14"
51
+
```
52
+
53
+
In the command above, replace the parameters with your own values, where `MY_WEBAPP_NAME` is a new name for the web app.
54
+
55
+
3. Configure an Azure publish profile and create an `AZURE_WEBAPP_PUBLISH_PROFILE` secret.
56
+
57
+
Generate your Azure deployment credentials using a publish profile. For more information, see "[Generate deployment credentials](https://docs.microsoft.com/en-us/azure/app-service/deploy-github-actions?tabs=applevel#generate-deployment-credentials)" in the Azure documentation.
58
+
59
+
In your {% data variables.product.prodname_dotcom %} repository, create a secret named `AZURE_WEBAPP_PUBLISH_PROFILE` that contains the contents of the publish profile. For more information on creating secrets, see "[Encrypted secrets](/actions/reference/encrypted-secrets#creating-encrypted-secrets-for-a-repository)."
60
+
61
+
### Creating the workflow
62
+
63
+
Once you've completed the prerequisites, you can proceed with creating the workflow.
64
+
65
+
The following example workflow demonstrates how to build, test, and deploy the Node.js project to Azure App Service.
66
+
67
+
Ensure that you set `AZURE_WEBAPP_NAME` in the workflow `env` key to the name of the web app you created.
55
68
56
69
{% raw %}
57
-
```bash{:copy}
70
+
```yaml{:copy}
58
71
on:
59
72
release:
60
73
types: [created]
61
74
62
75
env:
63
-
AZURE_WEBAPP_NAME: your-app-name # set this to your application's name
76
+
AZURE_WEBAPP_NAME: MY_WEBAPP_NAME # set this to your application's name
64
77
AZURE_WEBAPP_PACKAGE_PATH: '.' # set this to the path to your web app project, defaults to the repository root
65
78
NODE_VERSION: '10.x' # set this to the node version to use
The following additional resources may also be of use:
98
110
99
-
1.[Azure App Service starter workflow](https://github.com/actions/starter-workflows/blob/master/ci/azure.yml) for the full starter workflow
100
-
1.[`Azure/webapps-deploy`](https://github.com/Azure/webapps-deploy), the Azure action used
101
-
1.[App Service quickstart -- Node.js](https://docs.microsoft.com/en-us/azure/app-service/quickstart-nodejs) for a quickstart using the [VSCode Azure App Service extension](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-azureappservice)
111
+
The following resources may also be useful:
112
+
113
+
* For the original starter workflow, see [`azure.yml`](https://github.com/actions/starter-workflows/blob/master/ci/azure.yml) in the {% data variables.product.prodname_actions %} `starter-workflows` repository.
114
+
* The action used to deploy the web app is the official Azure [`Azure/webapps-deploy`](https://github.com/Azure/webapps-deploy) action.
115
+
* The "[Create a Node.js web app in Azure](https://docs.microsoft.com/en-us/azure/app-service/quickstart-nodejs)" quickstart in the Azure web app documentation demonstrates using VS Code with the [Azure App Service extension](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-azureappservice).
0 commit comments