Quantcast
Channel: Azure Active Directory forum
Viewing all articles
Browse latest Browse all 16000

Authentication Errors when trying to use .NET Management Libraries for Azure

$
0
0

Followed the Sample below exactly and ran into this issue.

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

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

Looks like the Azure AD wanted a step to exchange the authorization code with the token by specifying client secret. Or may be something else.

So, I updated the code to use client id and client key (key generated on Azure AD Application configuration page) instead like below: (This method doesn't prompt for user creds)

ClientCredential cc = new ClientCredential(ConfigurationManager.AppSettings["clientId"], ConfigurationManager.AppSettings["clientkey"]);
                result = context.AcquireToken(ConfigurationManager.AppSettings["apiEndpoint"], cc);

This time I ran into

 AuthenticationFailed: A security token exception occured for the received JWT token.

I think it may be because I need to specify the token type is Bearer. An equivalent REST API approach uses such a call like below

httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", result.AccessToken);

If I use the other method of authentication which uses the certificate associated with the subscription and creating CertificateCloudCredentials that works. But I want to use the token approach.

Any idea how to go about it ? There are no good samples on using Management Libraries for Azure Automation.



Viewing all articles
Browse latest Browse all 16000

Trending Articles



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