Quantcast
Channel: Azure Management Portal forum
Viewing all articles
Browse latest Browse all 4189

Issues in getting valid AD token

$
0
0

I've been trying to follow the approach used in "Get Started with the Management Libraries for .NET".

However, the code copied verbatim, obviously filling in the appropriate inputs, doesn't work. It gets the following error:

AADSTS90014: The request body must contain the following parameter: 'client_secret or client_assertion'.

Trying an approach found on Google (which I also cannot link due to forum restrictions), I modified the code to:

var result = authenticationContext.AcquireToken("https://management.core.windows.net/",
		new ClientCredential("id", "secret"));

This gets rid of that error, but now there's a new errror:

ForbiddenError: The server failed to authenticate the request. Verify that the certificate is valid and is associated with this subscription.

That comes up when trying to access anything via the .NET API. If I try and make an HTTP request myself, I can seemingly get something more. For example, if trying to make a request to get the VM sizes in an area (chosen because there's no reason for such a request to fail), with

https://management.azure.com/subscriptions/<sub id>/providers/Microsoft.Compute/locations/WestUs/vmSizes?api-version=2015-05-01-preview

Ends up getting the error:

{"error": {"code": "AuthorizationFailed","message": "The client '<some ID>' with object id '<the same ID>' does not have authorization to perform action 'Microsoft.Compute/locations/vmSizes/read' over scope '/subscriptions/<sub ID>'."
  }
}

The documentation does not mention any specific requirements for this call, so presumably the authorization in general is bonked.

Please help. It seems like literally everything on the MSDN where Azure is concerned for getting started with managing VMs programmatically is broken or outdated or something. Perhaps of note is that I'm still using the free MSDN subscription trial (which caused other cryptic issues in the past).

For context, at this point of time, I am merely trying to be able to create a VM programmatically and start/stop it. Yet I have not had any luck achieving this expectedly simple task.

Viewing all articles
Browse latest Browse all 4189

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>