Skip to content

Commit 6cb1bbf

Browse files
committed
Add workflow YAML file for Azure Bicep deployment
1 parent 4d66356 commit 6cb1bbf

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed

.github/workflows/deploy.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# We only want to run this script manually.
2+
on: workflow_dispatch
3+
4+
# Environment variables are defined in an "env" section.
5+
# We set the target environment to dev.
6+
# Open the deploy-advanced.yml file to see how we can accept user input
7+
# instead of needing to change this file to switch environments.
8+
env:
9+
targetEnv: dev
10+
11+
# The overall workflow name will be Azure Bicep. This will show up in the
12+
# GitHub Action page.
13+
name: Azure Bicep
14+
jobs:
15+
# This script has one job: build and deploy the IaC resources
16+
build-and-deploy:
17+
# We run this on an Ubuntu-based GitHub hosted runner. This hosted runner
18+
# has certain software already installed, including az cli
19+
runs-on: ubuntu-latest
20+
steps:
21+
# Check out the code. This grabs code from the repository and
22+
# makes it available to the GitHub hosted runner. It will usually be the
23+
# first task for any workflow
24+
- uses: actions/checkout@main
25+
26+
# Log into Azure using a federated credential. We have already set up the
27+
# federation process in a prior step, so we need to pass in the following:
28+
# Client ID = Application registration ID
29+
# Tenant ID = Application owner organization ID (previously called Tenant ID in Azure)
30+
# Subscription ID
31+
# https://github.com/azure/login
32+
- uses: azure/[email protected]
33+
with:
34+
client-id: $
35+
tenant-id: $
36+
subscription-id: $
37+
# We also need to ensure that enable-AzPSSession is true. This is important for
38+
# using OIDC in Azure. If we were to pass in a client secret instead, we would not need
39+
# this setting enabled
40+
enable-AzPSSession: true
41+
42+
# Deploy ARM template
43+
- name: Run ARM deploy
44+
# https://github.com/azure/arm-deploy
45+
uses: azure/arm-deploy@v1
46+
with:
47+
subscriptionId: $
48+
resourceGroupName: $
49+
template: ./InfrastructureAsCode/main.bicep
50+
# Use the environment variable called targetEnv
51+
parameters: environment=$

0 commit comments

Comments
 (0)