Skip to content

Commit a6c7107

Browse files
authored
Merge pull request #36 from jordanbean-msft/main
AzDO & GitHub Actions pipelines
2 parents 7873846 + c38a452 commit a6c7107

14 files changed

+860
-171
lines changed

.azdo/pipelines/azure-dev.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# Run when commits are pushed to main
2+
trigger:
3+
- main
4+
5+
pool:
6+
vmImage: ubuntu-latest
7+
8+
steps:
9+
# setup-azd@0 needs to be manually installed in your organization
10+
# if you can't install it, you can use the below bash script to install azd
11+
# and remove this step
12+
- task: setup-azd@1
13+
displayName: Install azd
14+
15+
# If you can't install above task in your organization, you can comment it and uncomment below task to install azd
16+
# - task: Bash@3
17+
# displayName: Install azd
18+
# inputs:
19+
# targetType: 'inline'
20+
# script: |
21+
# curl -fsSL https://aka.ms/install-azd.sh | bash
22+
23+
# azd delegate auth to az to use service connection with AzureCLI@2
24+
- pwsh: |
25+
azd config set auth.useAzCliAuth "true"
26+
displayName: Configure AZD to Use AZ CLI Authentication.
27+
- task: AzureCLI@2
28+
displayName: Provision Infrastructure
29+
inputs:
30+
azureSubscription: DevOpsAzureRMConnection
31+
scriptType: bash
32+
scriptLocation: inlineScript
33+
keepAzSessionActive: true
34+
inlineScript: |
35+
azd provision --no-prompt
36+
env:
37+
AZURE_CLIENT_ID: $(AZURE_CLIENT_ID)
38+
AZURE_TENANT_ID: $(AZURE_TENANT_ID)
39+
AZURE_SUBSCRIPTION_ID: $(AZURE_SUBSCRIPTION_ID)
40+
AZURE_ENV_NAME: $(AZURE_ENV_NAME)
41+
AZURE_LOCATION: $(AZURE_LOCATION)
42+
GITHUB_ORGANIZATION_SLUGS: $(GH_ORGANIZATION_SLUGS)
43+
AZURE_RESOURCE_GROUP: $(AZURE_RESOURCE_GROUP)
44+
GITHUB_PAT: $(GH_PAT)
45+
AZURE_AUTHENTICATION_ENABLED: $(AZURE_AUTHENTICATION_ENABLED)
46+
AZURE_AUTHENTICATION_CLIENT_ID: $(AZURE_AUTHENTICATION_CLIENT_ID)
47+
AZURE_AUTHENTICATION_OPEN_ID_ISSUER: $(AZURE_AUTHENTICATION_OPEN_ID_ISSUER)
48+
49+
- task: AzureCLI@2
50+
displayName: Deploy Application
51+
inputs:
52+
azureSubscription: DevOpsAzureRMConnection
53+
scriptType: bash
54+
scriptLocation: inlineScript
55+
keepAzSessionActive: true
56+
inlineScript: |
57+
azd deploy --no-prompt
58+
env:
59+
AZURE_SUBSCRIPTION_ID: $(AZURE_SUBSCRIPTION_ID)
60+
AZURE_ENV_NAME: $(AZURE_ENV_NAME)
61+
AZURE_LOCATION: $(AZURE_LOCATION)

.github/workflows/azure-dev.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# Run when commits are pushed to ado-pipeline
2+
on:
3+
workflow_dispatch:
4+
push:
5+
# Run when commits are pushed to mainline branch (main or master)
6+
# Set this to the mainline branch you are using
7+
branches:
8+
- main
9+
10+
# Set up permissions for deploying with secretless Azure federated credentials
11+
# https://learn.microsoft.com/en-us/azure/developer/github/connect-from-azure?tabs=azure-portal%2Clinux#set-up-azure-login-with-openid-connect-authentication
12+
permissions:
13+
id-token: write
14+
contents: read
15+
16+
17+
jobs:
18+
build:
19+
runs-on: ubuntu-latest
20+
env:
21+
AZURE_CLIENT_ID: ${{ vars.AZURE_CLIENT_ID }}
22+
AZURE_TENANT_ID: ${{ vars.AZURE_TENANT_ID }}
23+
AZURE_SUBSCRIPTION_ID: ${{ vars.AZURE_SUBSCRIPTION_ID }}
24+
AZURE_ENV_NAME: ${{ vars.AZURE_ENV_NAME }}
25+
AZURE_LOCATION: ${{ vars.AZURE_LOCATION }}
26+
AZURE_USER_PRINCIPAL_ID: ${{ secrets.AZURE_USER_PRINCIPAL_ID }}
27+
GITHUB_ORGANIZATION_SLUGS: ${{ vars.GH_ORGANIZATION_SLUGS }}
28+
AZURE_RESOURCE_GROUP: ${{ vars.AZURE_RESOURCE_GROUP }}
29+
ASSIGN_PERMISSIONS_TO_PRINCIPAL: false
30+
AZURE_AUTHENTICATION_ENABLED: ${{ vars.AZURE_AUTHENTICATION_ENABLED }}
31+
AZURE_AUTHENTICATION_CLIENT_ID: ${{ secrets.AZURE_AUTHENTICATION_CLIENT_ID }}
32+
AZURE_AUTHENTICATION_OPEN_ID_ISSUER: ${{ vars.AZURE_AUTHENTICATION_OPEN_ID_ISSUER }}
33+
steps:
34+
- name: Checkout
35+
uses: actions/checkout@v4
36+
- name: Install azd
37+
uses: Azure/setup-azd@v2
38+
- name: Log in with Azure (Federated Credentials)
39+
run: |
40+
azd auth login `
41+
--client-id "$Env:AZURE_CLIENT_ID" `
42+
--federated-credential-provider "github" `
43+
--tenant-id "$Env:AZURE_TENANT_ID"
44+
shell: pwsh
45+
46+
- name: Azure CLI Login (OIDC)
47+
uses: azure/login@v2
48+
with:
49+
client-id: ${{ env.AZURE_CLIENT_ID }}
50+
tenant-id: ${{ env.AZURE_TENANT_ID }}
51+
subscription-id: ${{ env.AZURE_SUBSCRIPTION_ID }}
52+
53+
- name: Provision Infrastructure
54+
run: azd provision --no-prompt
55+
env:
56+
GITHUB_PAT: ${{ secrets.GH_PAT }}
57+
58+
- name: Deploy Application
59+
run: azd deploy --no-prompt
60+
env:
61+
GITHUB_PAT: ${{ secrets.GH_PAT }}
62+

0 commit comments

Comments
 (0)