/process-task-mining:mining-setup [--sources <pa,m365,azmon,dv>] [--environment <env-id>] [--workspace <id>] [--time-window <ISO-start/ISO-end>]from process-task-mining
Interactive multi-stage wizard that captures log source configuration, environment IDs, time window, and auth requirements, producing a mining-context.json for downstream commands.
Ships in process-task-mining. Installing the plugin adds it to Claude Code.
Capture all configuration needed for a process mining engagement and produce a mining-context.json that downstream commands (/log-extract, /process-discover, etc.) can reference via --context mining-context.json.
Ask the user which log sources to include in the mining scope. Present as multi-select:
Record selected sources as sources[] in context.
Run these checks automatically using Azure CLI:
2a. Confirm signed-in tenant and subscription:
az account show --query "{tenantId:tenantId, subscription:name, user:user.name}" -o table
If not logged in, prompt the user to run az login before continuing.
2b. Check tenant licensing (affects UAL retention):
az rest --url "https://graph.microsoft.com/v1.0/subscribedSkus" \
--query "value[].{skuPartNumber:skuPartNumber, consumed:consumedUnits}" \
-o table
Look for ENTERPRISEPREMIUM (E5) or INFORMATION_PROTECTION_COMPLIANCE (E5 Compliance). If neither found:
mining-context.json as "ualRetentionDays": 180.2c. Check required permissions (based on selected sources):
For M365 Audit (AuditLog.Read.All):
az rest --url "https://graph.microsoft.com/v1.0/me/appRoleAssignments" \
--query "value[?contains(principalDisplayName, 'AuditLog')].principalDisplayName" -o tsv
If permission check is inconclusive, note that permission errors will surface during /log-extract with specific error codes.
For Azure Monitor: az monitor log-analytics workspace list --query "[].name" -o tsv (if this succeeds, Reader role is confirmed).
2d. For Power Automate — verify environment access:
az rest \
--url "https://api.powerplatform.com/appmanagement/environments?api-version=2022-03-01-preview" \
--resource "https://api.powerplatform.com" \
--query "value[].{name:name, displayName:properties.displayName}" -o table
For each selected source, ask targeted questions:
correlation.clientTrackingId (recommended for correlated flows), or raw run GUID, or extract trigger output field (specify field name)?FileAccessed, FileModified) or all operations in selected record types?objectId, or a custom field in auditData)Check if UAL is enabled:
# PowerShell check (if available)
Get-AdminAuditLogConfig | Select-Object UnifiedAuditLogIngestionEnabled
If PowerShell not available, proceed and note that disabled UAL will return zero results.
AzureActivity / AuditLogs / SigninLogs / custom table name?CorrelationId (recommended for ARM operations) or a custom field?https://contoso.crm.dynamics.comopportunity, incident, cr123_customtable)_regardingobjectid_value, recommended) or a specific lookup field?Verify Dataverse audit is enabled at all three levels:
az rest \
--url "https://{org}.{region}.dynamics.com/api/data/v9.2/organizations?select=isauditenabled" \
--resource "https://{org}.{region}.dynamics.com" | jq .value[0].isauditenabled
4a. Select time window: Ask for start and end date. Validate:
4b. Volume probe (per source):
Run a small probe query returning only 10 records and extract total count from response headers or OData @odata.count. Estimate total records:
For M365 Audit — create a query with $top=1 and check response for @odata.count header.
For Power Automate — $top=10 and multiply by days/probe-days.
For Azure Monitor — add | count to KQL query before retrieving full results.
For Dataverse — add $count=true to OData query.
Volume warnings:
200,000 events: strong warning — recommend batching; confirm proceed
Ask:
mining).pbix-ready formatted version with date table and measures?Write a mining-context.json file in the current directory:
{
"version": "1",
"generatedAt": "2026-03-02T10:00:00Z",
"tenantId": "<tenant-id>",
"signedInAs": "<upn>",
"ualRetentionDays": 365,
"timeWindow": {
"start": "2026-02-01T00:00:00Z",
"end": "2026-03-01T00:00:00Z"
},
"sources": {
"powerAutomate": {
"enabled": true,
"environmentId": "<env-id>",
"flowIds": ["<flow-id-1>"],
"granularity": "flow-level",
"caseIdField": "clientTrackingId"
},
"m365Audit": {
"enabled": true,
"recordTypeFilters": ["SharePointFileOperation"],
"operationFilters": ["FileModified", "FileUploaded"],
"caseIdField": "objectId"
},
"azureMonitor": {
"enabled": false
},
"dataverse": {
"enabled": false
}
},
"output": {
"filePrefix": "mining",
"exportPAProcessMiningFormat": true,
"exportPowerBI": false
},
"estimatedEventVolume": 4500,
"warnings": []
}
Print a setup summary and tell the user: "Setup complete. Run /log-extract --context mining-context.json to extract event logs."
Files this command reads when invoked
What the command file sets; muted values are Claude Code's defaults
7-day visitors to each command page
6 commands in this plugin
/conformance-checkCompare actual event log against a reference process specification and produce a conformance report with fitness score and deviation details./log-extractPull raw events from one or more Microsoft log sources and normalize to a unified event log CSV aligned with the PA Process Mining ingestion format./performance-analyzeAnalyze throughput time, waiting time, bottlenecks, and rework in an event log CSV. Produces a structured performance report with Mermaid diagram.npx claudepluginhub thelobbi/claude-m --plugin process-task-miningOther plugins' commands for the same job