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
# Quickstart: Deploy Bicep files by using GitHub Actions
10
10
11
-
[GitHub Actions](https://docs.github.com/en/actions) is a suite of features in GitHub to automate your software development workflows.
12
-
13
-
In this quickstart, you use the [GitHub Actions for Azure Resource Manager deployment](https://github.com/marketplace/actions/deploy-azure-resource-manager-arm-template) to automate deploying a Bicep file to Azure.
11
+
[GitHub Actions](https://docs.github.com/en/actions) is a suite of features in GitHub to automate your software development workflows. In this quickstart, you use the [GitHub Actions for Azure Resource Manager deployment](https://github.com/marketplace/actions/deploy-azure-resource-manager-arm-template) to automate deploying a Bicep file to Azure.
14
12
15
13
It provides a short introduction to GitHub actions and Bicep files. If you want more detailed steps on setting up the GitHub actions and project, see [Deploy Azure resources by using Bicep and GitHub Actions](/training/paths/bicep-github-actions).
Your GitHub Actions run under an identity. Use the [az ad sp create-for-rbac](/cli/azure/ad/sp#az-ad-sp-create-for-rbac) command to create a [service principal](../../active-directory/develop/app-objects-and-service-principals.md#service-principal-object) for the identity.
46
-
47
-
Replace the placeholder `{app-name}` with the name of your application. Replace `{subscription-id}` with your subscription ID.
43
+
Your GitHub Actions run under an identity. Use the [az ad sp create-for-rbac](/cli/azure/ad/sp#az-ad-sp-create-for-rbac) command to create a [service principal](../../active-directory/develop/app-objects-and-service-principals.md#service-principal-object) for the identity. Grant the service principal the contributor role for the resource group created in the previous session so that the GitHub action with the identity can create resources in this resource group. It is recommended that you grant minimum required access.
48
44
49
45
```azurecli-interactive
50
46
az ad sp create-for-rbac --name {app-name} --role contributor --scopes /subscriptions/{subscription-id}/resourceGroups/exampleRG --json-auth
51
47
```
52
48
53
-
> [!IMPORTANT]
54
-
> The scope in the previous example is limited to the resource group. We recommend that you grant minimum required access.
49
+
Replace the placeholder `{app-name}` with the name of your application. Replace `{subscription-id}` with your subscription ID.
55
50
56
-
The output is a JSON object with the role assignment credentials that provide access to your App Service app similar to below. Copy this JSON object for later. You'll only need the sections with the `clientId`, `clientSecret`, `subscriptionId`, and `tenantId` values.
51
+
The output is a JSON object with the role assignment credentials that provide access to your App Service app similar to below.
57
52
58
53
```output
59
54
{
60
55
"clientId": "<GUID>",
61
56
"clientSecret": "<GUID>",
62
57
"subscriptionId": "<GUID>",
63
58
"tenantId": "<GUID>",
64
-
(...)
59
+
...
65
60
}
66
61
```
67
62
68
-
> [!NOTE]
69
-
> Remove the comma at the end of the last line, or else it will result in an invalid JSON file. You will get an error during the deployment saying "Login failed with Error: Content is not a valid JSON object. Double check if the 'auth-type' is correct."
63
+
Copy this JSON object for later. You'll only need the sections with the `clientId`, `clientSecret`, `subscriptionId`, and `tenantId` values. Make sure you don't have an extra comma at the end of the last line, for example, the `tenantId` line in the preceding example, or else it will result in an invalid JSON file. You will get an error during the deployment saying "Login failed with Error: Content is not a valid JSON object. Double check if the 'auth-type' is correct."
70
64
71
65
# [Open ID Connect](#tab/openid)
72
66
73
-
74
67
Open ID Connect is an authentication method that uses short-lived tokens. Setting up [OpenID Connect with GitHub Actions](https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/about-security-hardening-with-openid-connect) is more complex process that offers hardened security.
75
68
76
69
1. If you do not have an existing application, register a [new Active Directory application and service principal that can access resources](../../active-directory/develop/howto-create-service-principal-portal.md). Create the Active Directory application.
@@ -119,7 +112,7 @@ Open ID Connect is an authentication method that uses short-lived tokens. Settin
119
112
120
113
# [Service principal](#tab/userlevel)
121
114
122
-
Create secrets for your Azure credentials, resource group, and subscriptions.
115
+
Create secrets for your Azure credentials, resource group, and subscriptions. You will use these secrets in the [Create workflow](#create-workflow) section.
123
116
124
117
1. In [GitHub](https://github.com/), navigate to your repository.
0 commit comments