locked
Azure Resource manager details RRS feed

  • Question

  • Hi ,

    Thanks for the input. I referred the link you have provided. Please find the attached screenshot for reference.

    https://msdn.microsoft.com/en-us/library/azure/mt420159.aspx

    In this screenshot explains about virtual machine and list of virtual machines which is available in resource group. We have a REST URL to collect virtual machine information's. This is my code part to collect those information's.

    try{ String url = "https://management.azure.com/subscriptions/<sub_id>/resourceGroups/eGazureDemoRathiGrp/providers/Microsoft.Compute/virtualmachines?api-version==2015-01-01"; String str2 = "D:\\Azure\windows.jks";

    Stirng str3 = "****";

    URL localURL = new URL(url); SSLSocketFactory sslFactory = getSSLSocketFactory(str2, str3); HttpsURLConnection con = (HttpsURLConnection)localURL.openConnection(); con.setSSLSocketFactory(sslFactory); con.setRequestMethod("GET"); InputStream localInputStream = (InputStream)con.getContent(); String str = getStringFromInputStream(localInputStream); localInputStream.close(); } catch (Exception r) { r.printStackTrace(); } private SSLSocketFactory getSSLSocketFactory(String keyStorePath, String keyStorePassword) { KeyStore ks = getKeyStore(keyStorePath, keyStorePassword); KeyManagerFactory keyManagerFactory = null; try { keyManagerFactory = KeyManagerFactory.getInstance("SunX509"); keyManagerFactory.init(ks, keyStorePassword.toCharArray()); SSLContext context = SSLContext.getInstance("TLS"); context.init(keyManagerFactory.getKeyManagers(), null, new SecureRandom()); return context.getSocketFactory(); } catch (NoSuchAlgorithmException e) { System.out.println(e.getMessage()+"==>"+ e); throw new RuntimeException(e.getMessage(), e); } }


    I used the above code to get the information. But it returns 401 error. Please review this code part and give me suggestions.

    Thanks & Regards

    Rathidevi


    rathidevi


    Tuesday, February 9, 2016 2:26 PM

Answers

  • Unfortunately this is not related to Azure API Management product https://azure.microsoft.com/en-us/services/api-management/
    Thursday, February 18, 2016 9:52 PM

All replies

  • Hi ,

    Greetings.

     Thank you for reaching out to us. I am currently researching to gather more information with regards to your request. I shall revert back to you with an update at the earliest.

    Sincerely appreciate your patience.

    Regards,

    Asha

    Wednesday, February 10, 2016 7:26 AM
  • Hi,

    Greetings,

    I would suggest you to use the system.Net.HttpClient.library to make the Http requests rather than simply opening a SSL socket and trying to read the stream.

    Reference:http://blog.davidebbo.com/2015/12/calling-arm-using-plain-rest.html

    Regards,

    Asha

    Thursday, February 11, 2016 10:33 AM
  • Unfortunately this is not related to Azure API Management product https://azure.microsoft.com/en-us/services/api-management/
    Thursday, February 18, 2016 9:52 PM