Создать консоль токенов для хранилища данных IntuneC#

Место общения программистов C#
Ответить
Гость
 Создать консоль токенов для хранилища данных Intune

Сообщение Гость »


Here's the code snippet pulled from Microsoft Learn (https://learn.microsoft.com/en-us/mem/i ... only-auth-)
It seems the line with AuthenticationContext, ClientCredential and SecureClientSecret are depreciated. For example: ClientCredential' is obsolete: 'Use ConfidentialClientApplicationBuilder.WithCertificate or WithClientSecret instead. I cannot get this code snippet to work.

Код: Выделить всё

using System.Security;
using System.Configuration;
using Microsoft.Identity.Client;

class IntuneDataWarehouse
{
public static void Main()
{
Console.WriteLine("Intune Datawarehouse Start");

var applicationId = ConfigurationManager.AppSettings["appId"].ToString();
SecureString applicationSecret = ConvertToSecureStr(ConfigurationManager.AppSettings["appKey"].ToString()); // Load as SecureString from configuration file or secret store (i.e. Azure KeyVault)
var tenantDomain = ConfigurationManager.AppSettings["tenantDomain"].ToString();
var msalContext = new AuthenticationContext($"https://login.windows.net/" + tenantDomain + "/oauth2/token");

AuthenticationResult authResult = msalContext.AcquireTokenAsync(
resource: "https://api.manage.microsoft.com/",
clientCredential: new ClientCredential(
applicationId,
new SecureClientSecret(applicationSecret))).Result;

Console.WriteLine("End of run");
}
Has anyone worked on similar code?


Источник: https://stackoverflow.com/questions/781 ... awarehouse
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «C#»