microsoft / azure-maven-plugins

Maven plugins for Azure
MIT License
276 stars 150 forks source link

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

Open euchungmsft opened 2 years ago

euchungmsft commented 2 years ago

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

Flanker32 commented 2 years ago

@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

euchungmsft commented 2 years ago

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 commented 2 years ago

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

Flanker32 commented 2 years ago

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

@andxu Please check this issue

euchungmsft commented 2 years ago

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 commented 2 years ago

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

I realized that none of these to work with this module

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

Flanker32 commented 2 years ago

@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?

wangmingliang-ms commented 2 years ago

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?