Skip to content

Deploy specific image tag to Azure Web App (Container) #3

Deploy specific image tag to Azure Web App (Container)

Deploy specific image tag to Azure Web App (Container) #3

name: Deploy specific image tag to Azure Web App (Container)
on:
workflow_dispatch:
inputs:
image_tag:
description: "Container tag to deploy (e.g., v1.2.3)"
required: true
permissions:
id-token: write # needed for OIDC login [oai_citation:0‡GitHub](https://github.com/Azure/login)
contents: read
env:
RESOURCE_GROUP: students-new-lab-rg
WEBAPP_NAME: python-lidor
ACR_LOGIN_SERVER: index.docker.io
IMAGE_NAME: lidorlg/lidor-python-sce
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Azure login (OIDC)
uses: azure/login@v2
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} # [oai_citation:1‡GitHub](https://github.com/Azure/login)
# (Recommended) Ensure the Web App is configured to pull from your private registry
# If you already configured this in Azure Portal / IaC, you can remove this step.
- name: Point Web App to the requested image tag
run: |
az webapp config container set \
--resource-group "${{ env.RESOURCE_GROUP }}" \
--name "${{ env.WEBAPP_NAME }}" \
--container-image-name "${{ env.ACR_LOGIN_SERVER }}/${{ env.IMAGE_NAME }}:${{ inputs.image_tag }}" \
--container-registry-url "https://${{ env.ACR_LOGIN_SERVER }}" \
az webapp restart --resource-group "${{ env.RESOURCE_GROUP }}" --name "${{ env.WEBAPP_NAME }}"