Skip to content

Commit 59853ad

Browse files
committed
refresh the article
1 parent 43c918f commit 59853ad

File tree

1 file changed

+26
-16
lines changed

1 file changed

+26
-16
lines changed

articles/azure-resource-manager/bicep/deploy-github-actions.md

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
---
22
title: Deploy Bicep files by using GitHub Actions
33
description: In this quickstart, you learn how to deploy Bicep files by using GitHub Actions.
4-
author: mumian
5-
ms.author: jgao
64
ms.topic: conceptual
7-
ms.date: 08/22/2022
5+
ms.date: 01/19/2024
86
ms.custom: github-actions-azure, devx-track-bicep
97
---
108

@@ -26,20 +24,30 @@ It provides a short introduction to GitHub actions and Bicep files. If you want
2624

2725
Create a resource group. Later in this quickstart, you'll deploy your Bicep file to this resource group.
2826

27+
# [CLI](#tab/CLI)
28+
2929
```azurecli-interactive
3030
az group create -n exampleRG -l westus
3131
```
3232

33+
# [PowerShell](#tab/PowerShell)
34+
35+
```azurepowershell-interactive
36+
New-AzResourceGroup -Name exampleRG -Location westus
37+
```
38+
39+
---
40+
3341
## Generate deployment credentials
3442

3543
# [Service principal](#tab/userlevel)
3644

3745
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.
3846

39-
Replace the placeholder `myApp` with the name of your application. Replace `{subscription-id}` with your subscription ID.
47+
Replace the placeholder `{app-name}` with the name of your application. Replace `{subscription-id}` with your subscription ID.
4048

4149
```azurecli-interactive
42-
az ad sp create-for-rbac --name myApp --role contributor --scopes /subscriptions/{subscription-id}/resourceGroups/exampleRG --sdk-auth
50+
az ad sp create-for-rbac --name {app-name} --role contributor --scopes /subscriptions/{subscription-id}/resourceGroups/exampleRG --json-auth
4351
```
4452

4553
> [!IMPORTANT]
@@ -56,6 +64,10 @@ The output is a JSON object with the role assignment credentials that provide ac
5664
(...)
5765
}
5866
```
67+
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."
70+
5971
# [Open ID Connect](#tab/openid)
6072

6173

@@ -164,23 +176,22 @@ To create a workflow, take the following steps:
164176
# [Service principal](#tab/userlevel)
165177
166178
```yml
179+
name: Deploy Bicep file
167180
on: [push]
168-
name: Azure ARM
169181
jobs:
170182
build-and-deploy:
171183
runs-on: ubuntu-latest
172184
steps:
173185
174-
# Checkout code
175-
- uses: actions/checkout@main
186+
- name: Checkout code
187+
uses: actions/checkout@main
176188
177-
# Log into Azure
178-
- uses: azure/login@v1
189+
- name: Log into Azure
190+
uses: azure/login@v1
179191
with:
180192
creds: ${{ secrets.AZURE_CREDENTIALS }}
181193
182-
# Deploy Bicep file
183-
- name: deploy
194+
- name: Deploy Bicep file
184195
uses: azure/arm-deploy@v1
185196
with:
186197
subscriptionId: ${{ secrets.AZURE_SUBSCRIPTION }}
@@ -238,17 +249,16 @@ To create a workflow, take the following steps:
238249
239250
240251
241-
1. Select **Start commit**.
252+
1. Select **Commit changes**.
242253
1. Select **Commit directly to the main branch**.
243254
1. Select **Commit new file** (or **Commit changes**).
244255
245256
Updating either the workflow file or Bicep file triggers the workflow. The workflow starts right after you commit the changes.
246257
247258
## Check workflow status
248259
249-
1. Select the **Actions** tab. You'll see a **Create deployStorageAccount.yml** workflow listed. It takes 1-2 minutes to run the workflow.
250-
1. Select the workflow to open it.
251-
1. Select **Run ARM deploy** from the menu to verify the deployment.
260+
1. Select the **Actions** tab. You'll see a **Create deployBicepFile.yml** workflow listed. It takes 1-2 minutes to run the workflow.
261+
1. Select the workflow to open it, and verify the `Status` is `Success`.
252262
253263
## Clean up resources
254264

0 commit comments

Comments
 (0)