static async Task GetAccessToken()
{
using HttpClient client = new HttpClient();
var response = await client.RequestClientCredentialsTokenAsync(new ClientCredentialsTokenRequest()
{
Address = "https://login.microsoftonline.com/{{TenantId}}/oauth2/v2.0/token",
ClientId = "{{ClientId}}",
ClientSecret = "{{ClientSecret}}",
Scope = "https://{{Tenant}}.onmicrosoft.com/{{ClientId}}/.default"
});
return response.AccessToken;
}