azureazure-web-app-serviceweb-deploymentgithub-actionscontinuous-deployment

Unable to Deploy to Azure Container using GitHub Actions - Deployment Failed with Error: Error: Failed to get app runtime OS


1. Summarize the problem

I am trying to deploy code to an Azure App Service container from GitHub using GitHub actions. Using GitHub Actions I am able to successfully checkout my master branch, login to the azure container registry, build the container using docker, and push my docker image to the container. But I get the following error when Deploying to Azure Web app using azure/webapps-deploy@v2 and the publish profile for application authorization.

Run azure/webapps-deploy@v2
  with:
    app-name: dtpdashboardContainers
    slot-name: production
    publish-profile: ***
    images: dtpdashboardcontainerregistry.azurecr.io/client:29b2d0a483f35ffd4490d75443b309f3a28c8ad9
    package: .
Error: Deployment Failed with Error: Error: Failed to get app runtime OS
{} 

2. Describe what you've tried

Of note, I am able to manually deploy via the azure portal. I can go to the Azure Portal Deployment Center for the container, select the new image which was built and passed to the Azure Container Registry and deploy. This all works as expected but I am frustratingly unable to accomplish this via GitHub actions on push.

3. Show some code

The build succeeds, the deploy fails with the aforementioned error. I have been struggling with this for a while now so I would greatly appreciate your help! Thanks.

 Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy
# More GitHub Actions for Azure: https://github.com/Azure/actions

name: Build and deploy client container app to Azure 

on:
    push:
        branches:
            - master
    workflow_dispatch:

jobs:
  build:
    runs-on: 'ubuntu-18.04'

    steps:
    - uses: actions/checkout@v2

    - name: Login to Azure Container Registry
      uses: azure/docker-login@v1
      with:
        login-server: dtpdashboardcontainerregistry.azurecr.io
        username: ${{ secrets.AZUREAPPSERVICE_CONTAINERUSERNAME_1EBED267A6874BAE8C94362D3A133011 }}
        password: ${{ secrets.AZUREAPPSERVICE_CONTAINERPASSWORD_3E64C8001D134F0F87A64922FA0D562B }}

    - name: Build Container
      run: docker build -t dtpdashboardcontainerregistry.azurecr.io/client:${{ github.sha }} ./client

    - name: Push client image 
      run: docker push dtpdashboardcontainerregistry.azurecr.io/client:${{ github.sha }}

  deploy:
    runs-on: 'ubuntu-18.04'
    needs: build
    environment:
       name: 'production'
       url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}

    steps:
    - name: Deploy to Azure Web App
      id: deploy-to-webapp
      uses: azure/webapps-deploy@v2
      with:
        app-name: 'dtpdashboardContainers'
        slot-name: 'production'
        publish-profile: ${{ secrets.AzureAppService_PublishProfile_49fd57adb2104ab59b9a586e4a6e8049 }}
        images: 'dtpdashboardcontainerregistry.azurecr.io/client:${{ github.sha }}'

Solution

  • For me, this was resolved by removing Access Restrictions from app.scm.azurewebsites.net