Код: Выделить всё
using Azure.Identity;
using Microsoft.Graph;
using System.Security.Cryptography.X509Certificates;
var scopes = new[] { "https://graph.microsoft.com/.default" };
var clientId = "appID";
var tenantId = "tenantId";
var certificatePath = "C:/MYPATH";
var certificatePassword = "xxxxxxxx";
var clientCertificate = new X509Certificate2(certificatePath, certificatePassword);
var options = new ClientCertificateCredentialOptions
{
AuthorityHost = AzureAuthorityHosts.AzurePublicCloud,
};
var clientCertCredential = new ClientCertificateCredential(
tenantId, clientId, clientCertificate, options);
var graphClient = new GraphServiceClient(clientCertCredential, scopes);
var apps= await graphClient.Directory.DeletedItems.GraphApplication.GetAsync((requestConfiguration) =>
{
requestConfiguration.QueryParameters.Count = true;
requestConfiguration.QueryParameters.Orderby = new string[] { "deletedDateTime asc" };
requestConfiguration.QueryParameters.Select = new string[] { "appId", "DisplayName", "deletedDateTime" };
requestConfiguration.Headers.Add("Consistencylevel", "Eventual");
});
Console.WriteLine($"Total deleted apps: {apps.OdataCount}\n");
foreach (var app in apps.Value)
{
Console.WriteLine($"App ID: {app.AppId}");
Console.WriteLine($"Application Name: {app.DisplayName}");
Console.WriteLine($"Deleted Date and Time: {app.DeletedDateTime}");
Console.WriteLine();
}
Не могли бы вы дать рекомендации, как интегрировать условие фильтра для выборочного восстановления удаленных приложений на основе их имен, начинающихся с «dev»? Будем очень признательны за любую помощь или идеи.
Подробнее здесь: https://stackoverflow.com/questions/781 ... uthenticat
Мобильная версия