Hot questions for Using Azure in linux

Question:

Simply when I run this code:

Configuration azureConfig = ManagementConfiguration.configure(
    new URI("https://management.core.windows.net/"), 
    "asdasdasd",
    "server.keystore",
    "asdasdasd",
    KeyStoreType.jks
);
ManagementClient client = ManagementService.create(azureConfig);
LocationsListResponse response = client.getLocationsOperations().list();
ArrayList locations = response.getLocations();

for( int i=0; i<locations.size(); i++){
    System.out.println(((LocationsListResponse.Location)locations.get(i)).getDisplayName());
}

I get this:

00:52:04 [SEVERE] java.lang.RuntimeException: Service or property not registered: com.microsoft.windowsazure.management.ManagementClient interface com.microsoft.windowsazure.management.ManagementClient
00:52:04 [SEVERE]     at com.microsoft.windowsazure.core.DefaultBuilder.build(DefaultBuilder.java:197)
00:52:04 [SEVERE]     at com.microsoft.windowsazure.Configuration.create(Configuration.java:113)
00:52:04 [SEVERE]     at com.microsoft.windowsazure.management.ManagementService.create(ManagementService.java:46)
00:52:04 [SEVERE]     at {LINE OF CODE THAT CONTAINS ManagementClient client = ManagementService.create(azureConfig);}

On internet there's only 1 question about this, about Android and don't has a clear reply... Has someone solved this problem?

I run it under OpenLogic 6.5 (based on CentOS) in a Virtual Machine from Azure with Java 1.8.

EDIT: I created a new project and launched it from eclipse. I get the correct results but when I launch it from command line (java -jar test.jar) i receive exactly the same error.


Answer:

I also faced similar issue. Explicitly setting context class loader solved the problem

// Get current context class loader
ClassLoader contextLoader = Thread.currentThread().getContextClassLoader(); 
// Change context classloader to class context loader   
Thread.currentThread().setContextClassLoader(AzureManagementServiceDelegate.class.getClassLoader)); 
try { 
     // Call Azure API and reset back the context loader 
} catch (Exception e) {
    // handle exceptions  
} finally {
 // Reset back class loader
Thread.currentThread().setContextClassLoader(contextLoader); 
}

Question:

I use Azure to host my App Service (which is basically a Java Spring Boot project that allow to call an endpoint), and since I added a firewall (there is sensible data) and added the VNet to the App Service - Access Restrictions I cannot anymore deploy using the cmd.exe command lines.

The error is this: [ERROR] Failed to execute goal com.microsoft.azure:azure-webapp-maven-plugin:1.7.0:deploy (default-cli) on project myProject: ipSecurityRestrictions.ipAddress is required and cannot be null. -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

Of course, the link they provide if not helpful at all... I tried updating the version of dependencies I use in my pom.xml but no success. I tried adding different restrictions in the scm (deployment) access restrictions but no changes too.

As I saw in the Resource Explorer, the only ipAdress that could be missing is the one of the VNet but damn it do not require one, plus, if I try to manually add it it says that it is not allowed for VNet access restriction.

I read this documentation to setup the deployment and it worked perfectly before I need to add the VNet to the Access Restrictions.

If any of you just have a little idea on something I didn't already tried I'll be happy to hear it!

Thank you


Answer:

I had a lot of discussions with Microsoft engineers and then the new plugin version of azure-webapp-maven-plugin 1.8 released in end October 2019 solved the issue...

Question:

I'm trying to deploying java application on Linux machine which uses Azure SQL database as datastore.

With SQL Authentication method for DB connection, I was able to successfully deploy the app.

However, one of the the requirement of the project is to uses Active directory to support Active Directory Authentication for DB connection.

So what I'm trying to do is basically, deploying and running the application on linux machine(ubuntu) with connection to Azure SQL Database through Active Directory Authentication rather than SQL authentication, which authenticate DB user via Active directory.

I'm pretty sure it will work if we deploying the app on window machine, but challenge part is to use linux machine as application server.

I have tried to find any good references on the web but couldn't find which satisfies my requirement.

So I'm not sure if it is even possible to achieve the goal. if so, could anyone provide any good references??

Thank you


Answer:

one of the the requirement of the project is to uses Active directory to support Window authentication for DB connection.

Based on my understanding, you use Azure SQL database(Paas), unfortunately, now, Azure SQL does not support Windows Authentication. Please check this question.

On your scenario, you could use Active Directory integrated authentication.

You could add an Azure Active Directory user/group as an Azure SQL Administrator. Then you could use this user/group to login your SQL with AD Authentication.