<!--
  Wazuh 5.0 Microsoft Azure collection, agent-side.

  Starting with Wazuh 5.0 the Wazuh manager no longer collects Azure Log
  Analytics logs directly. The Wazuh module for Azure and the Wazuh module for
  Microsoft Graph run only on a Linux-based Wazuh agent.

  Structure taken from:
  https://documentation.wazuh.com/5.0-beta/cloud-security/azure/platform-and-services.html
  https://documentation.wazuh.com/5.0-beta/user-manual/reference/ossec-conf/wodle-azure-logs.html

  Before this works:
    1. Install the version-pinned Python dependencies listed on the Azure
       platform-and-services page. Do not improvise the versions.
    2. Create the credentials directory and files:
         sudo mkdir -p /var/ossec/wodles/credentials
       Log Analytics and Graph file, exactly two lines:
         application_id = YOUR_APPLICATION_ID
         application_key = YOUR_APPLICATION_KEY
       Storage file, exactly two lines:
         account_name = YOUR_ACCOUNT_NAME
         account_key = YOUR_ACCOUNT_KEY
    3. Lock them down:
         sudo chown root:wazuh /var/ossec/wodles/credentials/SERVICE_NAME_CREDENTIALS
         sudo chmod 640 /var/ossec/wodles/credentials/SERVICE_NAME_CREDENTIALS
    4. Enable the Azure ruleset integration on the dashboard:
       Ruleset Management > Overview, search "Azure", Actions > Enable.

  More than one <request> block is allowed. The module processes each one in
  sequence, so a slow query delays every query behind it.
-->
<ossec_config>

  <wodle name="azure-logs">
    <disabled>no</disabled>
    <run_on_start>yes</run_on_start>

    <log_analytics>
      <auth_path>/var/ossec/wodles/credentials/LOG_ANALYTICS_CREDENTIALS</auth_path>
      <tenantdomain>YOUR_TENANT_DOMAIN</tenantdomain>
      <request>
        <query>AzureActivity</query>
        <workspace>WORKSPACE_ID</workspace>
        <time_offset>1d</time_offset>
      </request>
    </log_analytics>

    <graph>
      <auth_path>/var/ossec/wodles/credentials/GRAPH_CREDENTIALS</auth_path>
      <tenantdomain>YOUR_TENANT_DOMAIN</tenantdomain>
      <request>
        <tag>microsoft-entra_id</tag>
        <query>auditLogs/directoryAudits</query>
        <time_offset>1d</time_offset>
      </request>
    </graph>

    <storage>
      <auth_path>/var/ossec/wodles/credentials/STORAGE_CREDENTIALS</auth_path>
      <container name="insights-logs-auditlogs">
        <blobs>.json</blobs>
        <content_type>json_inline</content_type>
        <time_offset>24h</time_offset>
      </container>
    </storage>
  </wodle>

</ossec_config>
