deploy sample springboot app WebGoat to Azure app service

0 votes

New to Azure App Service, following https://docs.microsoft.com/en-us/azure/app-service/quickstart-java?tabs=javase&pivots=platform-linux, I am trying to experiment to deploy WebGoat to Azure App, but unsuccessful.

git clone https://github.com/WebGoat/WebGoat
cd WebGoat
git checkout v8.0.0.M26
mvn install -T 4 -Dmaven.test.skip=true -DskipTests
cd webgoat-server

//here I could deploy the jar locally with 
//$java -jar target/webgoat-server-v8.0.0.M26.jar
//and see the site at localhost:8080/WebGoat

//now trying to deploy to azure using Azure maven plguin
mvn com.microsoft.azure:azure-webapp-maven-plugin:1.14.0:config
vim pom.xml //as per below
mvn package azure-webapp:deploy

my webgoat-server/pom.xml

     <plugin>
        <groupId>com.microsoft.azure</groupId>
        <artifactId>azure-webapp-maven-plugin</artifactId>
        <version>1.14.0</version>
        <configuration>
          <schemaVersion>v2</schemaVersion>
          <subscriptionId>0665bd88-599e-4153-887a-2c51c3e094d0</subscriptionId>
          <resourceGroup>webgoat-server-1620910221297-rg</resourceGroup>
          <appName>webgoat-server-1620910221297</appName>
          <pricingTier>F1</pricingTier>
          <region>westeurope</region>
          <runtime>
            <os>Linux</os>
            <javaVersion>Java 11</javaVersion>
            <webContainer>Java SE</webContainer>
          </runtime>
          <deployment>
            <resources>
              <resource>
                <directory>${project.basedir}/target</directory>
                <includes>
                  <include>webgoat-server-v8.0.0.M26.jar</include>
                </includes>
              </resource>
            </resources>
          </deployment>
        </configuration>

what I got from azure app service | log stream,

2021-05-13T13:03:30.937769935Z: [INFO]  2021-05-13 13:03:30.937  INFO 124 --- [           main] o.s.s.concurrent.ThreadPoolTaskExecutor  : Initializing ExecutorService 'applicationTaskExecutor'
2021-05-13T13:03:33.564912852Z: [INFO]  2021-05-13 13:03:33.564  INFO 124 --- [           main] o.s.b.a.e.web.EndpointLinksResolver      : Exposing 2 endpoint(s) beneath base path '/actuator'
2021-05-13T13:03:34.138847510Z: [INFO]  2021-05-13 13:03:34.138  INFO 124 --- [           main] io.undertow                              : starting server: Undertow - 2.0.27.Final
2021-05-13T13:03:34.205034948Z: [INFO]  2021-05-13 13:03:34.204  INFO 124 --- [           main] org.xnio                                 : XNIO version 3.3.8.Final
2021-05-13T13:03:34.295912450Z: [INFO]  2021-05-13 13:03:34.295  INFO 124 --- [           main] org.xnio.nio                             : XNIO NIO Implementation Version 3.3.8.Final
2021-05-13T13:03:34.383176472Z: [ERROR]  WARNING: An illegal reflective access operation has occurred
2021-05-13T13:03:34.383264172Z: [ERROR]  WARNING: Illegal reflective access by org.xnio.nio.NioXnio$2 (jar:file:/local/site/wwwroot/app.jar!/BOOT-INF/lib/xnio-nio-3.3.8.Final.jar!/) to constructor sun.nio.ch.EPollSelectorProvider()
2021-05-13T13:03:34.383276972Z: [ERROR]  WARNING: Please consider reporting this to the maintainers of org.xnio.nio.NioXnio$2
2021-05-13T13:03:34.383281572Z: [ERROR]  WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
2021-05-13T13:03:34.384696864Z: [ERROR]  WARNING: All illegal access operations will be denied in a future release
2021-05-13T13:03:36.058791199Z: [INFO]  2021-05-13 13:03:36.058  INFO 124 --- [           main] o.s.b.w.e.u.UndertowServletWebServer     : Undertow started on port(s) 80 (http) with context path '/WebGoat'
2021-05-13T13:03:36.159459348Z: [INFO]  2021-05-13 13:03:36.158  INFO 124 --- [           main] org.owasp.webgoat.StartWebGoat           : Started StartWebGoat in 90.144 seconds (JVM running for 106.368)
2021-05-13T13:05:29  No new trace in the past 1 min(s).
2021-05-13T13:06:29  No new trace in the past 2 min(s).
2021-05-13T13:07:29  No new trace in the past 3 min(s).

from browser,

navigate to https://webgoat-server-1620910221297.azurewebsites.net/

502 - Web server received an invalid response while acting as a gateway or proxy server.
There is a problem with the page you are looking for, and it cannot be displayed. When the Web server (while acting as a gateway or proxy) contacted the upstream content server, it received an invalid response from the content server.

navigate to https://webgoat-server-1620910221297.azurewebsites.net/WebGoat

:( Application Error
If you are the application administrator, you can access the diagnostic resources.

is there any additional steps I need to expose port 8080 and path /WebGoat?

Mar 7, 2022 in Azure by Edureka
• 12,690 points
1,381 views

1 answer to this question.

0 votes

In APPLICATION SETTINGS you need to set the key/value pair WEBSITES_PORT in order to expose port 8080 on the app service.

In terms of location, you should install the app in site/home/wwwroot. To see the virtual directories, navigate to configuration -> Path mappings.

answered Mar 24, 2022 by Edureka
• 13,620 points

Related Questions In Azure

0 votes
1 answer

Failed to Build and deploy JAR app to Azure Web App

You don't need @EnableJpaRepositories because your package ...READ MORE

answered Mar 29, 2022 in Azure by Edureka
• 12,690 points
575 views
0 votes
1 answer

How do I use Powershell to create an Azure Web App that runs on Linux?

Try the command below: New-AzureRmResource -ResourceGroupName <ResourceGroupName> -Location ...READ MORE

answered Mar 25, 2022 in Azure by Edureka
• 12,690 points
607 views
0 votes
1 answer

How to create a service connection for Azure in Azure Devops (with pictures)

to create a service connection for Azure ...READ MORE

answered Mar 29, 2022 in Azure by Edureka
• 12,690 points

edited Jul 4, 2023 by Khan Sarfaraz 8,135 views
0 votes
1 answer

How to run scheduled scripts using Azure WebJobs

You can schedule the trigger to occur ...READ MORE

answered Apr 7, 2022 in Azure by Edureka
• 12,690 points
1,383 views
0 votes
1 answer

Does Azure have a FREE tier?

When you join up for a free ...READ MORE

answered Apr 11, 2022 in Azure by Edureka
• 12,690 points

edited Jun 27, 2023 by Khan Sarfaraz 471 views
0 votes
0 answers
0 votes
1 answer

What is the difference between "Azure Web app" and "Azure App Service"?

Azure App Services Azure App Services is a ...READ MORE

answered Mar 8, 2022 in Azure by Edureka
• 13,620 points

edited Jun 27, 2023 by Khan Sarfaraz 2,198 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP