How to deploy to a virtual Directory using GitHub action "azure/webapps-deploy"

Jean Paul Larach 31 Reputation points Microsoft Employee
2023-05-20T01:53:04.4733333+00:00

Does anyone know how to deploy to a virtual Directory using GitHub action "azure/webapps-deploy"? I don't see the equivalent in the GitHub action.

In Azure DevOps you were able to do this:User's image

ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,126 questions
Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
6,790 questions
{count} votes

1 answer

Sort by: Most helpful
  1. ajkuma 22,001 Reputation points Microsoft Employee
    2023-05-22T19:17:37.2766667+00:00

    @Jean Paul Larach , Firstly, apologies for the delay from over the weekend.

    Based on my understanding of your scenario, to deploy to a virtual directory using the azure/webapps-deploy GitHub action, you can specify the virtual directory path in the app-name parameter. For example, if your virtual directory path is /myapp, you can set the app-name parameter to myapp.

    You may take a look the example YAML configuration for deploying to a virtual directory:

    - name: Deploy to Azure Web App
      uses: azure/webapps-deploy@v2
      with:
        app-name: myapp/virtualdirectory
        publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }}
        package: ${{ env.AZURE_WEBAPP_PACKAGE_PATH }}/myapp
    
    

    In this example, the app-name parameter is set to myapp/virtualdirectory, which specifies the virtual directory path. The publish-profile parameter specifies the publish profile file, and the package parameter specifies the path to the package or folder to deploy.

    Additionally, you may test it our with "VirtualApplication" input parameter. Here's an example YAML code snippet:

    - name: Deploy to Azure Web App
      uses: azure/webapps-deploy@v2
      with:
        app-name: 'myapp'
        publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }}
        package: ${{ env.AZURE_WEBAPP_PACKAGE_PATH }}
        VirtualApplication: 'virtual-directory-name'
    
    
    
    

    In this example, the "VirtualApplication" input parameter is set to the name of the virtual directory you want to deploy to. Ensure to replace 'myapp' with the name of your Azure Web App, and 'virtual-directory-name' with the name of your virtual directory.

    Reference:

    Deploying .NET to Azure App Service 

    Deploy to App Service using GitHub Actions