I am trying to get the code from the ServiceSample application from github to work, more specifically the JsonConsoleApplication code.
I have made the App Registration on Azure, and registered the application on the "Azure Active Directory applications" page in D365FO.
I changed these values in the ClientConfiguration.cs file, so they should be correct.
UriString = "https://[myazureserver].cloudax.dynamics.com/"
ActiveDirectoryResource = "https://[myazureserver].cloudax.dynamics.com"
ActiveDirectoryTenant = "login.windows.net/dev.onmicrosoft.com"
ActiveDirectoryClientAppId = "[Should be the right one from Azure]"
ActiveDirectoryClientAppSecret = "[Should be the right one from Azure]"
And in Program.cs line 25 i added the parameter true to GetAuthenticationHeader so it should use web authentication.
Now when I run the program i get the error "The remote server returned an error: (401) Unauthorized." in line 29 "using (var response = (HttpWebResponse)request.GetResponse())"
If I look at the Event Viewer under Dynamics / AX-WebApi I see this error "Web API Owin Authentication Configuration Missing Error", but I have no clue what that means.
Can anyone help me get this to work?