Quantcast
Viewing all articles
Browse latest Browse all 4189

Trouble in creating Resource group using Rest API

Hi , 

I am trying to create a resource group using the rest api https://msdn.microsoft.com/en-us/library/azure/dn790525.aspx, and created an application as mentioned in https://msdn.microsoft.com/en-us/library/azure/dn790557, I am able to get the token using the method 

context.acquireToken("https://management.core.windows.net/", clientCred,null); then i have set the token in the request header

as connection.setRequestProperty("Authorization", result.getAccessToken()); along with the other properties 

connection.setRequestMethod("PUT");
connection.setRequestProperty("Accept", "application/json");
connection.setRequestProperty("Content-Length", String.valueOf(json_input.length()));
connection.setRequestProperty("api-version", "2015-01-01");

where the JSON input is given as String json_input = "{\"location\": \"Southeast Asia\",\"tags\":{\"tagname1\": \"testtag\"}}";

but when i invoke the rest call , I am getting the following 

Response Code::401

Please help.


Viewing all articles
Browse latest Browse all 4189

Trending Articles