2

I'm trying to deploy a Spring Boot application to Microsoft Azure Spring Apps using Maven.

I strictly followed this tutorial from Microsoft : https://learn.microsoft.com/en-us/azure/spring-apps/how-to-maven-deploy-apps , except for the azure-spring-apps-maven-plugin which had to be upgraded from 1.10.0 to 1.17.0, as per follows :

mvn com.microsoft.azure:azure-spring-apps-maven-plugin:1.17.0:config

But when running the deploy command with the sample project :

mvn azure-spring-apps:deploy

The following "Invalid arguments: DeploymentSettings must be provided" error occurs :

[ERROR] Operator called default onErrorDropped
reactor.core.Exceptions$StaticThrowable: Operator has been terminated
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  13.680 s
[INFO] Finished at: 2023-05-02T19:06:23+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.microsoft.azure:azure-spring-apps-maven-plugin:1.17.0:deploy (default-cli) on project hellospring: create or update Spring app(hellospring) from config: AzureToolkitRuntimeException: create Azure Spring App deployment (default): Status code 400, "{"error":{"code":"BadArgument","message":"Invalid arguments: DeploymentSettings must be provided.","details":[{"code":"BadArgument","message":"DeploymentSettings must be provided.","target":"Properties.DeploymentSettings"}]}}" -> [Help 1]

The HelloSpring sample application does not require any specific configuration (no database, no file storage, no https certificates, etc.).

Any idea of what I may be doing wrong?

desertnaut
  • 57,590
  • 26
  • 140
  • 166
Nicolas Riousset
  • 3,447
  • 1
  • 22
  • 25
  • I'm experiencing exactly the same issue. Have you found the workaround or solution? – Hoang Duc Nguyen May 17 '23 at 13:37
  • Not yet. I had some unsuccessful contacts with Azure support, I hope they'll get back to me. – Nicolas Riousset May 17 '23 at 13:57
  • I visit this issue which were informed fixed in 1.17.0. According to the discussion, the issue was narrowed down to action of deploying to the Azure Spring Apps Consumption Plan. That was my case as well. https://github.com/microsoft/azure-maven-plugins/issues/2268 With 1.17.0 released, it fixed this error but I haven't seen any report of whether the deployment to Azure Spring Apps Consumption Plan would success since they also stated that they doesn't have plan to support the plan soon. What do you think? – Hoang Duc Nguyen May 18 '23 at 14:04

2 Answers2

1

Azure Spring Apps deployment with Maven causes error : Invalid arguments: DeploymentSettings must be provided

I would suggest you to run mvn clean install before deploying your application to Azure Spring Apps.

And also Check if the below configuration is being added in your pom.xml file after running mvn com.microsoft.azure:azure-spring-apps-maven-plugin:1.17.0:config.

<plugin>
        <groupId>com.microsoft.azure</groupId>
        <artifactId>azure-spring-apps-maven-plugin</artifactId>
        <version>1.17.0</version>
        <configuration>
                    
            <subscriptionId>Azure_SUbscription_id</subscriptionId>
            <resourceGroup>Resource_group_name</resourceGroup>
            <clusterName>kpspringapp</clusterName>
            <appName>springboot-crud</appName>
            <isPublic>false</isPublic>
            <deployment>
                  <cpu>1</cpu>
                  <memoryInGB>1</memoryInGB>
                  <instanceCount>1</instanceCount>
                  <runtimeVersion>Java 11</runtimeVersion>
                  <resources>
                      <resource>
                          <filtering/>
                          <mergeId/>
                          <targetPath/>
                        <directory>${project.basedir}/target</directory>
                          <includes>
                               <include>*.jar</include>
                          </includes>
                       </resource>
                   </resources>
              </deployment>
         </configuration>
    </plugin>

I have created a spring boot application and deployed to Azure Spring Apps:

  1. Logged into Azure via command line.

enter image description here

  1. Generating the configurations to deploy the Spring Boot application to Azure Spring Apps by running mvn com.microsoft.azure:azure-spring-apps-maven-plugin:1.17.0:config command. This will ask to select the subscription, Resource group, Azure Spring Apps name, Java runtime version etc., and then generate the configurations required for deployment.

enter image description here enter image description here

I was also getting errors initially and couldn't deploy the application. But, after running the command mvn clean install, I was able to deploy the application to spring apps.

enter image description here enter image description here enter image description here

Deploying the application to Azure Spring Apps:

enter image description here

Portal: enter image description here

Response: enter image description here

Pravallika KV
  • 2,415
  • 2
  • 2
  • 7
  • Thanks a lot for your detailed answer. However, the "mvn clean install" didn't change anything. My Azure account has access to two subscriptions, I wonder if this may be related. – Nicolas Riousset May 06 '23 at 14:38
  • Even if you have multiple subscriptions, you will get options to select your preferred subscription when you run the command `mvn com.microsoft.azure:azure-spring-apps-maven-plugin:1.17.0:config` as I shown in the answer. – Pravallika KV May 06 '23 at 16:44
1

Everything works perfectly if you are NOT using the "Standard Consumption" plan. If you use at least "Basic" everything works as it should. I have retested this a few times and each time it works fine with "Basic" but not "Consumption" as I get same error as you each time.

Obviously this is not ideal, perhaps there is update coming soon? I would much rather use the new consumption plan

Dan Hager
  • 61
  • 3