Bicep changes to APIM stv2 #92
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: 'AzureBicepDeploy' | |
on: | |
workflow_dispatch: | |
# push: | |
# branches: | |
# - workflow-new | |
pull_request: | |
branches: | |
- main | |
paths: | |
- '.github/workflows/es-apim.yml' | |
- 'reference-implementations/AppGW-IAPIM-Func/**' | |
- '!reference-implementations/AppGW-IAPIM-Func/terraform/**' | |
permissions: | |
id-token: write | |
jobs: | |
validate_bicep: | |
name: "Validate Bicep files" | |
runs-on: ubuntu-latest | |
environment: staging | |
steps: | |
- name: Checkout the code | |
uses: actions/checkout@v2 | |
- name: Validate that bicep builds | |
run: az bicep build -f main.bicep | |
working-directory: ./reference-implementations/AppGW-IAPIM-Func/bicep | |
build-and-deploy: | |
runs-on: ubuntu-latest | |
needs: validate_bicep | |
environment: production | |
steps: | |
# Checkout code | |
- name: Checkout the code | |
uses: actions/checkout@main | |
- name: Install yq to parse yaml file | |
run: | | |
sudo wget -O /usr/local/bin/yq https://github.com/mikefarah/yq/releases/download/v4.5.0/yq_linux_amd64 | |
sudo chmod +x /usr/local/bin/yq | |
- name: Parse config.yaml as output to GitHub Actions matrix | |
run: | | |
echo "config=$(yq e ./reference-implementations/AppGW-IAPIM-Func/bicep/config.yml -j -I=0)" >> $GITHUB_ENV | |
- name: Write deployment information to log | |
run: | | |
echo "Deploying to ${{ fromJson(env.config).AZURE_LOCATION }} with name prefix ${{ fromJson(env.config).RESOURCE_NAME_PREFIX }} and environment tag ${{ fromJson(env.config).ENVIRONMENT_TAG }}" | |
# Log into Azure via OIDC | |
- uses: azure/login@v1 | |
with: | |
client-id: ${{ secrets.AZURE_OIDC_CLIENT_ID }} | |
tenant-id: ${{ secrets.AZURE_TENANT_ID }} | |
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} | |
- name: Run Preflight Validation | |
working-directory: ./reference-implementations/AppGW-IAPIM-Func/bicep | |
run: | | |
az deployment sub validate \ | |
--location ${{ fromJson(env.config).AZURE_LOCATION }} \ | |
--parameters workloadName=${{ fromJson(env.config).RESOURCE_NAME_PREFIX }} environment=${{ fromJson(env.config).ENVIRONMENT_TAG }} \ | |
vmUsername=${{ fromJson(env.config).VM_USERNAME }} vmPassword=${{ secrets.VM_PW }} accountName=${{ secrets.ACCOUNT_NAME }} \ | |
personalAccessToken=${{ secrets.PAT }} CICDAgentType=${{ fromJson(env.config).CICD_AGENT_TYPE}} appGatewayFqdn=${{ secrets.FQDN }} \ | |
certificatePassword=${{ secrets.CERTPW}} appGatewayCertType=${{ fromJson(env.config).CERT_TYPE }} \ | |
--template-file main.bicep | |
# Deploy Bicep file, need to point parameters to the main.parameters.json location | |
- name: deploy | |
uses: azure/arm-deploy@v1 | |
with: | |
subscriptionId: ${{ secrets.AZURE_SUBSCRIPTION_ID }} | |
scope: subscription | |
region: ${{ fromJson(env.config).AZURE_LOCATION }} | |
template: ./reference-implementations/AppGW-IAPIM-Func/bicep/main.bicep | |
parameters: > | |
workloadName=${{ fromJson(env.config).RESOURCE_NAME_PREFIX }} environment=${{ fromJson(env.config).ENVIRONMENT_TAG }} | |
vmUsername=${{ fromJson(env.config).VM_USERNAME }} vmPassword=${{ secrets.VM_PW }} | |
accountName=${{ secrets.ACCOUNT_NAME }} personalAccessToken=${{ secrets.PAT }} CICDAgentType=${{ fromJson(env.config).CICD_AGENT_TYPE}} | |
appGatewayFqdn=${{ secrets.FQDN }} certificatePassword=${{ secrets.CERTPW }} appGatewayCertType=${{ fromJson(env.config).CERT_TYPE }} |