Deploy Bicep to Azure #50
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: Deploy Bicep to Azure | |
| on: | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - "infra/**" | |
| workflow_dispatch: | |
| permissions: | |
| id-token: write | |
| contents: read | |
| env: | |
| RESOURCE_GROUP: rg-quickscan | |
| LOCATION: westeurope | |
| WEBAPP_NAME: devopsquickscan | |
| DOMAIN_NAME: quickscan.duijzer.com | |
| jobs: | |
| deploy: | |
| environment: devops-quickscan-azure | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Azure login | |
| uses: azure/login@v2 | |
| with: | |
| client-id: ${{ secrets.AZURE_CLIENT_ID }} | |
| tenant-id: ${{ secrets.AZURE_TENANT_ID }} | |
| subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} | |
| - name: Create resource group if it doesn't exist | |
| run: | | |
| az group create --name $RESOURCE_GROUP --location $LOCATION | |
| - name: Deploy Bicep template | |
| run: | | |
| az deployment group create \ | |
| --resource-group $RESOURCE_GROUP \ | |
| --template-file infra/main.bicep \ | |
| --parameters webAppName=$WEBAPP_NAME dockerHubPassword=${{ secrets.DOCKERHUB_TOKEN }} dockerHubUsername=${{ secrets.DOCKERHUB_USERNAME }} customDomainName=$DOMAIN_NAME \ | |
| --query "{storageAccountName:properties.outputs.storageAccountName.value, storageAccountKey:properties.outputs.storageAccountKey.value}" \ | |
| --output json > outputs.json | |
| cat outputs.json |