Hello @Samira Ouraga
Posting the resolution form the Original Poster (Samira Ouraga)
I was able to get the token using (Get an access token for a user principal using the Azure CLI)
az account set --subscription <SUBSCRIPTION_ID>
az account set --name "<SUBSCRIPTION_NAME>"
az account get-access-token --resource "https://api.kusto.windows.net" --query "accessToken"
I hope you came across this document?
Access control overview
$tenantId = "your-tenant-id"
$clientId = "your-client-id"
$clientSecret = "your-client-secret"
$resource = "https://kusto.windows.net"
$authContext = New-Object Microsoft.IdentityModel.Clients.ActiveDirectory.AuthenticationContext("https://login.microsoftonline.com/$tenantId")
$credential = New-Object Microsoft.IdentityModel.Clients.ActiveDirectory.ClientCredential($clientId, $clientSecret)
$authResult = $authContext.AcquireTokenAsync($resource, $credential).Result
$accessToken = $authResult.AccessToken