Skip to content
KitploitKITPLOIT
工具博客
提交
工具博客
提交

黑客、渗透测试和网络安全工具,武装您的安全武器库!

Kitploit 是一个黑客、网络安全和渗透测试工具的目录。发现最新的项目更新,查找漏洞、分析系统、自动化测试并加强你的安全。

··订阅源·联系·隐私·© 2026 Kitploit

工具目录

分类

查看所有分类
Loading categories
DFIR-O365RC — 用于收集 Office 365 和 Azure 日志的 PowerShell 模块 | Kitploit
工具/GitHubGitHub/anssi-fr/dfir-o365rc
取证分析数字取证云安全事件响应日志分析
GitHubanssi-fr/dfir-o365rc

DFIR-O365RC

用于收集 Office 365 和 Azure 日志的 PowerShell 模块

查看仓库
2823411个月前Kitploit 审核通过

最受欢迎

查看全部 →

发现我们社区最常用的工具。

探索所有工具

浏览我们的工具集合

查看所有工具 →
分享

DFIR-O365RC

Publish Docker image to Dockerhub Publish module to PowerShell Gallery


目录

  1. 模块描述
  2. 安装和先决条件
    1. 使用 Docker
    2. 手动安装
  3. 管理 DFIR-O365RC 应用程序
    1. 创建应用程序
    2. 更新应用程序
    3. 移除应用程序
  4. 权限和许可证要求
  5. 模块包含的函数
  6. 生成的文件

DFIR-O365RC 在 SSTIC 2021(信息技术与通信安全研讨会)上进行了展示。演示文稿的幻灯片和录制视频(法文)可在此处获取:链接。

⚠️ 2024年3月31日,Microsoft 弃用了 我们用于 DFIR-O365RC 的身份验证方法。因此,我们于2024年8月发布了 2.0.0 版本,其中包含关于身份验证的重大变更以及全局代码重构。⚠️

模块描述

DFIR-O365RC PowerShell 模块是一组函数,帮助取证分析师收集与 Microsoft 365 入侵相关的日志,并进行 Entra ID 调查。

日志以 JSON 格式生成,并从两个主要数据源获取:

  • Microsoft 365 统一审核日志;
  • Microsoft Entra 登录日志和审核日志。

这两个数据源可以通过不同的端点进行查询:

* Office 365 Management API 旨在与 SIEM 实时分析数据。DFIR-O365RC 是取证工具,其目的并非实时监控 Microsoft 365 环境。

DFIR-O365RC 将从以下来源获取数据:

  • 使用 Microsoft Graph PowerShell 获取 Microsoft Entra 日志(性能良好,是对 Microsoft Graph REST API 的封装);
  • 默认情况下,使用 Exchange Online PowerShell 获取统一审核日志:尽管性能较差,但这是目前唯一可用的选项;
  • 可选地,使用 Purview 获取统一审核日志。保留期为 180 天,性能良好,但该功能仍处于测试阶段,后端存在错误,目前尚不可用。

如果您正在调查 Microsoft 365 恶意活动,Search-O365(来自 Exchange Online PowerShell)还会获取邮箱审核日志,不过 Search-MailboxAuditLog cmdlet 即将被弃用。

如果您正在调查其他 Azure 资源,使用 DFIR-O365RC 可以:

  • 使用 Az.Monitor PowerShell 模块 获取 Azure Monitor 活动日志,保留期为 90 天。此日志重点关注 Azure Resource Manager 中的活动(与 Azure 订阅相关);
  • 使用 Azure DevOps Services REST API 获取 Azure DevOps 审核日志,保留期为 90 天。此日志重点关注 Azure DevOps 中的活动(与 Azure DevOps 组织相关)。

安装和先决条件

使用 Docker

这是推荐使用 DFIR-O365RC 的方式

只需输入:```bash sudo docker pull anssi/dfir-o365rc:latest sudo docker run --rm -v .:/mnt/host -it anssi/dfir-o365rc:latest

root@kitploit:~
DFIR-O365RC 已准备好使用:```bash
PowerShell 7.4.2
DFIR-O365RC: PowerShell module for Microsoft 365 and Entra ID log collection
https://github.com/ANSSI-FR/DFIR-O365RC
PS /mnt/host/output>

如果您希望手动构建Docker镜像,请克隆仓库并使用 docker compose(或旧版 docker-compose)来构建镜像、运行容器并挂载卷(在 output/ 文件夹中):```bash sudo docker compose build dfir-o365rc sudo docker compose run dfir-o365rc

using legacy Compose V1

sudo docker-compose run dfir-o365rc

root@kitploit:~
### 使用 PowerShell

您可以安装此模块到 *PowerShell Desktop*(桌面版)和 *PowerShell Core*(核心版)。

请注意,`Connect-ExchangeOnline` cmdlet [需要 Microsoft .NET Framework 4.7.2 或更高版本](https://learn.microsoft.com/en-us/powershell/exchange/exchange-online-powershell-v2?view=exchange-ps#windows)。

要从 PowerShell 库安装该模块:```powershell
Install-Module -Name DFIR-O365RC

您也可以通过克隆DFIR-O365RC仓库来手动安装模块,安装所需的依赖项(查看DFIR-O365RC.psd1),并将DFIR-O365RC目录添加到PowerShell的模块路径之一。

管理DFIR-O365RC应用程序

创建应用程序

导入模块后,您需要创建一个Entra应用程序,该程序将为您处理日志收集过程。

步骤如下:

  1. 创建自签名证书并获取Base64编码的公共部分:

    在Linux上,使用PowerShell Core或Docker容器: ```bash openssl req -new -x509 -newkey rsa:2048 -sha256 -days 365 -nodes -out exampleDFIRO365RC.crt -keyout exampleDFIRO365RC.key -batch openssl pkcs12 -inkey exampleDFIRO365RC.key -in exampleDFIRO365RC.crt -export -out exampleDFIRO365RC.pfx # Enter a password for the certificate openssl x509 -in exampleDFIRO365RC.crt -outform DER -out - | base64 | tr -d "\n"

    root@kitploit:~

在 Windows 上,使用 PowerShell: ```powershell $certificate = New-SelfSignedCertificate -Subject "CN=exampleDFIRO365RC" -KeySpec KeyExchange -NotBefore (Get-Date) -NotAfter (Get-Date).AddDays(365) $certificatePassword = Read-Host -MaskInput "Please enter a password for the certificate" $certificateSecurePassword = ConvertTo-SecureString -String $certificatePassword -AsPlainText -Force Export-PfxCertificate -Cert $certificate -FilePath exampleDFIRO365RC.pfx -Password $certificateSecurePassword Write-Host ([System.Convert]::ToBase64String($certificate.GetRawCertData()))

root@kitploit:~
2) 使用 DFIR-O365RC 模块中的 `New-Application` cmdlet:   ```powershell
$certificateb64="<base64-encoded public part from step 1>"
New-Application -certificateb64 $certificateb64

可选地,如果您希望能够在租户的订阅中收集日志(如果您不打算使用 Get-AzRMActivityLogs,则不需要此操作): ```powershell New-Application -certificateb64 $certificateb64 -subscriptions

root@kitploit:~
可选地,如果您希望能够收集租户的 Azure DevOps 组织中的日志(这可能需要很长时间,如果您不打算使用 `Get-AzDevOpsActivityLogs`,则不需要这样做):   ```powershell
New-Application -certificateb64 $certificateb64 -organizations

To create the application, you will need to log in to Azure several times, using a highly privileged account.

One the application is created, you will get an output similar to: ```powershell Done creating the application with the required permissions Please use the following identifiers: WARNING: AppID: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx WARNING: Tenant: example.onmicrosoft.com

root@kitploit:~
### 更新应用程序

应用程序创建后,您仍然可以使用模块中的 `Update-Application` cmdlet 更新其凭据和权限:

- 您可以为应用程序添加新证书:

`Update-Application -certificateb64 <base64-encoded public part>`

- 您可以指定新的订阅,以便在其中收集日志:

`Update-Application -subscriptions`

- 您可以指定新的 Azure DevOps 组织,以便在其中收集日志:

`Update-Application -organizations`

- 您可以更新应用程序的权限,这在您拥有旧应用程序且权限自创建以来已更新时特别有用:

`Update-Application -permissions`

### 删除应用程序

完成日志收集后,您可以使用模块中的 `Remove-Application` cmdlet 删除应用程序。

要删除应用程序,您需要使用**高权限**帐户多次登录 Azure。

如果应用程序能够收集订阅或 Azure DevOps 组织的日志,您需要添加 `-organizations` 和/或 `-subscriptions` 开关。

## 权限和许可证要求

⚠️

从 2.0.0 版本开始,该工具现在在服务主体的上下文中运行,该服务主体具有[仅应用访问/应用程序权限](https://learn.microsoft.com/en-us/entra/identity-platform/permissions-consent-overview#app-only-access-access-without-a-user)。

要使用 2.0.0 及更高版本,您需要[创建应用程序](#creating-the-application)。

创建应用程序后,脚本将使用应用程序的凭据和权限运行。

⚠️

应用程序将以可能的最小权限集创建:

- `Exchange.ManageAsApp` 用于 `Office 365 Exchange Online` API(需要能够运行 Exchange Online PowerShell cmdlet)
- `AuditLog.Read.All` 用于 `Microsoft Graph` API(需要用于 Microsoft Entra 日志收集)
- `AuditLogsQuery.Read.All` 用于 `Microsoft Graph` API(需要用于使用 Purview 的统一审计日志收集)
- `Application.Read.All` 和 `DelegatedPermissionGrant.Read.All` 用于 `Microsoft Graph` API(需要用于与应用程序和服务主体相关的 Microsoft Entra 日志的丰富)
- `Device.Read.All` 用于 `Microsoft Graph` API(需要用于与设备相关的 Microsoft Entra 日志的丰富)
- `User.Read.All` 用于 `Microsoft Graph` API(需要获取用户信息)
- `UserAuthenticationMethod.Read.All` 用于 `Microsoft Graph` API(需要获取用户身份验证方法的信息)
- `Organization.Read.All` 用于 `Microsoft Graph` API(需要获取租户的常规信息)
- `Exchange Online` 中的 `仅查看审核日志`(需要使用 `Search-UnifiedAuditLog` cmdlet)

可选(如果使用 `-subscriptions` 开关):

- 对于选定的订阅子集:`Microsoft.Insights/eventtypes/*` 上的 `读者` 角色(需要获取 Azure Monitor 活动日志)

可选(如果使用 `-organizations` 开关):

- 对于选定的 Azure DevOps 订阅子集:`查看审核日志`(需要获取 Azure DevOps 审核日志)

为了使用 Microsoft Graph API 检索 Microsoft Entra 日志,您需要至少有一个用户拥有 [Microsoft Entra ID P1](https://www.microsoft.com/en-us/security/business/microsoft-entra-pricing) 许可证。此许可证可以单独购买,也可以包含在某些许可证计划中,例如 *Microsoft 365 Business Premium* 计划。

## 模块中包含的函数

该模块有 10 个函数:

| **函数**  | **数据源**  | 保留期 | **性能**  | **完整性** | **详细信息** |
| --- | --- | --- | --- | --- | --- |
| `Get-O365Full` | 统一审计日志 | 90 天 / 180 天* | 差 | 所有统一审计日志 | 默认情况下,检索整个统一审计日志。这仅适用于小型租户或短时间段。<br />您也可以使用此 cmdlet 收集某些特定[记录类型](https://learn.microsoft.com/en-us/office/office-365-management-api/office-365-management-activity-api-schema#enum-auditlogrecordtype---type-edmint32)的事件。 |
| `Get-O365Light` | 统一审计日志 | 90 天 / 180 天* | 良好 | 仅统一审计日志的子集 | 仅检索被认为感兴趣的*操作*子集。 |
| `Get-O365Defender` | 统一审计日志 | 90 天 / 180 天* | 良好 | 仅统一审计日志的子集 | 检索与 Microsoft Defender for Office 365 相关的事件。需要至少一个 [Office 365 E5](https://www.microsoft.com/en-us/microsoft-365/enterprise/office-365-e5?activetab=pivot:overviewtab) 许可证或包含 Microsoft Defender for Office 365 的许可证计划。 |
| `Get-AADLogs` | Microsoft Entra 日志 | 30 天 | 良好 | 所有 Microsoft Entra 日志 | 获取租户信息和所有 Microsoft Entra 日志:登录日志和审计日志。 |
| `Get-AADApps` | 不适用 | 不适用 | 良好 | 完整 | Microsoft Entra ID 服务主体及其应用程序、oauth2PermissionGrants 和 appRoleAssignments |
| `Get-AADDevices` | 不适用 | 不适用 | 良好 | 完整 | Microsoft Entra ID 设备及其所有者/用户 |
| `Get-AADUsers` | 不适用 | 不适用 | 良好 | 完整 | Microsoft Entra ID 用户及其身份验证方法 |
| `Search-O365` | 统一审计日志 / 邮箱审计日志** | 90 天 / 180 天* | 差 | 仅统一审计日志的子集 | 搜索与特定用户、IP 地址或自由文本相关的活动。 |
| `Get-AzRMActivityLogs` | Azure Monitor 活动日志 | 90 天 | 良好 | 所有 Azure Monitor 活动日志 | 获取选定订阅子集的所有 Azure Monitor 活动日志。 |
| `Get-AzDevOpsActivityLogs` | Azure DevOps 审核日志 | 90 天 | 良好 | 所有 Azure DevOps 审核日志 | 获取选定 Azure DevOps 组织子集的所有 Azure DevOps 审核日志。 |

\* 您可以使用 Purview 获取 180 天的保留期,而 Exchange Online 的默认保留期为 90 天。

\** 搜索用户时,`Search-O365` cmdlet 还会在邮箱审计日志中搜索。

每个函数都有基于注释的帮助,您可以使用 *Get-Help* cmdlet 调用。```powershell
# Display comment-based help
PS> Get-Help Get-O365Full
# Display comment-based help with examples
PS> Get-Help Get-O365Full -Examples

每个函数接受以下参数:

  • 开始日期(-startDate);
  • 结束日期(-endDate);
  • 应用的应用程序标识符(-appId),该标识符在创建应用程序时获得;
  • 租户名称(-tenant);
  • PFX格式证书的路径(-certificatePath),该证书在创建应用程序时获得。

示例:

为了可读性,我们假设:```powershell $appId = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" $tenant = "example.onmicrosoft.com" $certificatePath = "./example.pfx"

root@kitploit:~
在实际案例中,这些参数是在[创建应用程序](#creating-the-application)时收集的。



为了检索过去30天的Microsoft Entra Logs以及关于租户的通用信息:```powershell
$endDate = Get-Date
$startDate = $endDate.AddDays(-30)
Get-AADLogs -startDate $startDate -endDate $endDate -appId $appId -tenant $tenant -certificatePath $certificatePath

获取 Microsoft Entra service principals 以及它们的 application, oauth2PermissionGrant 和 appRoleAssignment:```powershell $endDate = Get-Date $startDate = $endDate.AddDays(-30) Get-AADApps --appId $appId -tenant $tenant -certificatePath $certificatePath

root@kitploit:~
获取 Microsoft Entra 设备及其所有者和用户:```powershell
$endDate = Get-Date
$startDate = $endDate.AddDays(-30)
Get-AADDevices -appId $appId -tenant $tenant -certificatePath $certificatePath

获取 Microsoft Entra 用户及其身份验证方法设置:```powershell Get-AADUsers -appId $appId -tenant $tenant -certificatePath $certificatePath -authenticationMethods

root@kitploit:~
从过去30天中检索被认为感兴趣的统一审计日志事件,但排除与 Entra ID 相关的事件,这些事件已由第一条命令检索到:```powershell
$endDate = Get-Date
$startDate = $endDate.AddDays(-30)
Get-O365Light -startDate $startDate -endDate $endDate -appId $appId -tenant $tenant -certificatePath $certificatePath -operationsSet "allButAzureAD"

检索从现在起 -90 天到 -30 天时间窗口内被视为感兴趣的统一审计日志事件:```powershell $endDate = (Get-Date).AddDays(-30) $startDate = (Get-Date).AddDays(-90) Get-O365Light -startDate $startDate -endDate $endDate -appId $appId -tenant $tenant -certificatePath $certificatePath

root@kitploit:~
如果邮箱审计已启用,您还可以使用专用开关检索 `MailboxLogin` 操作:

_注意每次搜索全局限制为 50.000 个事件_```powershell
Get-O365Light -startDate $startDate -endDate $endDate -appId $appId -tenant $tenant -certificatePath $certificatePath -mailboxLogin

如果存在拥有 Office 365 E5 许可的用户,或者租户中有 Microsoft Defender for Office 365 计划,则可以检索过去 90 天的 Microsoft Defender 相关日志:```powershell $endDate = Get-Date $startDate = $endDate.AddDays(-90) Get-O365Defender -startDate $startDate -endDate $endDate -appId $appId -tenant $tenant -certificatePath $certificatePath

root@kitploit:~
要检索2020年圣诞节前夕至节礼日之间的所有统一审核日志事件:

_请注意使用该cmdlet的性能较差_```powershell
$endDate = Get-Date "12/26/2020"
$startdate = Get-Date "12/24/2020"
Get-O365Full -startDate $startDate -endDate $endDate -appId $appId -tenant $tenant -certificatePath $certificatePath

您可以使用搜索功能查找IP地址、与特定用户相关的活动,或在统一审核日志中执行自由文本搜索:```powershell $endDate = Get-Date $startDate = $endDate.AddDays(-90)

Retrieve events which contains the "Python" or "Python3" free text

Search-O365 -startDate $startDate -endDate $endDate -appId $appId -tenant $tenant -certificatePath $certificatePath -freeTexts "Python","Python3"

Retrieve events related to the IP adresses 8.8.8.8 and 4.4.4.4.

Search-O365 -startDate $startDate -endDate $endDate -appId $appId -tenant $tenant -certificatePath $certificatePath -IPAddresses "8.8.8.8","4.4.4.4"

Retrieve events related to users [email protected] and [email protected]

Search-O365 -startDate $startDate -endDate $endDate -appId $appId -tenant $tenant -certificatePath $certificatePath -userIds "[email protected]","[email protected]"

root@kitploit:~
在搜索特定**用户**时,`Search-O365` 也会在邮箱审计日志中搜索。这是因为,根据用户的许可级别和设置,部分邮箱日志可能不在统一审计日志中。




要检索应用程序有权访问的订阅中的所有 Azure Resource Manager 活动日志:```powershell
$endDate = Get-Date
$startDate = $endDate.AddDays(-90)
Get-AzRMActivityLogs -startDate $startDate -endDate $endDate -appId $appId -tenant $tenant -certificatePath $certificatePath

要检索应用程序有权访问的所有组织的 Azure DevOps 活动日志:```powershell $endDate = Get-Date $startDate = $endDate.AddDays(-90) Get-AzDevOpsActivityLogs -startDate $startDate -endDate $endDate -appId $appId -tenant $tenant -certificatePath $certificatePath

root@kitploit:~
## 生成的文件

所有生成的文件均为 JSON 格式。

_同时启动多个使用 Purview 并写入同一输出文件的 cmdlet 可能会导致 JSON 格式无效(由于“简单”的拼接)_

- `Get-AADApps` 会在 `azure_ad_apps` 文件夹中创建:
  - 一个包含现有和已删除应用程序的 JSON 文件:`AADApps_example.onmicrosoft.com_applications_raw.json`;
  - 一个包含现有和已删除服务主体的 JSON 文件:`AADApps_example.onmicrosoft.com_service_principals_raw.json`;
  - 一个包含丰富化服务主体的 JSON 文件:`AADApps_example.onmicrosoft.com.json`。

- `Get-AADDevices` 会在 `azure_ad_devices` 文件夹中创建:
  - 一个包含现有和已删除设备的 JSON 文件:`AADDevices_example.onmicrosoft.com_devices_raw.json`;
  - 一个包含丰富化设备的 JSON 文件:`AADDevices_example.onmicrosoft.com.json`。

- `Get-AADUsers` 会在 `azure_ad_users` 文件夹中创建:
  - 一个包含现有和已删除用户的 JSON 文件:`AADUsers_example.onmicrosoft.com_users_raw.json`;
  - 一个包含用户身份验证设置的 JSON 文件:`AADUsers_example.onmicrosoft.com_users_settings_raw.json`;
  - 一个包含丰富化用户的 JSON 文件:`AADUsers_example.onmicrosoft.com.json`。

- `Get-AADLogs` 会创建:
  - 在 `azure_ad_tenant` 文件夹中:
    - 一个包含租户常规信息的 JSON 文件:`AADTenant_example.onmicrosoft.com.json`。
  - 在 `azure_ad_audit` 文件夹中:
    - 包含 Microsoft Entra 审核日志的 JSON 文件:`AADAuditLog_example.onmicrosoft.com_YYYY-MM-DD.json`。
  - 在 `azure_ad_signin` 文件夹中:
    - 包含 Microsoft Entra 登录日志的 JSON 文件:`YYYY-MM-DD/AADSigninLog_example.onmicrosoft.com_YYYY-MM-DD_HH-00-00.json`。

- `Get-AzRMActivityLogs` 会创建:
  - 在 `azure_rm_subscriptions` 文件夹中:
    - 一个包含订阅常规信息的 JSON 文件:`AzRMsubscriptions_example.onmicrosoft.com.json`。
  - 在 `azure_rm_activity` 文件夹中:
    - 包含 Azure Monitor 活动日志的 JSON 文件:`YYYY-MM-DD/AzRM_example.onmicrosoft.com_%SubscriptionID%_YYYY-MM-DD_HH-00-00.json`。

- `Get-AzDevOpsActivityLogs` 会创建:
  - 在 `azure_DevOps_orgs` 文件夹中:
    - 一个包含 Azure DevOps 组织常规信息的 JSON 文件:`AzdevopsOrgs_example.onmicrosoft.com.json`。
  - 在 `azure_DevOps_activity` 文件夹中:
    - 包含 Azure DevOps 审核日志的 JSON 文件:`YYYY-MM-DD/AzDevOps_example.onmicrosoft.com_%AzureDevOpsOrg%_YYYY-MM-DD_HH-00-00.json`。

- `Get-O365Full` 会在 `O365_unified_audit_logs` 文件夹中创建(使用 Purview 时分别为 `O365_unified_audit_logs_purview`):
  - 包含统一审核日志的 JSON 文件:`YYYY-MM-DD/UnifiedAuditLog_example.onmicrosoft.com_YYYY-MM-DD_HH-00-00.json`(使用 Purview 时分别为 `*/UnifiedAuditLogPurview_*`);
  - 包含指定 [RecordTypes](https://learn.microsoft.com/en-us/office/office-365-management-api/office-365-management-activity-api-schema#enum-auditlogrecordtype---type-edmint32) 的统一审核日志的 JSON 文件:`YYYY-MM-DD/UnifiedAuditLog_example.onmicrosoft.com_YYYY-MM-DD_HH-00-00_%RecordType%.json`(使用 Purview 时分别为 `*/UnifiedAuditLogPurview_*`)。

- `Get-O365Light` 会在 `O365_unified_audit_logs` 文件夹中创建(使用 Purview 时分别为 `O365_unified_audit_logs_purview`):
  - 包含被视为感兴趣的*操作*子集的统一审核日志的 JSON 文件:`YYYY-MM-DD/UnifiedAuditLog_example.onmicrosoft.com_YYYY-MM-DD_HH-00-00.json`(使用 Purview 时分别为 `*/UnifiedAuditLogPurview_*`)。
- `Get-O365Defender` 会在 `O365_unified_audit_logs` 文件夹中创建(使用 Purview 时分别为 `O365_unified_audit_logs_purview`):
  - 包含与 Defender 关联的 [RecordTypes](https://learn.microsoft.com/en-us/office/office-365-management-api/office-365-management-activity-api-schema#enum-auditlogrecordtype---type-edmint32) 的统一审核日志的 JSON 文件:`YYYY-MM-DD/UnifiedAuditLog_example.onmicrosoft.com_YYYY-MM-DD_HH-00-00_%RecordType%.json`(使用 Purview 时分别为 `*/UnifiedAuditLogPurview_*`)。
- `Search-O365` 会创建:
  - 在 `O365_unified_audit_logs` 文件夹中(使用 Purview 时分别为 `O365_unified_audit_logs_purview`):
    - 包含指定 `RequestType`(`FreeText`、`IPAddresses` 或 `UserIds`)的统一审核日志的 JSON 文件:`YYYY-MM-DD/UnifiedAuditLog_example.onmicrosoft.com_YYYY-MM-DD_HH-00-00_%RequestType%_YYYY-MM-DD-HH-MM-SS.json`(使用 Purview 时分别为 `*/UnifiedAuditLogPurview_*`)。`YYYY-MM-DD-HH-MM-SS` 表示采集完成的时间。当搜索 `FreeText` 时,末尾会额外添加 `_%i`,表示这是对第 `%i` 个自由文本进行搜索的结果。
  - 在 `Exchange_mailbox_audit_logs` 文件夹中:
    - 包含邮箱审核日志的 JSON 文件(仅在搜索 UserIDs 时):`YYYY-MM-DD/MailboxAuditLog_example.onmicrosoft.com_YYYY-MM-DD_HH-00-00_UserIds_YYYY-MM-DD-HH-MM-SS_%UserID%.json`。`YYYY-MM-DD-HH-MM-SS` 表示采集完成的时间。`%UserID%` 表示这是对此 UserID 进行搜索的结果。

运行各个函数将生成类似于以下结构的目录树:```
output
│   Get-AADApps.log
│   Get-AADDevices.log
│   Get-AADLogs.log
│   Get-AzDevOpsActivityLogs.log
│   Get-AzRMActivityLogs.log
│   Get-O365Defender.log
│   Get-O365Full.log
│   Get-O365Light.log
│   Search-O365.log
│
├───azure_ad_apps
│       AADApps_example.onmicrosoft.com.json
│       AADApps_example.onmicrosoft.com_applications_raw.json
│       AADApps_example.onmicrosoft.com_service_principals_raw.json
│
├───azure_ad_audit
│       AADAuditLog_example.onmicrosoft.com_YYYY-MM-DD.json
│       [...]
│
├───azure_ad_devices
│       AADDevices_example.onmicrosoft.com.json
│       AADDevices_example.onmicrosoft.com_devices_raw.json
│
├───azure_ad_signin
│   ├───YYYY-MM-DD
│   │       AADSigninLog_example.onmicrosoft.com_YYYY-MM-DD_HH-00-00.json
│   │       [...]
│   │
│   ├───[...]
│
├───azure_ad_tenant
│       AADTenant_example.onmicrosoft.com.json
│
├───azure_ad_users
│       AADUsers_divreponse.onmicrosoft.com.json
│       AADUsers_divreponse.onmicrosoft.com_users_raw.json
│       AADUsers_divreponse.onmicrosoft.com_users_settings_raw.json
|
├───azure_DevOps_activity
│   ├───YYYY-MM-DD
│   │       AzDevOps_example.onmicrosoft.com_%AzureDevOpsOrg%_YYYY-MM-DD_HH-00-00.json
│   │       [...]
│   │
│   ├───[...]
│
├───azure_DevOps_orgs
│       AzdevopsOrgs_example.onmicrosoft.com.json
├───azure_rm_activity
│   ├───YYYY-MM-DD
│   │       AzRM_example.onmicrosoft.com_%SubscriptionID%_YYYY-MM-DD_HH-00-00.json
│   │       [...]
│   │
│   ├───[...]
│
├───azure_rm_subscriptions
│       AzRMsubscriptions_example.onmicrosoft.com.json
│
├───Exchange_mailbox_audit_logs
│   └───YYYY-MM-DD
│   │       MailboxAuditLog_example.onmicrosoft.com_YYYY-MM-DD_HH-00-00_UserIds_YYYY-MM-DD-HH-MM-SS_%UserID%.json
│   │       [...]
│   │
│   ├───[...]
│
├───O365_unified_audit_logs
│   ├───YYYY-MM-DD
│   │       UnifiedAuditLog_example.onmicrosoft.com_YYYY-MM-DD_HH-00-00.json
│   │       UnifiedAuditLog_example.onmicrosoft.com_YYYY-MM-DD_HH-00-00_%RecordType%.json
│   │       UnifiedAuditLog_example.onmicrosoft.com_YYYY-MM-DD_HH-00-00_UserIds_YYYY-MM-DD-HH-MM-SS.json
│   │       UnifiedAuditLog_example.onmicrosoft.com_YYYY-MM-DD_HH-00-00_IPAddresses_YYYY-MM-DD-HH-MM-SS.json
│   │       UnifiedAuditLog_example.onmicrosoft.com_YYYY-MM-DD_HH-00-00_FreeText_YYYY-MM-DD-HH-MM-SS_%i.json
│   │       [...]
│   │
│   ├───[...]
│
└───O365_unified_audit_logs_purview
│   ├───YYYY-MM-DD
│   │       UnifiedAuditLogPurview_example.onmicrosoft.com_YYYY-MM-DD_HH-00-00.json
│   │       UnifiedAuditLogPurview_example.onmicrosoft.com_YYYY-MM-DD_HH-00-00_%RecordType%.json
│   │       UnifiedAuditLogPurview_example.onmicrosoft.com_YYYY-MM-DD_HH-00-00_UserIds_YYYY-MM-DD-HH-MM-SS.json
│   │       UnifiedAuditLogPurview_example.onmicrosoft.com_YYYY-MM-DD_HH-00-00_IPAddresses_YYYY-MM-DD-HH-MM-SS.json
│   │       UnifiedAuditLogPurview_example.onmicrosoft.com_YYYY-MM-DD_HH-00-00_FreeText_YYYY-MM-DD-HH-MM-SS_%i.json
│   │       [...]
│   │
│   ├───[...]
下载工具
数据源 / 端点保留期性能范围
统一审核日志 / Exchange Online PowerShell90 天较差所有 Microsoft 365 日志(含 Entra)
统一审核日志 / Purview180 天良好所有 Microsoft 365 日志(含 Entra)
统一审核日志 / Office 365 Management API *7 天良好所有 Microsoft 365 日志(含 Entra)
Microsoft Entra 日志 / Microsoft Graph PowerShell30 天良好仅限 Entra 登录和审核日志
Microsoft Entra 日志 / Microsoft Graph REST API30 天良好仅限 Entra 登录和审核日志