Get information about all the resources in my Azure Subscription using the JAVA API

I am looking for something similar to, but using JAVA rest API calls. I want to get a list of all resources (including virtual machines, storage disks, network devices, etc.) and their main properties (such as ip address, disk space, etc.), I tried to make API calls after this link .

When I make an http request to this url

"https://management.azure.com/subscriptions/"+subscriptionId+"/resourceGroups/"+resourceGroupName+"/providers/Microsoft.Compute/virtualMachines?api-version="+apiVersion 

But I get error 401. Am I calling the correct URL? if not which URL should I call?

+2
java azure
source share
1 answer

But I get error 401. Am I calling the correct URL? if not which URL should I call?

You are calling the correct URL, however you are providing invalid parameters to the API call. link you talked about is for making calls to the Azure Service Management API , however what you need to do is make the Azure Resource Manager (ARM) API .

Like the Azure Service Management APIs, ARM API requests must be authenticated. In the case of the first request, the requests are authenticated using a management certificate. In the case of the latter, you will need to use the token that you get by authenticating the user from Azure AD.

For more information about authentication / authorization of ARM API requests, see this link: https://azure.microsoft.com/en-us/documentation/articles/resource-manager-api-authentication/ .

To list all the resources in a resource group, you can definitely use the ARM REST API. However, SDKs are now available for you, which you can use directly. To learn more about these SDKs, follow this link: https://azure.microsoft.com/en-in/blog/azure-resource-manager-preview-sdks/ .

+2
source share

All Articles