Lab Bicep Deployment #2
This file contains hidden or 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: Lab Bicep Deployment | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| labPath: | |
| description: 'Lab nr (Directory where the bicepfile for the lab is located)' | |
| required: true | |
| default: 'lab3' | |
| env: | |
| RESOURCE_GROUP: ${{ vars.RG_NAME }} | |
| LOCATION: ${{ vars.LOCATION }} # Default location for resources | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| id-token: write | |
| contents: read | |
| steps: | |
| # Step 1: Checkout repository | |
| - name: Checkout repository | |
| uses: actions/checkout@v2 | |
| # Step 2: Log in to Azure | |
| - name: Log in to Azure | |
| uses: azure/login@v1 | |
| with: | |
| client-id: ${{ secrets.AZURE_CLIENT_ID_INFRA }} | |
| tenant-id: ${{ secrets.AZURE_TENANT_ID }} | |
| subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} | |
| # Step 3: Deploy Bicep file for the selected lab | |
| - name: Deploy Bicep file for ${{ github.event.inputs.labPath }} | |
| uses: azure/arm-deploy@v1 # Switch to the official action (cleaner than 'run: az deployment...') | |
| with: | |
| scope: resourcegroup | |
| subscriptionId: ${{ secrets.AZURE_SUBSCRIPTION_ID }} | |
| resourceGroupName: ${{ env.RESOURCE_GROUP }} | |
| template: ./${{ github.event.inputs.labPath }}/lab.bicep | |
| failOnStdErr: false | |
| # Pass ALL required parameters dynamically | |
| parameters: > | |
| applicationImage=${{ vars.ACR_IMAGE }} | |
| acrServer=${{ vars.ACR_NAME }}.azurecr.io | |
| userAssignedIdentityId=/subscriptions/${{ secrets.AZURE_SUBSCRIPTION_ID }}/resourceGroups/${{ vars.RG_NAME }}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/${{ vars.APP_PULL_ID }} |