take clause so result sets stay capped at a safe row limit.
Prerequisites
- Azure subscription with at least one Log Analytics Workspace collecting logs
- A Microsoft Entra ID (Azure AD) app registration authorized to query the workspace
- The Log Analytics Reader role granted on the workspace (or its resource group / subscription) to the app’s service principal
- Network access from the HealOps environment to
https://api.loganalytics.io(or the sovereign cloud equivalent) over HTTPS
Setup
Option 1: Environment variables
Add to your.env:
Option 2: Persistent store
Credentials are persisted to~/.config/healops/integrations.json with 0o600 permissions:
Getting credentials
1. Find the Workspace ID
- In the Azure portal, open Log Analytics workspaces and select your workspace.
- On the workspace Overview page, copy Workspace ID (a GUID).
2. Register an Azure AD application
- Open Microsoft Entra ID → App registrations → New registration.
- Give the app a name (e.g.
healops-log-analytics) and register it as a single-tenant app. - From the app’s Overview page, copy the Application (client) ID and the Directory (tenant) ID.
- Open Certificates & secrets → New client secret, copy the secret value (it is shown only once).
3. Grant Log Analytics Reader on the workspace
- Open the Log Analytics workspace in the portal.
- Go to Access control (IAM) → Add → Add role assignment.
- Pick the Log Analytics Reader role and assign it to the service principal created above.
4. Obtain a bearer token (client credentials flow)
AZURE_LOG_ANALYTICS_TOKEN. Tokens expire (usually after 60 minutes) — see the Token rotation note in Security best practices.
Investigation tool
HealOps exposes one tool against an Azure Monitor workspace:query_azure_monitor_logs
POSTs a KQL query to <endpoint>/v1/workspaces/<workspace_id>/query and returns the first table flattened into row dicts.
Arguments the planner supplies:
query— KQL query text. If omitted, HealOps falls back toAppTraces | order by TimeGenerated desc | take <limit>.time_range_minutes— sent as thetimespan(PT<N>M); defaults to60.limit— per-query row cap; defaults to50and is clamped tomax_results(hard limit200).
| take <limit> clause to the query if one is not present, so the workspace never returns more rows than the configured cap.
Verify
azure as the source and inspect the resulting evidence.
Example KQL queries
Recent application errors:Troubleshooting
Security best practices
- Use a dedicated app registration for HealOps — do not reuse a personal token or a broadly-scoped service principal.
- Grant only Log Analytics Reader on the workspace; HealOps only needs read access to query data.
- Keep the client secret out of source control — store it in
.envor in a secret manager and only export it long enough to mint a token. - Rotate the bearer token before its 60-minute expiry. Long-lived deployments should re-mint the token from the client secret on a schedule rather than pasting a static token into
.env. - The integration is read-only: HealOps only issues
POST /v1/workspaces/<id>/queryrequests with atake-bounded KQL string.
Tracer