Skip to content

Deploy ContosoAds to Azure Container Apps #1

Deploy ContosoAds to Azure Container Apps

Deploy ContosoAds to Azure Container Apps #1

Workflow file for this run

name: Deploy ContosoAds to Azure Container Apps
concurrency: contosoads-deploy-${{ github.ref }}
on:
workflow_dispatch:
push:
branches:
- deploy
paths:
- 'components/**'
- 'deploy/**'
- 'infra/**'
- 'src/**'
- '.github/workflows/**'
# GitHub Actions workflow to deploy to Azure using azd
# To configure required secrets for connecting to Azure, simply run `azd pipeline config`
# Set up permissions for deploying with secretless Azure federated credentials
# https://learn.microsoft.com/en-us/azure/developer/github/connect-from-azure?tabs=azure-portal%2Clinux#set-up-azure-login-with-openid-connect-authentication
permissions:
# id-token: write
contents: read
jobs:
deploy:
runs-on: ubuntu-latest
env:
AZURE_TENANT_ID: ${{ vars.AZURE_TENANT_ID }}
AZURE_SUBSCRIPTION_ID: ${{ vars.AZURE_SUBSCRIPTION_ID }}
AZURE_CREDENTIALS: ${{ secrets.AZURE_CREDENTIALS }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install azd
uses: Azure/setup-azd@v0.1.0
- name: Log in with Azure
run: |
$info = $Env:AZURE_CREDENTIALS | ConvertFrom-Json -AsHashtable;
Write-Host "::add-mask::$($info.clientSecret)"
azd auth login `
--client-id "$($info.clientId)" `
--client-secret "$($info.clientSecret)" `
--tenant-id "$($info.tenantId)"
shell: pwsh
env:
AZURE_CREDENTIALS: ${{ secrets.AZURE_CREDENTIALS }}
- name: Provision Infrastructure
run: azd provision --no-prompt
env:
AZURE_ENV_NAME: ${{ vars.AZURE_ENV_NAME }}
AZURE_LOCATION: ${{ vars.AZURE_LOCATION }}
AZURE_SUBSCRIPTION_ID: ${{ vars.AZURE_SUBSCRIPTION_ID }}
POSTGRES_LOGIN: ${{ secrets.POSTGRES_LOGIN }}
POSTGRES_LOGIN_PASSWORD: ${{ secrets.POSTGRES_LOGIN_PASSWORD }}
- name: Deploy Application
run: azd deploy --no-prompt
env:
AZURE_ENV_NAME: ${{ vars.AZURE_ENV_NAME }}
AZURE_LOCATION: ${{ vars.AZURE_LOCATION }}
AZURE_SUBSCRIPTION_ID: ${{ vars.AZURE_SUBSCRIPTION_ID }}