You can get the access token by executing normal HTTP request using HttpClient:
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("https://login.microsoftonline.com/<your_tenant_id>/oauth2/v2.0/token"),
Content = new FormUrlEncodedContent(new Dictionary<string, string>
{
{ "client_id", "<your_client_id>" },
{ "scope", "https://analysis.windows.net/powerbi/api/.default" },
{ "client_secret", "<your_client_secret>" },
{ "grant_type", "client_credentials" },
}),
};
Reference: https://kalcancode.wordpress.com/2025/02/18/powerbiclient-how-to-get-access-token/