Skip to content

Commit bd79bd4

Browse files
authored
Update deploy.yml
1 parent 6cb1bbf commit bd79bd4

File tree

1 file changed

+25
-41
lines changed

1 file changed

+25
-41
lines changed

.github/workflows/deploy.yml

Lines changed: 25 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,35 @@
1-
# We only want to run this script manually.
2-
on: workflow_dispatch
1+
name: Azure Bicep
2+
3+
on:
4+
workflow_dispatch
35

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.
86
env:
97
targetEnv: dev
108

11-
# The overall workflow name will be Azure Bicep. This will show up in the
12-
# GitHub Action page.
13-
name: Azure Bicep
149
jobs:
15-
# This script has one job: build and deploy the IaC resources
1610
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
1911
runs-on: ubuntu-latest
12+
permissions:
13+
contents: read
14+
pages: write
15+
id-token: write
2016
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
17+
# Checkout code
18+
- uses: actions/checkout@main
2519

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
20+
# Log into Azure
21+
- uses: azure/[email protected]
22+
with:
23+
client-id: ${{ secrets.AZURE_CLIENT_ID }}
24+
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
25+
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
26+
enable-AzPSSession: true
4127

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=$
28+
# Deploy ARM template
29+
- name: Run ARM deploy
30+
uses: azure/arm-deploy@v1
31+
with:
32+
subscriptionId: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
33+
resourceGroupName: ${{ secrets.AZURE_RG }}
34+
template: ./src/InfrastructureAsCode/main.bicep
35+
parameters: environment=${{ env.targetEnv }}

0 commit comments

Comments
 (0)