azure-maven-plugins icon indicating copy to clipboard operation
azure-maven-plugins copied to clipboard

"Failed to acquire a new access token" error by running mvn azure-spring-cloud:deploy

Open euchungmsft opened this issue 3 years ago • 8 comments

It prompts me to login every time when I run 'mvn azure-spring-cloud:deploy', it seems like it never stores the access token

Plugin name and version

azure-spring-cloud-maven-plugin:1.7.2:deploy

Plugin configuration in your pom.xml

config was done by this mvn com.microsoft.azure:azure-spring-cloud-maven-plugin:1.7.2:config

in pom.xml

..
        <plugin>
            <groupId>com.microsoft.azure</groupId>
            <artifactId>azure-spring-cloud-maven-plugin</artifactId>
            <version>1.7.2</version>
            <configuration>
                <subscriptionId>xxxxxxxxxx</subscriptionId>
                <clusterName>spc-krc-001</clusterName>
                <appName>azure-spring-petclinic-simple</appName>
                <isPublic>true</isPublic>
                <deployment>
                    <cpu>1</cpu>
                    <memoryInGB>1</memoryInGB>
                    <instanceCount>1</instanceCount>
                    <runtimeVersion>Java 8</runtimeVersion>
                    <resources>
                        <resource>
                            <filtering/>
                            <mergeId/>
                            <targetPath/>
                            <directory>${project.basedir}/target</directory>
                            <includes>
                                <include>*.jar</include>
                            </includes>
                        </resource>
                    </resources>
                </deployment>
            </configuration>
        </plugin>
..

Expected behavior

Actual behavior

[ERROR] Failed to acquire a new access token.
[INFO] Retry attempts have been exhausted after 0 attempts.
[WARNING] Cannot get subscriptions for tenant xxxxx , please verify you have proper permissions over this tenant, detailed error: Cannot acquire token from refresh token due to error: com.microsoft.aad.adal4j.AdalClaimsChallengeException: {"error":"interaction_required","error_uri":"https:\/\/login.microsoftonline.com\/error?code=53003"}

이미지

Steps to reproduce the problem

see the shot above

euchungmsft avatar Dec 20 '21 03:12 euchungmsft

@euchungmsft Thanks for your report, we will investigate this issue soon. As a workaround, could you please try other authentication method like azure_cli or service_principal and try again? You may get related authentication doc here

Flanker32 avatar Dec 20 '21 06:12 Flanker32

I got this error with azure_cli

Failed to execute goal com.microsoft.azure:azure-spring-cloud-maven-plugin:1.7.2:deploy (default-cli) on project azure-spring-petclinic-simple: execute Azure Cli command 'az version --output json' failed due to error: Process exited with an error: 2 (Exit value: 2).

but install az version info is like this

{
  "azure-cli": "2.31.0",
  "azure-cli-core": "2.31.0",
  "azure-cli-telemetry": "1.0.6",
  "extensions": {
    "azure-iot": "0.10.15",
    "spring-cloud": "2.12.1"
  }
}

pom.xml looks like this

image

euchungmsft avatar Dec 20 '21 07:12 euchungmsft

It seems like service_principal works properly but I don't think developers want this

euchungmsft avatar Dec 20 '21 08:12 euchungmsft

@euchungmsft Thanks for your message, could you please help share your os and jdk info?

@andxu Please check this issue

Flanker32 avatar Dec 20 '21 08:12 Flanker32

For OS, Ubuntu/WSL

Linux DESKTOP-MIHEKP9 4.19.128-microsoft-standard #1 SMP Tue Jun 23 12:58:10 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

For JDK

openjdk version "11.0.11" 2021-04-20
OpenJDK Runtime Environment (build 11.0.11+9-Ubuntu-0ubuntu2.20.04)
OpenJDK 64-Bit Server VM (build 11.0.11+9-Ubuntu-0ubuntu2.20.04, mixed mode, sharing)

euchungmsft avatar Dec 20 '21 08:12 euchungmsft

It's been a while, any updates with this ? @Flanker32 @andxu

I realized that none of these to work with this module

  • Maven Plugin for Azure Web Apps
  • Maven Plugin for Azure Functions
  • Maven Plugin for Azure Spring Cloud -

after config's done, when I tried to run mvn -X package azure-webapp:deploy, I got this and it never ends

image

configuration looks like this in my pom.xml

image

euchungmsft avatar Mar 30 '22 07:03 euchungmsft

@euchungmsft Thanks for your report and really sorry for the late response. I could still not re-produce this issue, could you please share the full log of webapp:deploy -X for us for better investigation?

Flanker32 avatar Apr 04 '22 07:04 Flanker32

Hi, @euchungmsft, we really thank you for supporting us. I noticed you have reported this issue to another team. In fact, we also think this should be an issue of Azure CLI itself. Anyway, we improved the implementation of the authentication part of our maven plugins with the latest azure-identity library. Can you try the latest versions?

wangmingliang-ms avatar Sep 20 '22 05:09 wangmingliang-ms