protected ApplicationTokenCredentials getAppTokenCredentialsFromServer ( Server server ) { if ( server == null ) { return null ; } final String clientId = Utils . getValueFromServerConfiguration ( server , CLIENT_ID ) ; if ( StringUtils . isEmpty ( clientId ) ) { getLog ( ) . debug ( CLIENT_ID_NOT_CONFIG ) ; return null ; } final String tenantId = Utils . getValueFromServerConfiguration ( server , TENANT_ID ) ; if ( StringUtils . isEmpty ( tenantId ) ) { getLog ( ) . debug ( TENANT_ID_NOT_CONFIG ) ; return null ; } final String environment = Utils . getValueFromServerConfiguration ( server , ENVIRONMENT ) ; final AzureEnvironment azureEnvironment = getAzureEnvironment ( environment ) ; getLog ( ) . debug ( "Azure Management Endpoint: " + azureEnvironment . managementEndpoint ( ) ) ; final String key = Utils . getValueFromServerConfiguration ( server , KEY ) ; if ( ! StringUtils . isEmpty ( key ) ) { getLog ( ) . debug ( USE_KEY_TO_AUTH ) ; return new ApplicationTokenCredentials ( clientId , tenantId , key , azureEnvironment ) ; } else { getLog ( ) . debug ( KEY_NOT_CONFIG ) ; } final String certificate = Utils . getValueFromServerConfiguration ( server , CERTIFICATE ) ; if ( StringUtils . isEmpty ( certificate ) ) { getLog ( ) . debug ( CERTIFICATE_FILE_NOT_CONFIG ) ; return null ; } final String certificatePassword = Utils . getValueFromServerConfiguration ( server , CERTIFICATE_PASSWORD ) ; try { final byte [ ] cert ; cert = Files . readAllBytes ( Paths . get ( certificate , new String [ 0 ] ) ) ; getLog ( ) . debug ( USE_CERTIFICATE_TO_AUTH + certificate ) ; return new ApplicationTokenCredentials ( clientId , tenantId , cert , certificatePassword , azureEnvironment ) ; } catch ( Exception e ) { getLog ( ) . debug ( CERTIFICATE_FILE_READ_FAIL + certificate ) ; } return null ; }
Get ApplicationTokenCredentials from server definition in Maven settings . xml