{
  "type": "workflow_collections",
  "macros": [],
  "exported_tags": [
    "Microsoft",
    "azure",
    "azure-log-analytics-v2"
  ],
  "data": [
    {
      "@type": "WorkflowCollection",
      "name": "Sample - Azure Log Analytics v2 - 3.0.0",
      "description": "Use-case playbooks for the \"Azure Log Analytics\" v2 connector: a KQL hunt that saves its query as a saved search when it finds rows. Clone these into your own collection before editing; the sample collection is replaced on connector upgrade.",
      "visible": true,
      "image": null,
      "uuid": "a33a047f-6b09-52d1-9784-eba7e0441bdf",
      "recordTags": [
        "azure-log-analytics-v2",
        "Microsoft",
        "azure"
      ],
      "workflows": [
        {
          "@type": "Workflow",
          "name": "Failed Sign-in Hunt",
          "aliasName": null,
          "tag": "",
          "recordTags": [],
          "description": "Runs a KQL hunt for failed sign-ins and branches on the row count. When the hunt returns rows the query is saved as a Log Analytics saved search (replacing one with the same ID), so analysts can rerun it from the portal. When it returns no rows nothing is saved.\nInputs: query (KQL text, default a failed sign-in summary of the SeedAuth_CL table), saved_search_id (default AzureLogAnalyticsV2FailedSignIns), category and display_name (the saved search's labels). Outputs: outcome (saved or no_rows), row_count, saved_search_id.",
          "isActive": false,
          "debug": true,
          "singleRecordExecution": false,
          "remoteExecutableFlag": 0,
          "parameters": [
            "query",
            "saved_search_id",
            "category",
            "display_name"
          ],
          "synchronous": false,
          "triggerStep": "/api/3/workflow_steps/a5f5ba47-c240-5331-a03b-b612b4dd7a1e",
          "steps": [
            {
              "@type": "WorkflowStep",
              "name": "Start",
              "description": null,
              "arguments": {
                "inputVariables": [
                  {
                    "name": "query",
                    "type": "string",
                    "label": "KQL Query"
                  },
                  {
                    "name": "saved_search_id",
                    "type": "string",
                    "label": "Saved Search ID"
                  },
                  {
                    "name": "category",
                    "type": "string",
                    "label": "Category"
                  },
                  {
                    "name": "display_name",
                    "type": "string",
                    "label": "Display Name"
                  }
                ],
                "title": "Run Failed Sign-in Hunt",
                "resources": [
                  "incidents"
                ],
                "route": "178427dc-7027-5261-9476-aa2c1deb93b5",
                "step_variables": {
                  "input": {
                    "params": {
                      "query": "{{vars.request.data[\"query\"]}}",
                      "saved_search_id": "{{vars.request.data[\"saved_search_id\"]}}",
                      "category": "{{vars.request.data[\"category\"]}}",
                      "display_name": "{{vars.request.data[\"display_name\"]}}"
                    },
                    "records": "{{vars.input.records}}"
                  }
                },
                "triggerOnSource": true,
                "triggerOnReplicate": false,
                "noRecordExecution": true,
                "singleRecordExecution": false,
                "__triggerLimit": true,
                "executeButtonText": "Execute",
                "showToasterMessage": {
                  "visible": false,
                  "messageVisible": true
                },
                "displayConditions": {
                  "incidents": {
                    "sort": [],
                    "limit": 30,
                    "logic": "AND",
                    "filters": []
                  }
                }
              },
              "status": null,
              "top": "120",
              "left": "200",
              "stepType": "/api/3/workflow_step_types/f414d039-bb0d-4e59-9c39-a8f1e880b18a",
              "group": null,
              "uuid": "a5f5ba47-c240-5331-a03b-b612b4dd7a1e"
            },
            {
              "@type": "WorkflowStep",
              "name": "Resolve Inputs",
              "description": null,
              "arguments": {
                "query": "{{ vars.input.params.query | default('SeedAuth_CL | where ResultCode != 0 | summarize Failures = count() by Account, IPAddress | order by Failures desc', true) }}",
                "saved_search_id": "{{ vars.input.params.saved_search_id | default('AzureLogAnalyticsV2FailedSignIns', true) }}",
                "category": "{{ vars.input.params.category | default('Sign-in hunts', true) }}",
                "display_name": "{{ vars.input.params.display_name | default('Failed sign-ins (v2 hunt)', true) }}"
              },
              "status": null,
              "top": "250",
              "left": "200",
              "stepType": "/api/3/workflow_step_types/04d0cf46-b6a8-42c4-8683-60a7eaa69e8f",
              "group": null,
              "uuid": "ae12028f-d835-5912-ba9c-d6b2b12762f0"
            },
            {
              "@type": "WorkflowStep",
              "name": "Run Hunt",
              "description": null,
              "arguments": {
                "connector": "azure-log-analytics-v2",
                "operation": "execute_query",
                "config": "",
                "params": {
                  "query": "{{ vars.query }}"
                },
                "version": "3.0.0",
                "name": "Azure Log Analytics",
                "operationTitle": "Execute Query",
                "step_variables": [],
                "pickFromTenant": false
              },
              "status": null,
              "top": "380",
              "left": "200",
              "stepType": "/api/3/workflow_step_types/0bfed618-0316-11e7-93ae-92361f002671",
              "group": null,
              "uuid": "62eaf926-e40e-56e2-b925-e2809c9c2507"
            },
            {
              "@type": "WorkflowStep",
              "name": "Has Rows",
              "description": null,
              "arguments": {
                "conditions": [
                  {
                    "option": "Hunt returned rows",
                    "condition": "{{ vars.steps.Run_Hunt.data.row_count | default(0) > 0 }}",
                    "step_iri": "/api/3/workflow_steps/1eb71b5b-923c-5d84-ae52-91ac979a125c",
                    "step_name": "Save Query"
                  },
                  {
                    "option": "Else",
                    "default": true,
                    "step_iri": "/api/3/workflow_steps/a1828484-0485-5ec6-b471-09ed8bcd21a0",
                    "step_name": "Mark No Rows"
                  }
                ]
              },
              "status": null,
              "top": "510",
              "left": "200",
              "stepType": "/api/3/workflow_step_types/12254cf5-5db7-4b1a-8cb1-3af081924b28",
              "group": null,
              "uuid": "754e98dd-2f1c-5ff0-bcdf-8ea085268af8"
            },
            {
              "@type": "WorkflowStep",
              "name": "Save Query",
              "description": null,
              "arguments": {
                "connector": "azure-log-analytics-v2",
                "operation": "create_saved_searches",
                "config": "",
                "params": {
                  "savedSearchId": "{{ vars.saved_search_id }}",
                  "category": "{{ vars.category }}",
                  "displayName": "{{ vars.display_name }}",
                  "query": "{{ vars.query }}"
                },
                "version": "3.0.0",
                "name": "Azure Log Analytics",
                "operationTitle": "Create Saved Search",
                "step_variables": [],
                "pickFromTenant": false
              },
              "status": null,
              "top": "640",
              "left": "200",
              "stepType": "/api/3/workflow_step_types/0bfed618-0316-11e7-93ae-92361f002671",
              "group": null,
              "uuid": "1eb71b5b-923c-5d84-ae52-91ac979a125c"
            },
            {
              "@type": "WorkflowStep",
              "name": "Mark Saved",
              "description": null,
              "arguments": {
                "outcome": "saved",
                "row_count": "{{ vars.steps.Run_Hunt.data.row_count }}",
                "saved_search_id": "{{ vars.saved_search_id }}"
              },
              "status": null,
              "top": "770",
              "left": "200",
              "stepType": "/api/3/workflow_step_types/04d0cf46-b6a8-42c4-8683-60a7eaa69e8f",
              "group": null,
              "uuid": "6b5ce936-bb9c-50a5-9eef-16acb577aa58"
            },
            {
              "@type": "WorkflowStep",
              "name": "Mark No Rows",
              "description": null,
              "arguments": {
                "outcome": "no_rows",
                "row_count": 0,
                "saved_search_id": ""
              },
              "status": null,
              "top": "640",
              "left": "540",
              "stepType": "/api/3/workflow_step_types/04d0cf46-b6a8-42c4-8683-60a7eaa69e8f",
              "group": null,
              "uuid": "a1828484-0485-5ec6-b471-09ed8bcd21a0"
            },
            {
              "@type": "WorkflowStep",
              "name": "End Hunt",
              "description": null,
              "arguments": {
                "connector": "cyops_utilities",
                "operation": "no_op",
                "config": "",
                "params": {},
                "version": "3.7.3",
                "name": "Utilities",
                "operationTitle": "Utils: No Operation",
                "step_variables": [],
                "pickFromTenant": false
              },
              "status": null,
              "top": "900",
              "left": "540",
              "stepType": "/api/3/workflow_step_types/0bfed618-0316-11e7-93ae-92361f002671",
              "group": null,
              "uuid": "b63504da-b541-5d40-b055-a07dddd96bcc"
            }
          ],
          "routes": [
            {
              "@type": "WorkflowRoute",
              "name": "Start -> Resolve Inputs",
              "targetStep": "/api/3/workflow_steps/ae12028f-d835-5912-ba9c-d6b2b12762f0",
              "sourceStep": "/api/3/workflow_steps/a5f5ba47-c240-5331-a03b-b612b4dd7a1e",
              "label": null,
              "isExecuted": false,
              "group": null,
              "uuid": "97d591fe-905f-5337-a460-696945aafdd5"
            },
            {
              "@type": "WorkflowRoute",
              "name": "Resolve Inputs -> Run Hunt",
              "targetStep": "/api/3/workflow_steps/62eaf926-e40e-56e2-b925-e2809c9c2507",
              "sourceStep": "/api/3/workflow_steps/ae12028f-d835-5912-ba9c-d6b2b12762f0",
              "label": null,
              "isExecuted": false,
              "group": null,
              "uuid": "4bca9b7f-b965-5800-affd-20d0a8691eaf"
            },
            {
              "@type": "WorkflowRoute",
              "name": "Run Hunt -> Has Rows",
              "targetStep": "/api/3/workflow_steps/754e98dd-2f1c-5ff0-bcdf-8ea085268af8",
              "sourceStep": "/api/3/workflow_steps/62eaf926-e40e-56e2-b925-e2809c9c2507",
              "label": null,
              "isExecuted": false,
              "group": null,
              "uuid": "80527f63-d8b5-5106-bd38-6be95a18353c"
            },
            {
              "@type": "WorkflowRoute",
              "name": "Has Rows -> Save Query",
              "targetStep": "/api/3/workflow_steps/1eb71b5b-923c-5d84-ae52-91ac979a125c",
              "sourceStep": "/api/3/workflow_steps/754e98dd-2f1c-5ff0-bcdf-8ea085268af8",
              "label": "Hunt returned rows",
              "isExecuted": false,
              "group": null,
              "uuid": "4d4d38a1-f77f-56fe-9a4d-5ff4015a1ae5"
            },
            {
              "@type": "WorkflowRoute",
              "name": "Has Rows -> Mark No Rows",
              "targetStep": "/api/3/workflow_steps/a1828484-0485-5ec6-b471-09ed8bcd21a0",
              "sourceStep": "/api/3/workflow_steps/754e98dd-2f1c-5ff0-bcdf-8ea085268af8",
              "label": "Else",
              "isExecuted": false,
              "group": null,
              "uuid": "195df705-6611-5003-8ce0-d61e4cfdc359"
            },
            {
              "@type": "WorkflowRoute",
              "name": "Save Query -> Mark Saved",
              "targetStep": "/api/3/workflow_steps/6b5ce936-bb9c-50a5-9eef-16acb577aa58",
              "sourceStep": "/api/3/workflow_steps/1eb71b5b-923c-5d84-ae52-91ac979a125c",
              "label": null,
              "isExecuted": false,
              "group": null,
              "uuid": "2e6f02b6-d050-50a3-9aa6-b606a2ce2af9"
            },
            {
              "@type": "WorkflowRoute",
              "name": "Mark Saved -> End Hunt",
              "targetStep": "/api/3/workflow_steps/b63504da-b541-5d40-b055-a07dddd96bcc",
              "sourceStep": "/api/3/workflow_steps/6b5ce936-bb9c-50a5-9eef-16acb577aa58",
              "label": null,
              "isExecuted": false,
              "group": null,
              "uuid": "3bf250a0-7552-5d46-a447-76211c2d008c"
            },
            {
              "@type": "WorkflowRoute",
              "name": "Mark No Rows -> End Hunt",
              "targetStep": "/api/3/workflow_steps/b63504da-b541-5d40-b055-a07dddd96bcc",
              "sourceStep": "/api/3/workflow_steps/a1828484-0485-5ec6-b471-09ed8bcd21a0",
              "label": null,
              "isExecuted": false,
              "group": null,
              "uuid": "951f7605-a66d-58eb-87c1-4436c42420fb"
            }
          ],
          "groups": [],
          "priority": "/api/3/picklists/9e8d41e4-8ada-4a2c-bd02-07f62c6d0a00",
          "isEditable": true,
          "uuid": "cbcf34f9-e48b-566f-b1c2-27809d7843c3",
          "isPrivate": false
        }
      ]
    }
  ]
}
