Skip to content

AzureMonitorQueryClient

Minimal Azure Monitor Query REST client: one KQL query against one Log Analytics workspace, nothing else.

Authenticates with a bearer AzureTokenProvider scoped to https://api.loganalytics.io/ — build one via AzureTokenProviderFactory, not AzureCredentialFactory, since this API takes no storage-account-key credential at all.

final class AzureMonitorQueryClient implements AzureMonitorQueryClientInterface

ImplementsAzureMonitorQueryClientInterface
SourceAzureMonitorQueryClient.php

public function __construct(ClientInterface $httpClient, AzureTokenProvider $tokenProvider, string $workspaceId, string $endpoint = 'https://api.loganalytics.io', Psr17Factory $psr17 = new Psr17Factory(…)): mixed

ParameterTypeDescription
$httpClientClientInterface
$tokenProviderAzureTokenProvider
$workspaceIdstring
$endpointstring
$psr17Psr17Factory

Returns mixed

MethodDescription
query(string $kql): list<array<string, mixed>>Runs $kql and returns its primary result table as one row per array, keyed by column name.

public function query(string $kql): list<array<string, mixed>>

Runs $kql and returns its primary result table as one row per array, keyed by column name.

An empty result set (including a query with no tables at all) is an empty list, not an error.

ParameterTypeDescription
$kqlstring

Returns list``<``array``<``string``, ``mixed``>``>

ThrowsWhen
AzureStorageExceptionOn a non-2xx response, a transport failure that survived the retries, or a response body that was not the JSON shape this expects.