Giter VIP home page Giter VIP logo

webapps-deploy's Introduction

GitHub Action for deploying to Azure Web App

With the Azure App Service Actions for GitHub, you can automate your workflow to deploy Azure Web Apps or Azure Web Apps for Containers using GitHub Actions.

Get started today with a free Azure account.

This repository contains GitHub Action for Azure WebApp to deploy to an Azure WebApp (Windows or Linux). The action supports deploying a folder, *.jar, *.war, and *.zip files (except msBuild generated packages).

You can also use this GitHub Action to deploy your customized image into an Azure WebApps container.

For deploying container images to Kubernetes, consider using Kubernetes deploy action. This action requires that the cluster context be set earlier in the workflow by using either the Azure/aks-set-context action or the Azure/k8s-set-context action.

The definition of this GitHub Action is in action.yml. startup-command is applicable only for Linux apps and not for Windows apps. Currently startup-command is supported only for Linux apps when SPN is provided and not when publish profile is provided.

NOTE: you must have write permissions to the repository in question. If you're using a sample repository from Microsoft, be sure to first fork the repository to your own GitHub account.

End-to-End Sample Workflows

Dependencies on other GitHub Actions

Note: As of October 2020, Linux web apps will need the app setting WEBSITE_WEBDEPLOY_USE_SCM set to true before downloading the publish profile from the portal. This requirement will be removed in the future.

The action does not support multi-container scenario with publish profile.
  • Enable Run from Package, otherwise remote build will take time and the deployment will take longer.

  • To build app code in a specific language based environment, use setup actions:

    • Setup DotNet Sets up a dotnet environment by optionally downloading and caching a version of dotnet by SDK version and adding to PATH.
    • Setup Node sets up a node environment by optionally downloading and caching a version of node - npm by version spec and add to PATH
    • Setup Python sets up Python environment by optionally installing a version of python and adding to PATH.
    • Setup Java sets up Java app environment optionally downloading and caching a version of java by version and adding to PATH. Downloads from Azul's Zulu distribution.
  • To build and deploy a containerized app, use docker-login to log in to a private container registry such as Azure Container registry.

Once login is done, the next set of Actions in the workflow can perform tasks such as building, tagging and pushing containers.

Create Azure Web App and deploy using GitHub Actions

Note: Workflow samples with sample application code and deployment procedure for various runtime environments are given at https://github.com/Azure/actions-workflow-samples/tree/master/AppService.

For example, if You want to deploy a Java WAR based app, You can follow the link https://github.com/Azure-Samples/Java-application-petstore-ee7 in the sample workflow templates.

  1. Review the pre-requisites outlined in the "Dependencies on Other Github Actions" section above.
  2. Create a web app in Azure using app service. Follow the tutorial Azure Web Apps Quickstart.
  3. Pick a template from the following table depends on your Azure web app runtime and place the template to .github/workflows/ in your project repository.
  4. Change app-name to your Web app name created in the first step.
  5. Commit and push your project to GitHub repository, you should see a new GitHub Action initiated in Actions tab.
Runtime Template
DotNet dotnet.yml
Node node.yml
Java java_jar.yml
Java java_war.yml
Python python.yml
PHP php.yml
DOCKER docker.yml
GO go.yml

Sample workflow to build and deploy a Node.js Web app to Azure using publish profile

# File: .github/workflows/workflow.yml

on: push

jobs:
  build-and-deploy:
    runs-on: ubuntu-latest
    steps:
    # checkout the repo
    - name: 'Checkout Github Action' 
      uses: actions/checkout@master

    - name: Setup Node 10.x
      uses: actions/setup-node@v1
      with:
        node-version: '10.x'
    - name: 'npm install, build, and test'
      run: |
        npm install
        npm run build --if-present
        npm run test --if-present

    - name: 'Run Azure webapp deploy action using publish profile credentials'
      uses: azure/webapps-deploy@v2
      with:
        app-name: node-rn
        publish-profile: ${{ secrets.azureWebAppPublishProfile }}

Sample workflow to build and deploy a Node.js app to Containerized WebApp using publish profile

on: [push]

name: Linux_Container_Node_Workflow

jobs:
  build-and-deploy:
    runs-on: ubuntu-latest
    steps:
    # checkout the repo
    - name: 'Checkout Github Action'
      uses: actions/checkout@master

    - uses: azure/docker-login@v1
      with:
        login-server: contoso.azurecr.io
        username: ${{ secrets.REGISTRY_USERNAME }}
        password: ${{ secrets.REGISTRY_PASSWORD }}

    - run: |
        docker build . -t contoso.azurecr.io/nodejssampleapp:${{ github.sha }}
        docker push contoso.azurecr.io/nodejssampleapp:${{ github.sha }} 

    - uses: azure/webapps-deploy@v2
      with:
        app-name: 'node-rnc'
        publish-profile: ${{ secrets.azureWebAppPublishProfile }}
        images: 'contoso.azurecr.io/nodejssampleapp:${{ github.sha }}'

Webapps deploy Actions is supported for the Azure public cloud as well as Azure government clouds ('AzureUSGovernment' or 'AzureChinaCloud') and Azure Stack ('AzureStack') Hub. Before running this action, login to the respective Azure Cloud using Azure Login by setting appropriate value for the environment parameter.

Configure deployment credentials:

For any credentials like Azure Service Principal, Publish Profile etc add them as secrets in the GitHub repository and then use them in the workflow.

The above example uses app-level credentials i.e., publish profile file for deployment.

Follow the steps to configure the secret:

  • Note: As of October 2020, Linux web apps will need the app setting WEBSITE_WEBDEPLOY_USE_SCM set to true before continuing with next step of downloading the publish profile. This requirement will be removed in the future.
  • Download the publish profile for the WebApp from the portal (Get Publish profile option)
  • While deploying to slot, download the publish profile for slot. Also specify the slot-name field with the name of the slot.
  • Define a new secret under your repository settings, Add secret menu
  • Paste the contents for the downloaded publish profile file into the secret's value field
  • Now in the workflow file in your branch: .github/workflows/workflow.yml replace the secret for the input publish-profile: of the deploy Azure WebApp action (Refer to the example above)

Sample workflow to build and deploy a Node.js app to Containerized WebApp using Azure service principal

Use Azure Login with a service principal that's authorized for Web app deployment. Once login is done, the next set of Azure actions in the workflow can re-use the same session within the job.

on: [push]

name: Linux_Container_Node_Workflow

jobs:
  build-and-deploy:
    runs-on: ubuntu-latest
    steps:
    # checkout the repo
    - name: 'Checkout Github Action'
      uses: actions/checkout@master

    - name: 'Login via Azure CLI'
      uses: azure/login@v1
      with:
        creds: ${{ secrets.AZURE_CREDENTIALS }}

    - uses: azure/docker-login@v1
      with:
        login-server: contoso.azurecr.io
        username: ${{ secrets.REGISTRY_USERNAME }}
        password: ${{ secrets.REGISTRY_PASSWORD }}

    - run: |
        docker build . -t contoso.azurecr.io/nodejssampleapp:${{ github.sha }}
        docker push contoso.azurecr.io/nodejssampleapp:${{ github.sha }} 

    - uses: azure/webapps-deploy@v2
      with:
        app-name: 'node-rnc'
        images: 'contoso.azurecr.io/nodejssampleapp:${{ github.sha }}'

Configure deployment credentials:

The previous sample workflow depends on user-level credentials stored as a secret named AZURE_CREDENTIALS in your repository. The value of this secret is expected to be a JSON object that represents a service principal (an identifer for an application or process) that authenticates the workflow with Azure.

To function correctly, this service principal must be assigned the Contributor role for the web app or the resource group that contains the web app.

The following steps describe how to create the service principal, assign the role, and create a secret in your repository with the resulting credentials.

  1. Open the Azure Cloud Shell at https://shell.azure.com. You can alternately use the Azure CLI if you've installed it locally. (For more information on Cloud Shell, see the Cloud Shell Overview.)

  2. Use the az ad sp create-for-rbac command to create a service principal and assign a Contributor role:

    az ad sp create-for-rbac --name "{sp-name}" --sdk-auth --role contributor \
        --scopes /subscriptions/{subscription-id}/resourceGroups/{resource-group}/providers/Microsoft.Web/sites/{app-name}
    

    Replace the following:

    • {sp-name} with a suitable name for your service principal, such as the name of the app itself. The name must be unique within your organization.
    • {subscription-id} with the subscription you want to use
    • {resource-group} the resource group containing the web app.
    • {app-name} with the name of the web app.

    This command invokes Azure Active Directory (via the ad part of the command) to create a service principal (via sp) specifically for Role-Based Access Control (RBAC) (via create-for-rbac).

    The --role argument specifies the permissions to grant to the service principal at the specified --scope. In this case, you grant the built-in Contributor role at the scope of the web app in the specified resource group in the specified subscription.

    If desired, you can omit the part of the scope starting with /providers/... to grant the service principal the Contributor role for the entire resource group:

    az ad sp create-for-rbac --name "{sp-name}" --sdk-auth --role contributor \
        --scopes /subscriptions/{subscription-id}/resourceGroups/{resource-group}
    

    For security purposes, however, it's always preferable to grant permissions at the most restrictive scope possible.

  3. When complete, the az ad sp create-for-rbac command displays JSON output in the following form (which is specified by the --sdk-auth argument):

    {
      "clientId": "<GUID>",
      "clientSecret": "<GUID>",
      "subscriptionId": "<GUID>",
      "tenantId": "<GUID>",
      (...)
    }
  4. In your repository, use Add secret to create a new secret named AZURE_CREDENTIALS (as shown in the example workflow), or using whatever name is in your workflow file.

  5. Paste the entire JSON object produced by the az ad sp create-for-rbac command as the secret value and save the secret.

NOTE: to manage service principals created with az ad sp create-for-rbac, visit the Azure portal, navigate to your Azure Active Directory, then select Manage > App registrations on the left-hand menu. Your service principal should appear in the list. Select a principal to navigate to its properties. You can also manage role assignments using the az role assignment command.

Configure web app private registry credentials

This sample assumes the node-rnc web application has been previously configured to authenticate against the private registry. If you wish to set private registry authentication settings on the workflow, you can either use:

    - name: Set Web App ACR authentication
      uses: Azure/appservice-settings@v1
      with:
       app-name: 'node-rnc'
       app-settings-json: |
         [
             {
                 "name": "DOCKER_REGISTRY_SERVER_PASSWORD",
                 "value": "${{ secrets.REGISTRY_PASSWORD }}",
                 "slotSetting": false
             },
             {
                 "name": "DOCKER_REGISTRY_SERVER_URL",
                 "value": "https://contoso.azurecr.io",
                 "slotSetting": false
             },
             {
                 "name": "DOCKER_REGISTRY_SERVER_USERNAME",
                 "value": "${{ secrets.REGISTRY_USERNAME  }}",
                 "slotSetting": false
             }
         ]

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.

When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

webapps-deploy's People

Contributors

20shivangi avatar aksm-ms avatar amrutakawade avatar arjgupta avatar asranja avatar balaga-gayatri avatar chetan-vaidya3d avatar chunye avatar dannysongg avatar dependabot[bot] avatar eaarora-ms avatar erik-itland avatar harshitha1112 avatar kaverma avatar kumaraksh1 avatar methuselah96 avatar n-usha avatar orta avatar raahmed avatar roopeshnair avatar sgollapudi77 avatar shilpirachna1 avatar shpraka avatar shubham805 avatar suaggar avatar surenderssm avatar tevoinea avatar thibaudcolas avatar vivekjilla avatar zainuvk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

webapps-deploy's Issues

It isn't possible to deploy to a virtual application

Azure Pipelines App Service Deploy tasks have the "VirtualApplication" input to allow deployment to a virtual application within the main App Service. There is no equivalent in this Action. Is this by design?

Error when deploying to Linux App Service

Reproduction steps:

  1. Create a Linux App Service:
    https://github.com/Azure/azure-quickstart-templates/tree/master/101-app-service-docs-linux

  2. Attempt to deploy via azure/webapps-deploy@v2:
    Error: Deployment Failed with Error: Error: Action does not support app service with kind linux.

The Linux App Service above is defined with a kind value of 'linux', per:
https://github.com/Azure/azure-quickstart-templates/blob/master/101-app-service-docs-linux/azuredeploy.json#L54

Currently, only a kind value of 'app,linux' is supported in actionparameters.ts

Mapping volumes

How does one go about mapping volumes? I want to map to a an Azure File Storage. Basically, what I'm looking is being able to do something like this (if it was a docker-compose.yml file):

services:
    ...
    ...
    volumes:
      - data:/var/www/html

Where data is the name of my Azure Storage mount name. Thank you!

There is not enough space on the disk.\r\n

Deploying fairly small (3x components) angular app to Azure App Service. Web App built and deployment attempted but resulted in There is not enough space on the disk.\r\n.

Package deployment using ZIP Deploy initiated.
Fetching changes.
Cleaning up temp folders from previous zip deployments and extracting pushed zip file C:\local\Temp\zipdeploy\ad1141rx.zip (152.54 MB) to C:\local\Temp\zipdeploy\extracted
There is not enough space on the disk.\r\n
Error: Failed to deploy web package to App Service.
Error: Deployment Failed with Error: Package deployment using ZIP Deploy failed. Refer logs for more details.

Authentication problem with ACR when trying to deploy

My use-case is: I am building and storing Docker images in ACR. I need to deploy that in my AppService. I am using GithubActions for the CD. Below is part of my workflow:

     - name: Login to Azure Dev Environment
        uses: azure/login@v1
        with:
          creds: ${{ secrets.AZURE_CREDENTIALS }}
      - name: Set Web App ACR authentication
        uses: azure/appservice-settings@v1
        with:
          app-name: 'myapp'
          app-settings-json: |
            [
                {
                    "name": "DOCKER_REGISTRY_SERVER_PASSWORD",
                    "value": "${{ secrets.DOCKER_REGISTRY_PASSWORD }}",
                    "slotSetting": false
                },
                {
                    "name": "DOCKER_REGISTRY_SERVER_URL",
                    "value": "https://myacr.azurecr.io",
                    "slotSetting": false
                },
                {
                    "name": "DOCKER_REGISTRY_SERVER_USERNAME",
                    "value": "${{ secrets.DOCKER_REGISTRY_USERNAME }}",
                    "slotSetting": false
                }
            ]
      - name: Deploy to Azure Dev App Service
        uses: azure/webapps-deploy@v2
        with:
          app-name: 'myapp'
          images: 'myacr.azurecr.io/mysvc:sha-${{ env.GITHUB_SHA_SHORT }}'

Getting the following error in the deploy step:

Run azure/webapps-deploy@v2
Updating App Service Configuration settings. Data: ***"linuxFxVersion":"DOCKER|mysvc:sha-2b106095"***
Updated App Service Configuration settings.
Restarting app service: myapp
Restarted app service: myapp
Warning: Error: Failed to update deployment history.
Ip Forbidden (CODE: 403)
App Service Application URL: http://myapp.azurewebsites.net

Below are the logs I am seeing in my AppService:

2021-01-12T07:10:52.811Z ERROR - Pulling docker image mysvc:sha-2b106095 failed:
2021-01-12T07:10:52.811Z INFO  - Pulling image from Docker hub: library/mysvc:sha-2b106095
2021-01-12T07:10:53.069Z ERROR - DockerApiException: Docker API responded with status code=NotFound, response={"message":"pull access denied for mysvc, repository does not exist or may require 'docker login': denied: requested access to the resource is denied"}

2021-01-12T07:10:53.077Z ERROR - Image pull failed: Verify docker image configuration and credentials (if using private repository)

I think the problem is it is not recognizing the registry as ACR and trying to pull from Docker Hub.
Am I missing any configuration here?

Container deployment to app service deployment slot not working

I have an app service frosted-web with a deployment slot staging.

image

I use the following azure/webapps-deploy@v2 action to try to push a new image to the staging slot on the frosted-web app service.

        - name: Update image tag on the staging Azure Web App
          uses: azure/webapps-deploy@v2
          with:
            app-name: 'frosted-web'
            slot-name: 'staging'
            images: '${{ secrets.REGISTRY_LOGIN_SERVER }}/frosted-web:${{ github.sha }}'

However I get the following error:
image

I can't seem to find any docs on how to use slot-name, but I would've expected this to just work. Deploying to the production slot works just fine. Am I missing something here?

Application deployment to staging slot

I'm sorry if this is not the right place to report this issue, feel free to direct me elsewhere.

I'm currently working on a test application to evaluate the capabilities of GH Actions and the Azure AppService. I've been using the default node.js example and built upon that. Deploying the the production slot of my App Service worked without any issues. However, my issue is the deployment to other deployment slots such as staging.

Currently, there is no mention of the "slot-name" property in the documentation other than #25. Since official documentation is lacking I referred to the issue when formatting my configuration which now looks like this

# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions

name: Deployment Pipeline

on:
  pull_request:
    branches: [ master ]
  push:
    branches: [ master ]

jobs:
  build-and-deploy:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        node-version: [12.x]

    steps:
    - name: 'Checkut Code'
      uses: actions/checkout@v2
    - name: Install Node.js ${{ matrix.node-version }}
      uses: actions/setup-node@v1
      with:
        node-version: ${{ matrix.node-version }}
    - run: npm ci
    - run: npm run build --if-present
    #- run: npm test
    - name: 'Deploy to Azure App Service'
      uses: azure/webapps-deploy@v2
      with:
        app-name: 'my-app'
        publish-profile: ${{ secrets.AZURE_PUBLISHING_PROFILE }}
        slot-name: 'staging'

I generated the publishing profile using the "Generate publish profile" on the panel, but using the azure cli with the --xml flag produces the same output. I also manually created the deployment slot using the panel.

Executing the workflow with the configuration shown above results in the following error:

##[error]Deployment Failed with Error: Error: Publish profile is invalid for app-name and slot-name provided. Provide correct publish profile credentials for app.

wich appears to be caused by failing the validation here

export function validateAppDetails() {
let actionParams: ActionParameters = ActionParameters.getActionParams();
if(!!actionParams.appName || (!!actionParams.slotName && actionParams.slotName !== 'production')) {
let creds: ScmCredentials = PublishProfile.getPublishProfile(actionParams.publishProfileContent).creds;
let splitUsername: string[] = creds.username.toUpperCase().substring(1).split("__");
let appNameMatch: boolean = !actionParams.appName || actionParams.appName.toUpperCase() === splitUsername[0];
let slotNameMatch: boolean = actionParams.slotName === 'production' || actionParams.slotName.toUpperCase() === splitUsername[1];
if(!appNameMatch || !slotNameMatch) {
throw new Error("Publish profile is invalid for app-name and slot-name provided. Provide correct publish profile credentials for app.");
}
}
}

I followed this document for general setup of my workflow.

Were there any breaking changes that resulted in the documentation being outdated?

##***error***Deployment Failed with Error: Error: Action does not support app service with kind app,migration.

I created a new App Service using the Azure App Service Migration assistant. The migration assistant creates app services with the "kind" attribute set to "app,migration" as opposed to "app."

This causes the action to fail with the error in the title:

##errorDeployment Failed with Error: Error: Action does not support app service with kind app,migration.

This may be related to issue #83

Error: Cannot find module 'azure-actions-webclient/webClient

Hello!
Not sure if this is a place to report this, as there seems to be no activity in the issues tab here.
But I'll try, and if no reply, try somewhere else.

We have been getting this error lately:
It is causing our builds to fire an error, but it's working anyways.

Error: Cannot find module 'azure-actions-webclient/webClient'
Require stack:
- /home/runner/work/_actions/azure/webapps-container-deploy/v1/node_modules/azure-actions-appservice-rest/Kudu/KuduServiceClient.js
- /home/runner/work/_actions/azure/webapps-container-deploy/v1/node_modules/azure-actions-appservice-rest/Kudu/azure-app-kudu-service.js
- /home/runner/work/_actions/azure/webapps-container-deploy/v1/node_modules/azure-actions-appservice-rest/Utilities/AzureAppServiceUtility.js
- /home/runner/work/_actions/azure/webapps-container-deploy/v1/lib/main.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:797:15)
    at Function.Module._load (internal/modules/cjs/loader.js:690:27)
    at Module.require (internal/modules/cjs/loader.js:852:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (/home/runner/work/_actions/azure/webapps-container-deploy/v1/node_modules/azure-actions-appservice-rest/Kudu/KuduServiceClient.js:13:21)
    at Module._compile (internal/modules/cjs/loader.js:959:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:995:10)
    at Module.load (internal/modules/cjs/loader.js:815:32)
    at Function.Module._load (internal/modules/cjs/loader.js:727:14)
    at Module.require (internal/modules/cjs/loader.js:852:19) ***
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/home/runner/work/_actions/azure/webapps-container-deploy/v1/node_modules/azure-actions-appservice-rest/Kudu/KuduServiceClient.js',
    '/home/runner/work/_actions/azure/webapps-container-deploy/v1/node_modules/azure-actions-appservice-rest/Kudu/azure-app-kudu-service.js',
    '/home/runner/work/_actions/azure/webapps-container-deploy/v1/node_modules/azure-actions-appservice-rest/Utilities/AzureAppServiceUtility.js',
    '/home/runner/work/_actions/azure/webapps-container-deploy/v1/lib/main.js'
  ]
*******

Pipelines started crashing in last few hours

The jobs started to crash with Error: Cannot find module 'azure-actions-webclient/webClient' which is imported in https://github.com/microsoft/pipelines-appservice-lib/blob/master/packages/appservice-rest/src/Kudu/KuduServiceClient.ts#L3

I believe the issue is caused by one of the last few commits made in this repository:

bbd69d2

007249d

this one looks the most suspicious:
54291e6

Configuration:

      - name: Deploy to Azure
        uses: azure/webapps-deploy@v1
        with:
          app-name: my-app-name-on-azure
          publish-profile: ${{ secrets.STAGING_AZURE_WEBAPP_PUBLISH_PROFILE }}

Logs:

2019-12-19T11:30:34.4883155Z ##[group]Run azure/webapps-deploy@v1
2019-12-19T11:30:34.4883365Z with:
2019-12-19T11:30:34.4883506Z   app-name: staging-coinflip-aaa-hostedsite
2019-12-19T11:30:34.4884718Z   publish-profile: ***
2019-12-19T11:30:34.4884923Z   package: .
2019-12-19T11:30:34.4885057Z   slot-name: production
2019-12-19T11:30:34.4885191Z env:
2019-12-19T11:30:34.4885326Z   CI: true
2019-12-19T11:30:34.4885516Z   SLACK_WEBHOOK: ***
2019-12-19T11:30:34.4885810Z   SLACK_CHANNEL: ci-cd
2019-12-19T11:30:34.4885926Z   SLACK_PRE_MESSAGE: *Deployed Feature:* 
2019-12-19T11:30:34.4886033Z   REPO_SLUG: oakslab/coinflip-AAA-hosted-site
2019-12-19T11:30:34.4886136Z   COMMIT_MESSAGE: 
2019-12-19T11:30:34.4886234Z   COMMIT_ID: 
2019-12-19T11:30:34.4886331Z ##[endgroup]
2019-12-19T11:30:34.6426081Z internal/modules/cjs/loader.js:800
2019-12-19T11:30:34.6426497Z     throw err;
2019-12-19T11:30:34.6426646Z     ^
2019-12-19T11:30:34.6426727Z 
2019-12-19T11:30:34.6427637Z Error: Cannot find module 'azure-actions-webclient/webClient'
2019-12-19T11:30:34.6427819Z Require stack:
2019-12-19T11:30:34.6428710Z - /home/runner/work/_actions/azure/webapps-deploy/v1/node_modules/azure-actions-appservice-rest/Kudu/KuduServiceClient.js
2019-12-19T11:30:34.6429531Z - /home/runner/work/_actions/azure/webapps-deploy/v1/node_modules/azure-actions-appservice-rest/Kudu/azure-app-kudu-service.js
2019-12-19T11:30:34.6430125Z - /home/runner/work/_actions/azure/webapps-deploy/v1/node_modules/azure-actions-appservice-rest/Utilities/AzureAppServiceUtility.js
2019-12-19T11:30:34.6430643Z - /home/runner/work/_actions/azure/webapps-deploy/v1/lib/deploymentProvider/WebAppDeploymentProvider.js
2019-12-19T11:30:34.6431219Z - /home/runner/work/_actions/azure/webapps-deploy/v1/lib/main.js
2019-12-19T11:30:34.6431446Z     at Function.Module._resolveFilename (internal/modules/cjs/loader.js:797:15)
2019-12-19T11:30:34.6431817Z     at Function.Module._load (internal/modules/cjs/loader.js:690:27)
2019-12-19T11:30:34.6432392Z     at Module.require (internal/modules/cjs/loader.js:852:19)
2019-12-19T11:30:34.6432625Z     at require (internal/modules/cjs/helpers.js:74:18)
2019-12-19T11:30:34.6433288Z     at Object.<anonymous> (/home/runner/work/_actions/azure/webapps-deploy/v1/node_modules/azure-actions-appservice-rest/Kudu/KuduServiceClient.js:13:21)
2019-12-19T11:30:34.6433615Z     at Module._compile (internal/modules/cjs/loader.js:959:30)
2019-12-19T11:30:34.6433853Z     at Object.Module._extensions..js (internal/modules/cjs/loader.js:995:10)
2019-12-19T11:30:34.6434083Z     at Module.load (internal/modules/cjs/loader.js:815:32)
2019-12-19T11:30:34.6434305Z     at Function.Module._load (internal/modules/cjs/loader.js:727:14)
2019-12-19T11:30:34.6434589Z     at Module.require (internal/modules/cjs/loader.js:852:19) {
2019-12-19T11:30:34.6434978Z   code: 'MODULE_NOT_FOUND',
2019-12-19T11:30:34.6435149Z   requireStack: [
2019-12-19T11:30:34.6435855Z     '/home/runner/work/_actions/azure/webapps-deploy/v1/node_modules/azure-actions-appservice-rest/Kudu/KuduServiceClient.js',
2019-12-19T11:30:34.6436343Z     '/home/runner/work/_actions/azure/webapps-deploy/v1/node_modules/azure-actions-appservice-rest/Kudu/azure-app-kudu-service.js',
2019-12-19T11:30:34.6436861Z     '/home/runner/work/_actions/azure/webapps-deploy/v1/node_modules/azure-actions-appservice-rest/Utilities/AzureAppServiceUtility.js',
2019-12-19T11:30:34.6437596Z     '/home/runner/work/_actions/azure/webapps-deploy/v1/lib/deploymentProvider/WebAppDeploymentProvider.js',
2019-12-19T11:30:34.6437969Z     '/home/runner/work/_actions/azure/webapps-deploy/v1/lib/main.js'
2019-12-19T11:30:34.6438115Z   ]
2019-12-19T11:30:34.6438250Z }
2019-12-19T11:30:34.6478547Z ##[error]Node run failed with exit code 1

@SumiranAgg can you please take a look at it? it's kind of urgent.

Receiving "Publish profile does not contain kudu URL" Error

I'm using webapps-deploy to deploy a linux webapp through actions, which I had done before with no issues a few months ago, but I believe now the publish profile is pointing to a publish URL which this action does not recognize.

You can see here the failure I'm referring to here:
https://github.com/brasky/OpenSync/actions/runs/129035722

I noticed in an old PublishSettings for a previous site I deployed the Web Deploy publishUrl was elliotdematteis.scm.azurewebsites.net:443 but the new site's publishUrl was waws-prod-sn1-165.publish.azurewebsites.windows.net:443

After changing the publish URL to [sitename].scm.azurewebsites.net I no longer received the error and it deployed fine.
https://github.com/brasky/OpenSync/actions/runs/129050312

I'm relatively new with github actions and webapps-deploy, but is this an issue with azure giving me an incorrect publish URL or is this an issue where the URL validation of webapps-deploy doesn't include a new publish URL schema?

Edit:
It looks like checking for "scm" is hardcoded into Utilities/PublishProfile.ts

I'm unfamiliar with whether the *.publish.azurewebsite.windows.net is an acceptable alternative but can test it out.

WebGL application hosted on Azure App Service Plan taking time to load unityweb

Hi,

We are having a WebGL project which we are trying to host in an Azure App service plan. When we host the site in the App Service plan in Central US region and try to access the same from either Azure VM (P1v2: 1) in Central US or a machine in Asia region the time for a file to load is very high.

Please find the network trace screenshot of one such request -
image

The above took around 1.1 min.
When we host the application in Southeast Asia region the time is reduced to ~20 seconds.

And when we are hosting the same application in Github pages the load time is less then 5 seconds -
image

Kindly help us in why is the time taken for a unityweb file so high.

PS: the internet speed is not a factor as the same is being tested via Azure VMs.

some files in node_modules are not updated

My deployment of a typescript/node based web app does not update files in node_modules.

If I delete the offending file, it will be updated with the new version on the next deployment.

Errors when passing the "configuration-file" setting

I'm trying to deploy a multi-container app from a Github Action. Whenever I pass the "configuration-file" setting to the action, I get the error message: "Deployment Failed with Error: Error: Multi container support is not available for windows containerized web app.".

Here is the YAML I'm using:

    - uses: azure/webapps-deploy@v2
      with:
        app-name: '${{ secrets.APP_NAME }}'    # this the same name as the AppService app name.
        configuration-file: 'deploy/docker-compose.yml'     # this is the relative path to my docker-compose file.
        publish-profile: '${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }}'    # the publish profile string
        images: '${{ secrets.REGISTRY_NAME }}/${{ secrets.APP_CONTAINER_NAME }}'     # the image the action built in the previous step.

This is a Linux app. I can use the same docker-compose file via the azure-cli or the Portal website to configure the app as a multi-container app successfully. This issue appears to be isolated to the Github Action.

I can deploy a single-container app via this action successfully. I'm only getting errors when trying to deploy a multi-container configuration.

Corrupt zip file when deploying?

I'm not sure this is an issue with this action or something on Azure but i try here first.

My deployments has worked fine for a while but when i tried to deploy today i started to get these errors in the eventlog on Azure.

ZIP_SUPPORT::OpenZipFile(861): Failed to read central end of central directory record due to signature mismatch. (Path:"\\?\d:\local\SitePackages\812114890.zip" Err:0x8007026a)

Failed to open zip file \\?\d:\local\SitePackages\812114890.zip. Error: 0x8007026a

What i've tried.

  • Different deployment slots.
  • Tried the v2 version of the webapps-deploy
  • Tried to update the publish-profile secret.
  • Downloaded the zip file and extracted it without issues.
  • Tried to make it a bit smaller by deleting some stuff in the package. But it's still +100mb. Is there any size limit or anything?
  • There are no errors or anything in the deployment.

Well, that's mainly it. Not sure what you need more.

The `set-env` command is disabled.

As of the update this afternoon to restrict usage of set-env, this task now fails. https://github.blog/changelog/2020-10-01-github-actions-deprecating-set-env-and-add-path-commands/

Full error:

Run Azure/webapps-deploy@v1
  with:
    app-name: featureflags-data-eu-service
    package: serviceapp
    slot-name: staging
  env:
    AZURE_HTTP_USER_AGENT: 
    AZUREPS_HOST_ENVIRONMENT: 
Error: Unable to process command '::set-env name=AZURE_HTTP_USER_AGENT,::GITHUBACTIONS_DeployWebAppToAzure_6a3d8fbc4fa9b0a8568f4b02dcb98ca6aa6248e064d52b6d666423fb24ff6a2c' successfully.
Error: The `set-env` command is disabled. Please upgrade to using Environment Files or opt into unsecure command execution by setting the `ACTIONS_ALLOW_UNSECURE_COMMANDS` environment variable to `true`. For more information see: https://github.blog/changelog/2020-10-01-github-actions-deprecating-set-env-and-add-path-commands/
Package deployment using ZIP Deploy initiated.
Deploy logs can be viewed at https://featureflags-data-eu-service-staging.scm.azurewebsites.net/api/deployments/00271bf5bba7486a9203f66263ce5bbd/log
Successfully deployed web package to App Service.
Successfully updated deployment History at https://featureflags-data-eu-service-staging.scm.azurewebsites.net/api/deployments/ff45d2b9a986fc4f1e7209c19943be7f0dce44f81605577784550
App Service Application URL: http://featureflags-data-eu-service-staging.azurewebsites.net
Error: Unable to process command '::set-env name=AZURE_HTTP_USER_AGENT,::' successfully.
Error: The `set-env` command is disabled. Please upgrade to using Environment Files or opt into unsecure command execution by setting the `ACTIONS_ALLOW_UNSECURE_COMMANDS` environment variable to `true`. For more information see: https://github.blog/changelog/2020-10-01-github-actions-deprecating-set-env-and-add-path-commands/

Deployment is *very* slow (nodeJS with publish profile)

I'm using a workflow file adapted from "build and deploy a Node.js Web app to Azure using publish profile".

(side remark) : I had issues with symbolic links too (see #54 (comment))

Upon analysis, it seems that the whole copy of the node_modules folders to the webroot of the webapp takes ages (10-12 minutes for the Azure Webapp deploy step !) It's very inefficient to process and send many little files over network.

=> Shouldn't the final npm install (and npm run build โ€“ I'm using typescript) commands be executed on the target machine instead of a github action container ?

IMHO, the workflow should be like this for the "nodeJS with publish profile" scenario :

  • the github action should only send source files to the targeted runtime machine
  • npm install, npm run build and npm start should be done on the targeted runtime machine
  • It's up to the developer to ensure that is app is building correctly before calling azure/webapps-deploy

Related questions :

Permission denied during ZIP deploy

I keep getting permission denied during the ZIP Deploy part. Im not sure whats the problem at all :(

Copying file: '.next/cache/next-babel-loader/08ef92379bf38b48cd13a4fa5b92882a.json'
Copying file: '.next/cache/next-babel-loader/0a0a15bfd8c3ce8c3eec97dfc374607a.json'
Copying file: '.next/cache/next-babel-loader/0a5664b08205e9ebb21c1c33a74fa0e5.json'
Omitting next output lines...
Error: EACCES: permission denied, open '/home/site/wwwroot/.next/cache/next-minifier/content-v2/sha512/15/8c/0cef4e17432d7689463394a3386979936ea14d1355d91a851ab7906427caff8e555eb236955d89672969260a88648b64c7bfb714d56888e07d31ed1788f3'
An error has occurred during web site deployment.
Kudu Sync failed
\n/opt/Kudu/Scripts/starter.sh "/home/site/deployments/tools/deploy.sh"
##[error]Failed to deploy web package to App Service.
##[error]Deployment Failed with Error: Package deployment using ZIP Deploy failed. Refer logs for more details.

webapp-url output is a non-SSL URL provided

For some reason the applicationURL value in this action is getting a non-SSL based URI which then gets passed along to other areas like the output of webapp-url which can be used in later actions.

core.setOutput('webapp-url', this.applicationURL);

This should be changed to have the SSL-based URI by default.

It appears to be coming from:
https://github.com/microsoft/pipelines-appservice-lib/blob/714433932820111567046bd53f47e9131d95930a/src/RestUtilities/AzureAppServiceUtility.ts#L39

Which is in the publish profile. Indeed the pubprofile destinationAppUrl is a non-secure URL for some reason when downloading the publish profiles...this should be changed. Other places in the publish profile are 443/SSL based except this one.

Error Failed to get app runtime OS

My deployments started failing today with the following error.
Error: Deployment Failed with Error: Error: Failed to get app runtime OS

I'm running my WebApp in Linux containers and until today everything worked fine. I tried to update my publish profile but that didn't help. Actions workflow was autogenerated by Azure console when setting up deployments. But as I said, that exact config was working a couple of days ago.

There are not many logs in the output so it's hard to figure out what's going on. Any hint, please?

image

This is the debug output

##[debug]Could not parse response body.
##[debug]{}
##[debug]Encountered a retriable status code: 503. Message: 'Service Temporarily Unavailable'.
##[debug][GET] https://***.scm.azurewebsites.net:443/diagnostics/runtime
##[debug]Could not parse response body.
##[debug]{}
##[debug]Encountered a retriable status code: 503. Message: 'Service Temporarily Unavailable'.
##[debug][GET] https://***.scm.azurewebsites.net:443/diagnostics/runtime
##[debug]Could not parse response body.
##[debug]{}
##[debug]Encountered a retriable status code: 503. Message: 'Service Temporarily Unavailable'.
##[debug][GET] https://***.scm.azurewebsites.net:443/diagnostics/runtime
##[debug]Could not parse response body.
##[debug]{}
##[debug]Encountered a retriable status code: 503. Message: 'Service Temporarily Unavailable'.
##[debug][GET] https://***.scm.azurewebsites.net:443/diagnostics/runtime
##[debug]Could not parse response body.
##[debug]{}
##[debug]loaded affinity cookie ["ARRAffinity=f2e7c40719d65274f71e47ab410e8962551aca6eb1a4ecd4d8fee5af422a7912;Path=/;HttpOnly;Secure;Domain=***.scm.azurewebsites.net","ARRAffinitySameSite=f2e7c40719d65274f71e47ab410e8962551aca6eb1a4ecd4d8fee5af422a7912;Path=/;HttpOnly;SameSite=None;Secure;Domain=***.scm.azurewebsites.net"]
##[debug]getAppRuntime. Data: {"statusCode":503,"statusMessage":"Service Temporarily Unavailable","headers":{"content-length":"19","server":"nginx","set-cookie":["ARRAffinity=f2e7c40719d65274f71e47ab410e8962551aca6eb1a4ecd4d8fee5af422a7912;Path=/;HttpOnly;Secure;Domain=***.scm.azurewebsites.net","ARRAffinitySameSite=f2e7c40719d65274f71e47ab410e8962551aca6eb1a4ecd4d8fee5af422a7912;Path=/;HttpOnly;SameSite=None;Secure;Domain=***.scm.azurewebsites.net"],"date":"Sat, 12 Dec 2020 23:41:17 GMT","connection":"close"},"body":"Service Unavailable"}
##[debug]Failed to fetch Kudu App Runtime diagnostics.
##[debug]Service Temporarily Unavailable (CODE: 503)
Error: Deployment Failed with Error: Error: Failed to get app runtime OS

And I indeed had problems with accessing Kudu services - I was receiving status 503 when I tried to access Advanced Tools, Log Stream, SSH, or Deployment Center (logs).

Error "Failed to change file that is currently being used" when deploying to a .NET 5 site with WebSockets

I am deploying a zip file to a .NET 5 website, using this configuration:

- uses: azure/webapps-deploy@v2
  with:
    app-name: sharplab-edge
    package: WebApp.Server.zip

I only added this deployment just now, and I am running into an error:

Error: Failed to change file that is currently being used "D:\home\site\wwwroot\SharpLab.Runtime.dll"

Full log
Run azure/webapps-deploy@v2
  with:
    app-name: sharplab-edge
    package: WebApp.Server.zip
    slot-name: production
  env:
    AZURE_HTTP_USER_AGENT: 
    AZUREPS_HOST_ENVIRONMENT: 
Package deployment using ZIP Deploy initiated.
Updating submodules.
Preparing deployment for commit id '7561bb78b5'.
Generating deployment script.
Using cached version of deployment script (command: 'azure -y --no-dot-deployment -r "D:\local\Temp\zipdeploy\extracted" -o "D:\home\site\deployments\tools" --basic --sitePath "D:\local\Temp\zipdeploy\extracted"').
Running deployment command...
Command: "D:\home\site\deployments\tools\deploy.cmd"
Handling Basic Web Site deployment.
Creating app_offline.htm
Error: Failed to change file that is currently being used "D:\home\site\wwwroot\SharpLab.Runtime.dll"
KuduSync.NET from: 'D:\local\Temp\zipdeploy\extracted' to: 'D:\home\site\wwwroot'
Copying file: 'appsettings.Development.json'
Copying file: 'appsettings.json'
Copying file: 'SharpLab.Native.Profiler.dll'
Copying file: 'SharpLab.Native.Profiler.pdb'
Copying file: 'SharpLab.Runtime.dll'
Failed exitCode=1, command="kudusync" -v 50  -f "D:\local\Temp\zipdeploy\extracted" -t "D:\home\site\wwwroot" -n "D:\home\site\deployments\7561bb78b59f41d5a5d59fdf27c09a6e\manifest" -p "D:\home\site\deployments\4be36940f6a4876eed6d36ed24c97117df5433d31609801997951\manifest" -i ".git;.hg;.deployment;deploy.cmd"
An error has occurred during web site deployment.
Error: Failed to change file that is currently being used "D:\home\site\wwwroot\SharpLab.Runtime.dll"\r\nD:\Program Files (x86)\SiteExtensions\Kudu\91.21119.4922\bin\Scripts\starter.cmd "D:\home\site\deployments\tools\deploy.cmd"
Error: Failed to deploy web package to App Service.
Error: Deployment Failed with Error: Package deployment using ZIP Deploy failed. Refer logs for more details.
Successfully updated deployment History at https://sharplab-edge.scm.azurewebsites.net/api/deployments/29a251b6083275b643acd856dc6d449e86c587821609802731619
App Service Application URL: http://sharplab-edge.azurewebsites.net

I thought this might be due to the site not correctly handling app_offline.htm (maybe due to a WebSocket connection). But on the other hand when using SCM I can somehow do anything with the files -- they don't seem locked at all even without app_offline.

Not sure what's the actual problem and the right solution here -- maybe action should have an option to stop/start web app explicitly, or a wait/retry setting? Either way some graceful way of handling this and letting the user know what exactly is wrong would be great.

Webapp Deploy is acting weird

Webapp deploy action is succeeding for me but the webapp is not properly deployed.
My workflow can be seen here and the workflow run can be seen here

All is well till here. But when I go to my webapp, I get error. In the Diagnostic logs of the webapp, it says it couldn't authenticate while running the docker image pull. This is weird. It was able to do a docker push with the same credentials. Docker pull should also succeed.

I have already added my workflow run details above, if there are any other questions, please reach out to me directly.

Run azure/login@v1 = login failed

 - uses: azure/login@v1
      with:
        creds: ${{ secrets.AZURE_CREDENTIALS }}

Generates:

Run azure/login@v1
/usr/bin/az --version
WARNING: You have 3 updates available. Consider updating your CLI installation.
azure-cli 2.0.74 *

command-modules-nspkg 2.0.3
core 2.0.74 *
nspkg 3.0.4
telemetry 1.0.3 *

Python location '/opt/az/bin/python3'
Extensions directory '/home/runner/.azure/cliextensions'

Python (Linux) 3.6.5 (default, Sep 20 2019, 05:42:39)
[GCC 7.4.0]

Legal docs and information: aka.ms/AzureCliLegal

Login failed. Please check the credentials.
##[error]Error: The process '/usr/bin/az' failed because one or more lines were written to the STDERR stream
##[error]Node run failed with exit code 1

Deployed code messes up the symlinks and app can't start

I'm deploying a nodeJS app with Github actions and it seems that once the code gets to the azure web app server the symlinks from within node_modules/.bin folder are all messed up and app doesn't start.

For example when I run my code locally, if I do a node ./node_modules/.bin/next --help it works, and ./node_modules/.bin/next is actually a symlink to ../next/dist/bin/next

But after code is deployed on Azure with the webapps-deploy action it seems that ./node_modules/.bin/next is no longer a symlink to ../next/dist/bin/next but it actually becomes a text file with ../next/dist/bin/next as its contents and so if I connect to ssh to the Azure server and run node ./node_modules/.bin/next --help (same command I run locally, or that also works ok inside the GitHub action, there I get an error:

/home/site/wwwroot>node ./node_modules/.bin/next --help
/home/site/wwwroot/node_modules/.bin/next:1
../next/dist/bin/next
^

SyntaxError: Unexpected token '.'
    at wrapSafe (internal/modules/cjs/loader.js:1047:16)
    at Module._compile (internal/modules/cjs/loader.js:1097:27)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1153:10)
    at Module.load (internal/modules/cjs/loader.js:977:32)
    at Function.Module._load (internal/modules/cjs/loader.js:877:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12)
    at internal/main/run_main_module.js:18:47

Inconsistent "Error: Deployment Failed with Error: Error: Action does not support app service with kind linux,container."

I have a workflow that I use to deploy to 2 different app services for containers.

To the best of my ability, they are identical other than the environment variables passed to the container and the subscriptions they are in. I can configure both in azure portal and start the docker container manually in both, no problem.

Both are deployed to azure "app service environments" for my client. They are under 2 different subscriptions, thus I use 2 different credentials to log in depending on which one I'm deploying.

The workflow contains steps like this

    - name: Login to Azure Non Prod
      uses: Azure/login@v1
      if: github.event.inputs.environment  != 'prod'
      with:
        creds: ${{secrets.AZURE_CREDENTIALS}}
        
    - name: Login to Azure Prod
      uses: Azure/login@v1
      if: github.event.inputs.environment  == 'prod'
      with:
        creds: ${{secrets.AZURE_CREDENTIALS_PROD}}
    
    - name: Deploy
      uses: Azure/webapps-deploy@v2
      with:
        app-name: web-app-foo-${{ github.event.inputs.environment }}
        images: ghcr.io/client-name/image-name:tag

The problem, is that just one of them always errors with
Error: Deployment Failed with Error: Error: Action does not support app service with kind linux,container.

What else can I look at in terms of properties of the app services or arguments passed to the action that would cause this to only fail for one?

WebApp action continues when appname-slotname mismatches SCM credentials

The slot-name setting will be ignored when deploying using SCM credentials.
Since the SCM credential only have access to either production/slot site, we cannot derived web app slot from the product site SCM credentials.

When SCM credential is used, I would recommend concatenating appname-slotname as sitename, and perform a validation against SCM credentals' destinationAppUrl.

This issue is also related to Azure/functions-action#25

Add support deployment to App Serivce kind of functionapp

I get an error deploying Azure Functions if I am using RBAC. This does not occur if you are using an issue profile.

Run azure/webapps-deploy@v2 Error: Deployment Failed with Error: Error: Action does not support app service with kind functionapp.

I know there is an Azure/functions-action, but it would be redundant to not be able to use the same Action when deploying in parallel using strategy.

deploying WebJob

How can this be used to deploy a WebJob project to an AppService?

How can we deploy app to the root directory?

I tried to deploy an app with Tomcat 8.5 on Windows. but after the deployment, I have to access the app via <app_url>/<app_name>

I used to use Azure DevOps to deploy app to Azure WebApp. In Azure DevOps, I can set customDeployFolder to 'ROOT', so that the app can be accessed without referring to the app name.

Question: How can I deploy the app to the root via this action?

Running subsequent jobs only after the deployment triggered by the webapps-deploy action completes

I would like to automate the deployment of code to Azure Web App for Containers using GitHub Actions.

The approach that I am taking includes the following steps:

  1. CI, etc.
  2. Deploy to a staging slot in App Service using Azure/webapps-deploy@v2
  3. Validate the deployment in the staging environment (e.g., GET to one of the APIs that is deployed)
  4. Swap staging and production slots on the App Service
  5. Check the production endpoint etc.

However, I have noticed that the job to validate the deployment to the staging slot (step#3) runs before the staging slot is actually updated with the new code, which is not what is intended.

One potential approach might be to wait a certain amount of time before moving on to step#3, but this would only increase the likelihood that the deployment to staging is done, rather than guaranteeing it. And adding a long wait would unnecessarily increase the lead time until the deployment is done.

Another approach could be to check the version number deployed on the staging slot before moving on to step#3. However, I'm wondering if there is a simpler way (e.g., adding a line or two to the GitHub Action workflow yaml code to check for this).

Could someone provide advice please?

WebApp can't be backuped into Storage Accounts with Premium LRS Sku

It's allowed to schedule an Azure WebApp using ARM Template or powershell specifying all existing Storage Account Sku's
But backups fails where the storage Account has Sku "Premium LRS".

When i get the request that filtering storage accounts from WebApp backup selection in portal, i can see that the filter "Premium LRS" is applied.

where type in~ ('microsoft.storage/storageaccounts','microsoft.classicstorage/storageaccounts')| extend isClassic = (type =~ 'microsoft.classicstorage/storageaccounts')| extend isHnsEnabled = coalesce(properties.isHnsEnabled, false)| extend allowSharedKeyAccess = coalesce(properties.allowSharedKeyAccess, true)| extend skuName = replace('-', '_', tostring(iff(isClassic, properties.accountType, sku.name)))| project id, name, location, skuName, kind, isHnsEnabled, allowSharedKeyAccess| summarize name = any(name), location = any(location), skuName = any(skuName), ['kind'] = any(kind), isHnsEnabled = any(isHnsEnabled), allowSharedKeyAccess = any(allowSharedKeyAccess) by id| order by name asc | where skuName !in~ ('Premium_LRS')"

Otherwise there is no information about this requirement in documentation :
https://docs.microsoft.com/en-us/azure/app-service/manage-backup#requirements-and-restrictions

If this requirement is "Normal", it should be impossible to schedule backups using Storage Accounts with "Premium LRS" Sku through ARM template or Edit-AzWebAppBackupConfiguration cmdlet and the documentation should be indicate this requirement

Remove extra files on deploy

I have noticed the deployment only creates new files and overwrites existing ones, but does not delete files not part of the deployment. This is causing our workspace to be cluttered and may lead to harder to pinpoint issues in the future.

Is there the option to delete the old files as new ones are deployed?

This is a feature available through other existing deployment options

startup-command parameter is ignored

We're using this GitHub action to deploy an app to Azure App Services.
The workflows seems to works (and the deployment occurs) but the startup-command is ignored, and GitHub raises an error:

image

This message contradicts the yaml action definition file.

Here is our yaml action file:

name: REDACTED
on:
  push:
    branches:
      - production
jobs:
  build-and-deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@master
      - name: Set up Node.js version
        uses: actions/setup-node@v1
        with:
          node-version: "10.x"
      - name: npm install, build, and test
        run: |
          npm install
          npm run build --if-present
          npm run test --if-present
      - name: "Deploy to Azure Web App"
        uses: azure/webapps-deploy@v1
        with:
          app-name: "REDACTED"
          startup-command: "npm run api-prd"
          slot-name: "production"
          publish-profile: REDACTED
          package: .

Am I missing something or is it a known issue?

This job just started failing with Internal Server Error

Hi! I have been using this github action for months without issues. Unfortunately tonight I started seeing the following in my builds:

 Deploy to Azure WebApp1s
    NODE_VERSION: 12.x
Run azure/webapps-deploy@v2
  with:
    app-name: XXX
    publish-profile: ***
    package: .
    slot-name: production
  env:
    AZURE_WEBAPP_NAME: XXX
    AZURE_WEBAPP_PACKAGE_PATH: .
    NODE_VERSION: 12.x
##[error]Deployment Failed with Error: Error: Internal Server Error. Please try again
Error: [object Object]

The internal server error makes me think it's on Azure's end. But I am able to deploy my function app successfully from Visual Studio Code. Also, the object output at the end would be helpful if I knew how to JSON.stringify it! ๐Ÿ˜„

Can you please advise?

Run from package deployment

Is it possible to use run from package deployment? This seems the default for functions-action which takes care of these steps:

  • Putting the zip in home/data/SitePackages
  • Setting package name in packagename.txt
  • Setting WEBSITE_RUN_FROM_PACKAGE to 1 in app settings

Also the AzureWebApp@1 task for Azure pipelines does same as above. However, webapps-deploy action just extracts the package into wwwroot.

Error: Invalid entry header

Using v2 or v1, I'm unable to deploy a Spring Boot app (JHipster)

Error: Deployment Failed with Error: Error: Invalid entry header
Error: Error: Invalid entry header
-   name: Deploy to Azure WebApp
     uses: azure/webapps-deploy@v2
     with:
          app-name: _my-app-name_
          publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }}
          package: '${{ github.workspace }}/target/*jar'

ZIP Deploy failed

I've enabled GitHub Actions for my Azure App Service Dev Slot, but it fails on the deployment step using the webapps-deploy action.

##[error]Failed to deploy web package to App Service.
##[error]Deployment Failed with Error: Package deployment using ZIP Deploy failed. Refer logs for more details.

Workflow

name: Build and deploy XXXXXX - XXXXXX-web(dev)

env:
  AZURE_WEBAPP_NAME: XXXXXX-web
  AZURE_WEBAPP_PATH: '.'
  AZURE_WEBAPP_SLOT: 'dev'
  DOTNET_VERSION: '3.1.102'
  GITHUB_BRANCH: 'dev'

on:
  push:
    branches:
      - dev

jobs:
  build-and-deploy:
    runs-on: windows-latest

    steps:
    - uses: actions/checkout@master

    - name: Set up .NET Core
      uses: actions/setup-dotnet@v1
      with:
        dotnet-version: ${{ env.DOTNET_VERSION }}

    - name: Build XXXXXX project
      run: dotnet build .\XXXXXX\XXXXXX.csproj --configuration Release

    - name: Publish XXXXXX project
      run: dotnet publish .\XXXXXX\XXXXXX.csproj -c Release -o ${{ env.DOTNET_ROOT }}/myapp

    - name: Deploy to Azure Web App
      uses: azure/webapps-deploy@v2
      with:
        app-name: 'XXXXXX-web'
        slot-name: 'Dev'
        publish-profile: ${{ secrets.AzureAppService_PublishProfile_YYYYYYYYYYYYYYYYYYYYYY }}
        package: ${{env.DOTNET_ROOT}}/myapp 

Output

   package: C:\hostedtoolcache\windows\dncs\3.1.102\x64/myapp
  env:
    AZURE_WEBAPP_NAME: XXXXXX-web
    AZURE_WEBAPP_PATH: .
    AZURE_WEBAPP_SLOT: dev
    DOTNET_VERSION: 3.1.102
    GITHUB_BRANCH: dev
    DOTNET_ROOT: C:\hostedtoolcache\windows\dncs\3.1.102\x64
Package deployment using ZIP Deploy initiated.
Updating submodules.
Preparing deployment for commit id '2a48ddc76b'.
Generating deployment script.
Using cached version of deployment script (command: 'azure -y --no-dot-deployment -r "D:\local\Temp\zipdeploy\extracted" -o "D:\home\site\deployments\tools" --basic --sitePath "D:\local\Temp\zipdeploy\extracted\XXXXXX.com"').
Running deployment command...
Command: "D:\home\site\deployments\tools\deploy.cmd"
Handling Basic Web Site deployment.
Creating app_offline.htm
Error: Could not find a part of the path 'D:\local\Temp\zipdeploy\extracted\XXXXXX.com'.
KuduSync.NET from: 'D:\local\Temp\zipdeploy\extracted\XXXXXX.com' to: 'D:\home\site\wwwroot'
Failed exitCode=1, command="kudusync" -v 50  -f "D:\local\Temp\zipdeploy\extracted\XXXXXX.com" -t "D:\home\site\wwwroot" -n "D:\home\site\deployments\2a48ddc76bbd4b4c87cb0834cd179a08\manifest" -p "D:\Program Files (x86)\SiteExtensions\Kudu\87.20522.4610\bin\Scripts\firstDeploymentManifest" -i ".git;.hg;.deployment;deploy.cmd"
An error has occurred during web site deployment.
Error: Could not find a part of the path 'D:\local\Temp\zipdeploy\extracted\XXXXXX.com'.\r\nD:\Program Files (x86)\SiteExtensions\Kudu\87.20522.4610\bin\Scripts\starter.cmd "D:\home\site\deployments\tools\deploy.cmd"
##[error]Failed to deploy web package to App Service.
##[error]Deployment Failed with Error: Package deployment using ZIP Deploy failed. Refer logs for more details.
Successfully updated deployment History at https://XXXXXX-web-dev.scm.azurewebsites.net/api/deployments/517bd24fdfb7cee6da766301e1a72a83b52d221e1593760589047
App Service Application URL: http://XXXXXX-web-dev.azurewebsites.net

app-name setting incorrect when creating GH action from portal

Apologies if this isn't the correct place to report this issue - feel free to direct me elsewhere!

When I set up deployment using GitHub Actions from the Azure Portal, Azure automatically creates a workflow using the webapps-deploy action in my repository, with the following setting:

with:
  app-name: 'my-app(slotname)'
  slot-name: 'slotname'

However, this format for the app-name property fails validation when the webapps-deploy action runs, on these lines:

// Cross-validate provided app name and slot is same as that in publish profile
export function validateAppDetails() {
let actionParams: ActionParameters = ActionParameters.getActionParams();
if(!!actionParams.appName || (!!actionParams.slotName && actionParams.slotName !== 'production')) {
let creds: ScmCredentials = PublishProfile.getPublishProfile(actionParams.publishProfileContent).creds;
let splitUsername: string[] = creds.username.toUpperCase().substring(1).split("__");
let appNameMatch: boolean = !actionParams.appName || actionParams.appName.toUpperCase() === splitUsername[0];
let slotNameMatch: boolean = actionParams.slotName === 'production' || actionParams.slotName.toUpperCase() === splitUsername[1];
if(!appNameMatch || !slotNameMatch) {
throw new Error("Publish profile is invalid for app-name and slot-name provided. Provide correct publish profile credentials for app.");
}
}
}

The field needs to be formatted this way in order to pass validation:

with:
  app-name: 'my-app'
  slot-name: 'slotname'

Once I changed this setting in my workflow config file, deployment worked fine.

This issue is to request two changes:

  • fix the workflow file generated by the Azure Portal so that it follows the correct format for the app-name property (possibly not the right place to request this - sorry about that)
  • update the documentation in this repo to include information about the format of the app-name and slot-name fields (the slot-name field doesn't currently appear in any of the documentation for this repo)

Can't Select Deployment Folder

My repo has many projects inside and when I'm using GitHub actions it is deploying the entire repo to Azure. After looking into this I don't see a way we can set the default deployment folder but it is unusable to me unless I can achieve this

Thanks,
Joshua

Post deployment scripts/options

Is it possible to run post-script actions? such as an yarn install and start?

If not possible part of the action, would it be possible to link in an example of how to solve this issue?

Support for YAML/JSON formatted deploy credentials

Hi,

so far I've had great success using this action together with https://github.com/Azure/login.
I like the idea of publish profiles for specific workflows, since they seem slightly less cumbersome and akin to SAS tokens.

I was slightly surprised, when I wanted to use the lazy approach and set up multiple CI pipelines for different WebApps:

az webapp deployment list-publishing-profiles \
  --query "[? publishMethod=='MSDeploy'] | [0]" \
  --resource-group "foo" \
  --name "bar"

produces

{
  "SQLServerDBConnectionString": "",
  "controlPanelLink": "http://windows.azure.com",
  "databases": null,
  "destinationAppUrl": "http://<name>.azurewebsites.net",
  "hostingProviderForumLink": "",
  "msdeploySite": "<name>",
  "mySQLDBConnectionString": "",
  "profileName": "<name> - Web Deploy",
  "publishMethod": "MSDeploy",
  "publishUrl": "<name>.scm.azurewebsites.net:443",
  "userName": "$<name>",
  "userPWD": "<secret>",
  "webSystem": "WebSites"
}

https://github.com/Azure/webapps-deploy/blob/master/lib/Utilities/PublishProfile.js#L22

new actions_secret_parser_1.SecretParser(publishProfileContent, actions_secret_parser_1.FormatType.XML);

๐Ÿค”

"Well it does make sense when looking at the Publish Profile description (where you describe the Portal approach).
No biggie. They certainly have different output formats.

az webapp deployment list-publishing-profiles --help

--output -o : Output format. Allowed values: json, jsonc, none, table, tsv, yaml, yamlc

๐Ÿคฆ


It's not a big thing to convert the JSON/YAML you retrieve via azure-cli to the XML as you would retrieve it via the portal. General support for either format (or both) supported by azure-cliwould be greatly appreciated.
Or is it better to bring this up with the azure-cli team?

In any case, either solution would be welcome, because service principals can only perform non-UI approaches, so the only way to retrieve the XML is not always possible ๐Ÿ˜ž.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.