Skip to content

Commit 7094494

Browse files
committed
azuredeployment
1 parent 2a0b1c0 commit 7094494

File tree

1 file changed

+31
-48
lines changed

1 file changed

+31
-48
lines changed

.github/workflows/AzureDeployment.yml

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

5-
# Environment variables are defined in an "env" section.
6-
# We set the target environment to dev.
7-
# Open the deploy-advanced.yml file to see how we can accept user input
8-
# instead of needing to change this file to switch environments.
9-
env:
10-
targetEnv: dev
3+
on:
4+
workflow_dispatch
115

12-
# The overall workflow name will be Azure Bicep. This will show up in the
13-
# GitHub Action page.
14-
name: Azure Bicep
15-
jobs:
16-
# This script has one job: build and deploy the IaC resources
17-
build-and-deploy:
18-
# We run this on an Ubuntu-based GitHub hosted runner. This hosted runner
19-
# has certain software already installed, including az cli
20-
runs-on: ubuntu-latest
21-
steps:
22-
# Check out the code. This grabs code from the repository and
23-
# makes it available to the GitHub hosted runner. It will usually be the
24-
# first task for any workflow
25-
- uses: actions/checkout@main
6+
env:
7+
targetEnv: dev
268

27-
# Log into Azure using a federated credential. We have already set up the
28-
# federation process in a prior step, so we need to pass in the following:
29-
# Client ID = Application registration ID
30-
# Tenant ID = Application owner organization ID (previously called Tenant ID in Azure)
31-
# Subscription ID
32-
# https://github.com/azure/login
33-
- uses: azure/[email protected]
34-
with:
35-
client-id: $
36-
tenant-id: $
37-
subscription-id: $
38-
# We also need to ensure that enable-AzPSSession is true. This is important for
39-
# using OIDC in Azure. If we were to pass in a client secret instead, we would not need
40-
# this setting enabled
41-
enable-AzPSSession: true
9+
jobs:
10+
build-and-deploy:
11+
runs-on: ubuntu-latest
12+
permissions:
13+
contents: read
14+
pages: write
15+
id-token: write
16+
steps:
17+
# Checkout code
18+
- uses: actions/checkout@main
4219

43-
# Deploy ARM template
44-
- name: Run ARM deploy
45-
# https://github.com/azure/arm-deploy
46-
uses: azure/arm-deploy@v1
47-
with:
48-
subscriptionId: $
49-
resourceGroupName: $
50-
template: ./InfrastructureAsCode/main.bicep
51-
# Use the environment variable called targetEnv
52-
parameters: environment=$
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
27+
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)