{
    "id": "PaloAltoNetworksCortex",
    "title": "Palo Alto Networks Cortex XDR",
    "publisher": "Palo Alto Networks",
    "descriptionMarkdown": "The Palo Alto Networks Cortex XDR connector gives you an easy way to connect to your Cortex XDR logs with Microsoft Sentinel. This increases the visibility of your endpoint security. It will give you better ability to monitor your resources by creating custom Workbooks, analytics rules, Incident investigation, and evidence gathering.",
    "graphQueries": [
        {
            "metricName": "Total data received",
            "legend": "PaloAltoNetworksCortex",
            "baseQuery": "CommonSecurityLog\n| where DeviceVendor == \"Palo Alto Networks\"\n| where DeviceProduct == \"Cortex XDR\""
        }
    ],
    "sampleQueries": [
        {
            "description" : "All logs",
            "query": "\nCommonSecurityLog\n | where DeviceVendor == \"Palo Alto Networks\"\n | where DeviceProduct == \"Cortex XDR\"\n | sort by TimeGenerated"
        },
		{
			"description" : "Alert By Severity",
			"query": "\nCommonSecurityLog\n | where DeviceVendor == \"Palo Alto Networks\"\n | where DeviceProduct == \"Cortex XDR\"\n | where DeviceAction == \"Prevented (Blocked)\"\n | where LogSeverity =~ \"6\"\n | summarize by TimeGenerated,DeviceProduct, DeviceEventClassID, LogSeverity, Activity, DeviceAction, Computer, DeviceVersion, FileHash, FileName, FilePath, RequestURL, SourceHostName, SourceUserName\n | sort by TimeGenerated"
		}
    ],
    "dataTypes": [
        {
            "name": "CommonSecurityLog (PaloAltoNetworksCortex)",
            "lastDataReceivedQuery": "CommonSecurityLog\n| where DeviceVendor == \"Palo Alto Networks\"\n| where DeviceProduct == \"Cortex XDR\"\n| summarize Time = max(TimeGenerated)\n| where isnotempty(Time)"
        }
    ],
    "connectivityCriterias": [
        {
            "type": "IsConnectedQuery",
            "value": [
                "CommonSecurityLog\n| where DeviceVendor == \"Palo Alto Networks\"\n| where DeviceProduct == \"Cortex XDR\"\n| summarize LastLogReceived = max(TimeGenerated)\n| project IsConnected = LastLogReceived > ago(30d)"
            ]
        }
    ],
    "availability": {
        "status": 1,
        "isPreview": true
    },
    "permissions": {
        "resourceProvider": [
            {
                "provider": "Microsoft.OperationalInsights/workspaces",
                "permissionsDisplayText": "read and write permissions are required.",
                "providerDisplayName": "Workspace",
                "scope": "Workspace",
                "requiredPermissions": {
                    "read": true,
                    "write": true,
                    "delete": true
                }
            },
            {
                "provider": "Microsoft.OperationalInsights/workspaces/sharedKeys",
                "permissionsDisplayText": "read permissions to shared keys for the workspace are required. [See the documentation to learn more about workspace keys](https://docs.microsoft.com/azure/azure-monitor/platform/agent-windows#obtain-workspace-id-and-key).",
                "providerDisplayName": "Keys",
                "scope": "Workspace",
                "requiredPermissions": {
                    "action": true
                }
            }
        ]
    },
    "instructionSteps": [
        {
            "title": "1. Linux Syslog agent configuration",
            "description": "Install and configure the Linux agent to collect your Common Event Format (CEF) Syslog messages and forward them to Azure Sentinel.\n\n> Notice that the data from all regions will be stored in the selected workspace",
            "innerSteps": [
                {
                    "title": "1.1 Select or create a Linux machine",
                    "description": "Select or create a Linux machine that Azure Sentinel will use as the proxy between your security solution and Azure Sentinel this machine can be on your on-prem environment, Azure or other clouds."
                },
                {
                    "title": "1.2 Install the CEF collector on the Linux machine",
                    "description": "Install the Microsoft Monitoring Agent on your Linux machine and configure the machine to listen on the necessary port and forward messages to your Azure Sentinel workspace. The CEF collector collects CEF messages on port 514 TCP.\n\n> 1. Make sure that you have Python on your machine using the following command: python -version.\n\n> 2. You must have elevated permissions (sudo) on your machine.",
                    "instructions": [
                        {
                            "parameters": {
                                "fillWith": [
                                    "WorkspaceId",
                                    "PrimaryKey"
                                ],
                                "label": "Run the following command to install and apply the CEF collector:",
                                "value": "sudo wget -O cef_installer.py https://raw.githubusercontent.com/Azure/Azure-Sentinel/master/DataConnectors/CEF/cef_installer.py&&sudo python cef_installer.py {0} {1}"
                            },
                            "type": "CopyableLabel"
                        }
                    ]
                }
            ]
        },
        {
            "title": "2. Forward Palo Alto Networks (Cortex) logs to Syslog agent",
		"description": "\n\n> 1. Go to [Cortex Settings and Configurations](https://inspira.xdr.in.paloaltonetworks.com/configuration/external-alerting) and Click to add New Server under External Applications.\n\n> 2. Then specify the name and Give public IP of your syslog server in Destination. \n\n> 3. Give Port number as 514 and from Facility field select FAC_SYSLOG from dropdown. \n\n> 4. Select Protocol as UDP and hit Create."
        },
        {
            "title": "3. Validate connection",
            "description": "Follow the instructions to validate your connectivity:\n\nOpen Log Analytics to check if the logs are received using the CommonSecurityLog schema.\n\n>It may take about 20 minutes until the connection streams data to your workspace.\n\nIf the logs are not received, run the following connectivity validation script:\n\n> 1. Make sure that you have Python on your machine using the following command: python -version\n\n>2. You must have elevated permissions (sudo) on your machine",
            "instructions": [
                {
                    "parameters": {
                        "fillWith": [
                            "WorkspaceId"
                        ],
                        "label": "Run the following command to validate your connectivity:",
                        "value": "sudo wget  -O cef_troubleshoot.py https://raw.githubusercontent.com/Azure/Azure-Sentinel/master/DataConnectors/CEF/cef_troubleshoot.py&&sudo python cef_troubleshoot.py  {0}"
                    },
                    "type": "CopyableLabel"
                }
            ]
        },
        {
            "title": "4. Secure your machine ",
            "description": "Make sure to configure the machine's security according to your organization's security policy\n\n\n[Learn more >](https://aka.ms/SecureCEF)"
        }
    ],
    "metadata": {
        "id": "32512c5f-aa20-4d6b-a9e5-f21958cefa63",
        "version": "V2.0",
        "kind": "dataConnector",
        "source": {
            "kind": "solution",
            "name": "PaloAltoXDR"
        },
        "author": {
            "name": "Vikas Chaturvedi"
        },
        "support": {
            "tier": "community",
            "name": "Microsoft",
	    "email": "v-chaturvedi01@outlook.com"
        }
    }
}
