Unable to deploy Spring Boot application in Azure

1.3k Views Asked by At

I am tring to deploy Spring boot application in Azure and I followed exact steps as mentoned in microsoft official document https://learn.microsoft.com/en-us/azure/java/spring-framework/deploy-spring-boot-java-app-with-maven-plugin. But I am getting error message even after logged in to azure succesfully in command line.

The refresh token has expired due to maximum lifetime. The token was issued on 2019-11-25T00:18:57.5736076Z and the maximum allowed lifetime for this application is 08:00:00 atcom.microsoft.aad.adal4j.AdalTokenRequest.executeOAuthRequestAndProcessResponse (AdalTokenRequest.java:128) at com.microsoft.aad.adal4j.AuthenticationContext.acquireTokenCommon (AuthenticationContext.java:928) at com.microsoft.aad.adal4j.AcquireTokenCallable.execute (AcquireTokenCallable.java:70) at com.microsoft.aad.adal4j.AcquireTokenCallable.execute (AcquireTokenCallable.java:38) at com.microsoft.aad.adal4j.AdalCallable.call (AdalCallable.java:47) at java.util.concurrent.FutureTask.run (FutureTask.java:264) at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1128) at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:628) at java.lang.Thread.run (Thread.java:835)

3

There are 3 best solutions below

2
On

Your token has expired as the error message indicate. Three suggestions here:

  1. If you are logged in with Azure CLI, use "az login" to refresh the token.
  2. Check the file %HOMEPATH%/.azure/azure-secret.json, this is the auth file created by azure-maven-plugin, which have higher priority than Azure CLI auth file. If the file exist, you can either delete the file(will consume az login instead) or refresh the file with "mvn com.microsoft.azure:azure-maven-plugin:0.1.0:login".
  3. If none of above work, you can still try using service principle for auth. See https://github.com/microsoft/azure-maven-plugins/wiki/Authentication for details.
0
On

The error means the refresh token of your user account which logged in was expired.

You could use az account clear to clear all subscriptions from the CLI's local cache, then use az login to log in again.

I test it and it works fine on my side.

enter image description here

enter image description here

1
On

az account clear - cleans up your local cache

The Maven deployer (azure-webapp:deploy) opens up your default browser for you to provide Azure credentials. Once valid credentials are provided the application deployment succeeded.