I am currently connecting to Microsoft Endpoint Configuration Manager (MECM) using HttpClient which use a HttpClientHandler to set credentials via Negotiate.
This works fine on Windows machines but when it comes to run on Linux i dont have a trust between the container and the Windows server.
I am trying to understand if there is a better way to authenticate such as generating a bearer token.
var credentialsCache = new CredentialCache();
credentialsCache.Add(new Uri(rootBaseUrl), WindowAuthenticationMechanisms.Negotiate,
new NetworkCredential(username, password));
var handler = new HttpClientHandler()
{
Credentials = credentialsCache,
PreAuthenticate = true
};
var httpClient = new System.Net.Http.HttpClient(handler)
{
Timeout = new TimeSpan(0, 0, 10),
BaseAddress = new Uri(baseUrl)
};
MECM server base endpoints I am using are:
https://<SCCMServerFQDN>/AdminService/wmi/
https://<SCCMServerFQDN>/AdminService/v1.0/
Any advice how I can use similar code on linux, without having to setup a trust as it will be a bit of nightmare when doing within a container.
Thanks in advance