I took one of the code examples you gave and a developer made changes to get it working. The code is as follows "using Microsoft.AspNetCore.Mvc;
using Microsoft.Azure.Cosmos;
using Microsoft.Azure.WebJobs;
using Microsoft.Extensions.Logging;
using Microsoft.Graph;
using Microsoft.IdentityModel.Clients.ActiveDirectory;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http.Headers;
using System.Threading.Tasks;

namespace EmpowerID\_AZ\_Fucntions;

public static class HighRiskGroupDetectionWithCosmosDB
{
 //static string[] highRiskGroups = { "3cd9b53c-c6d9-4c10-8402-a397520199e1" };

 static DateTime lastTimestamp = DateTime.UtcNow.AddHours(-2);

 [FunctionName("HighRiskGroupDetectionWithCosmosDB")]
 public static async Task Run(
 [TimerTrigger("0 \*/5 \* \* \* \*")] TimerInfo myTimer,
 ILogger log)
 {
 log.LogInformation($"HighRiskGroupDetectionWithCosmosDB function executed at: {DateTime.Now}");

 try
 {
 // Initialize the Azure AD Graph client
 GraphServiceClient client = new GraphServiceClient(
 new DelegateAuthenticationProvider(
 async (requestMessage) =>
 {
 string accessToken = await AuthenticationHelper.GetAccessTokenForApplication();
 requestMessage.Headers.Authorization = new AuthenticationHeaderValue("bearer", accessToken);
 }));

 // Initialize the Cosmos DB client
 var cosmosClient = new CosmosClient(Environment.GetEnvironmentVariable("CosmosDbUrl"),
 Environment.GetEnvironmentVariable("CosmosDbAuthKey"), new CosmosClientOptions());

 var container = cosmosClient.GetContainer("HighRiskGroupDetection", "MSGraphContainer");

 // Retrieve the list of high risk groups from the database
 List highRiskGroups = new List();

 var groupList = container.GetItemLinqQueryable(allowSynchronousQueryExecution: true).ToList();
 foreach (var item in groupList)
 {
 highRiskGroups.Add(item.GroupId);
 }

 // Retrieve the change log entries since the last timestamp
 var changeLog = await client.AuditLogs.DirectoryAudits.Request()
 .Filter($"(activityDisplayName eq 'Add member to group') and (activityDateTime ge {lastTimestamp:yyyy-MM-dd})")
 .GetAsync();

 // Check if any new members were added to high risk groups
 if (changeLog != null)
 foreach (var entry in changeLog)
 {
 if (entry.Category == "GroupManagement" && entry.ActivityDisplayName == "Add member to group" && entry.Result == OperationResult.Success)
 {
 var group = entry.TargetResources
 .Where(t => t.Type == "Group" && highRiskGroups.Contains(t.Id)).ToList();
 if (group.Any())
 {
 var user = entry.TargetResources.Where(t => t.Type == "User").ToList();
 if (user.Any())
 {
 log.LogInformation(@"User [" + user[0].UserPrincipalName + "] with id " + user[0].Id +
 " was added to high risk group: " +
 group[0].Id);
 }
 }
 }
 }

 // Update the timestamp
 lastTimestamp = DateTime.UtcNow;
 }
 catch (Exception e)
 {
 Console.WriteLine(e);
 throw;
 }

 return new OkObjectResult("OK");
 }

}
/// 
/// Auth Helper to get the AccessToken for the MS Graph API
/// 
public static class AuthenticationHelper
{
 public static async Task GetAccessTokenForApplication()
 {
 string clientId = Environment.GetEnvironmentVariable("AzureClientId");
 string clientSecret = Environment.GetEnvironmentVariable("AzureClientSecret");
 string tenant = Environment.GetEnvironmentVariable("AzureTenant");

 AuthenticationContext authContext = new AuthenticationContext($"https://login.microsoftonline.com/{tenant}");
 ClientCredential clientCredential = new ClientCredential(clientId, clientSecret);
 AuthenticationResult authResult = await authContext.AcquireTokenAsync("https://graph.microsoft.com", clientCredential);
 return authResult.AccessToken;
 }

}
// Class for the Cosmos DB Objects
public class Group
{
 public string id { get; set; }
 public string DisplayName { get; set; }
 public string GroupId { get; set; }
}"
제공한 코드 예제 중 하나를 개발자가 변경하여 작동하도록 했습니다. 코드는 다음과 같습니다. "Microsoft.AspNetCore.Mvc;
using Microsoft.Azure.Cosmos;
Microsoft.Azure.WebJobs 사용;
Microsoft.Extensions.Logging 사용;
Microsoft.Graph;
using Microsoft.IdentityModel.Clients.ActiveDirectory;
System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http.Headers;
using System.Threading.Tasks;

네임스페이스 EmpowerID\_AZ\_Fucntions;

public static class HighRiskGroupDetectionWithCosmosDB
{
 //static string[] highRiskGroups = { "3cd9b53c-c6d9-4c10-8402-a397520199e1" };

 static DateTime lastTimestamp = DateTime.UtcNow.AddHours(-2);

 [FunctionName("HighRiskGroupDetectionWithCosmosDB")]
 공용 정적 비동기 태스크 실행(
 [TimerTrigger("0 \*/5 \* \* \* \*")] TimerInfo myTimer,
 ILogger log)
 {
 log.LogInformation($"{DateTime.Now}에서 실행된 HighRiskGroupDetectionWithCosmosDB 함수:");

 try
 {
 // Azure AD 그래프 클라이언트 초기화
 GraphServiceClient client = new GraphServiceClient(
 새로운 델리게이트인증프로바이더(
 비동기 (요청 메시지) =>
 {
 문자열 accessToken = await AuthenticationHelper.GetAccessTokenForApplication();
 requestMessage.Headers.Authorization = new AuthenticationHeaderValue("bearer", accessToken);
 }));

 // 코스모스 DB 클라이언트 초기화
 var cosmosClient = new CosmosClient(Environment.GetEnvironmentVariable("CosmosDbUrl"),
 Environment.GetEnvironmentVariable("CosmosDbAuthKey"), new CosmosClientOptions());

 var container = cosmosClient.GetContainer("HighRiskGroupDetection", "MSGraphContainer");

 // 데이터베이스에서 고위험군 목록을 검색합니다.
 List highRiskGroups = new List();

 var groupList = container.GetItemLinqQueryable(allowSynchronousQueryExecution: true).ToList();
 foreach (var item in groupList)
 {
 highRiskGroups.Add(item.GroupId);
 }

 // 마지막 타임스탬프 이후의 변경 로그 항목 검색
 var changeLog = await client.AuditLogs.DirectoryAudits.Request()
 .Filter($"(activityDisplayName eq '그룹에 멤버 추가') 및 (activityDateTime ge {lastTimestamp:yyyy-MM-dd})")
 .GetAsync();

 // 고위험 그룹에 새로운 멤버가 추가되었는지 확인합니다.
 if (changeLog != null)
 foreach (changeLog의 var 항목)
 {
 if (entry.Category == "GroupManagement" && entry.ActivityDisplayName == "그룹에 멤버 추가" && entry.Result == OperationResult.Success)
 {
 var group = entry.TargetResources
 .Where(t => t.Type == "Group" && highRiskGroups.Contains(t.Id)).ToList();
 if (group.Any())
 {
 var user = entry.TargetResources.Where(t => t.Type == "User").ToList();
 if (user.Any())
 {
 log.LogInformation(@"사용자 [" + user[0].UserPrincipalName + "] 아이디가 " + user[0].Id +".
 " 고위험 그룹에 추가되었습니다: " +
 group[0].Id);
 }
 }
 }
 }

 // 타임스탬프 업데이트
 lastTimestamp = DateTime.UtcNow;
 }
 catch (예외 e)
 {
 Console.WriteLine(e);
 throw;
 }

 return new OkObjectResult("OK");
 }

}
/// 
/// MS 그래프 API용 AccessToken을 가져오는 인증 도우미
/// 
공용 정적 클래스 AuthenticationHelper
{
 공용 정적 비동기 Task GetAccessTokenForApplication()
 {
 string clientId = Environment.GetEnvironmentVariable("AzureClientId");
 string clientSecret = Environment.GetEnvironmentVariable("AzureClientSecret");
 문자열 tenant = Environment.GetEnvironmentVariable("AzureTenant");

 AuthenticationContext authContext = new AuthenticationContext($"https://login.microsoftonline.com/{tenant}");
 클라이언트 자격 증명 clientCredential = 새 클라이언트 자격 증명(clientId, clientSecret);
 인증 결과 authResult = await authContext.AcquireTokenAsync("https://graph.microsoft.com", clientCredential);
 반환 authResult.AccessToken;
 }

}
// 코스모스 DB 오브젝트용 클래스
공용 클래스 Group
{
 public string id { get; set; }
 public string DisplayName { get; set; }
 public string GroupId { get; set; }
}"