你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

Entity Queries - Get

获取实体查询。

GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entityQueries/{entityQueryId}?api-version=2024-01-01-preview

URI 参数

名称 必需 类型 说明
entityQueryId
path True

string

实体查询 ID

resourceGroupName
path True

string

资源组的名称。 此名称不区分大小写。

subscriptionId
path True

string

目标订阅的 ID。

workspaceName
path True

string

工作区的名称。

Regex pattern: ^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$

api-version
query True

string

要用于此操作的 API 版本。

响应

名称 类型 说明
200 OK EntityQuery:
  • ExpansionEntityQuery
  • ActivityEntityQuery

确定

Other Status Codes

CloudError

描述操作失败原因的错误响应。

安全性

azure_auth

Azure Active Directory OAuth2 流

Type: oauth2
Flow: implicit
Authorization URL: https://login.microsoftonline.com/common/oauth2/authorize

Scopes

名称 说明
user_impersonation 模拟用户帐户

示例

Get an Activity entity query.
Get an Expansion entity query.

Get an Activity entity query.

Sample Request

GET https://management.azure.com/subscriptions/d0cfe6b2-9ac0-4464-9919-dccaee2e48c0/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace/providers/Microsoft.SecurityInsights/entityQueries/07da3cc8-c8ad-4710-a44e-334cdcb7882b?api-version=2024-01-01-preview

Sample Response

{
  "id": "/subscriptions/d0cfe6b2-9ac0-4464-9919-dccaee2e48c0/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace/providers/Microsoft.SecurityInsights/entityQueries/07da3cc8-c8ad-4710-a44e-334cdcb7882b",
  "name": "07da3cc8-c8ad-4710-a44e-334cdcb7882b",
  "type": "Microsoft.SecurityInsights/entityQueries",
  "etag": null,
  "kind": "Activity",
  "properties": {
    "title": "An account was deleted on this host",
    "content": "On '{{Computer}}' the account '{{TargetAccount}}' was deleted by '{{AddedBy}}'",
    "description": "Account deleted on host",
    "queryDefinitions": {
      "query": "let GetAccountActions = (v_Host_Name:string, v_Host_NTDomain:string, v_Host_DnsDomain:string, v_Host_AzureID:string, v_Host_OMSAgentID:string){\nSecurityEvent\n| where EventID in (4725, 4726, 4767, 4720, 4722, 4723, 4724)\n// parsing for Host to handle variety of conventions coming from data\n| extend Host_HostName = case(\nComputer has '@', tostring(split(Computer, '@')[0]),\nComputer has '\\\\', tostring(split(Computer, '\\\\')[1]),\nComputer has '.', tostring(split(Computer, '.')[0]),\nComputer\n)\n| extend Host_NTDomain = case(\nComputer has '\\\\', tostring(split(Computer, '\\\\')[0]), \nComputer has '.', tostring(split(Computer, '.')[-2]), \nComputer\n)\n| extend Host_DnsDomain = case(\nComputer has '\\\\', tostring(split(Computer, '\\\\')[0]), \nComputer has '.', strcat_array(array_slice(split(Computer,'.'),-2,-1),'.'), \nComputer\n)\n| where (Host_HostName =~ v_Host_Name and Host_NTDomain =~ v_Host_NTDomain) \nor (Host_HostName =~ v_Host_Name and Host_DnsDomain =~ v_Host_DnsDomain) \nor v_Host_AzureID =~ _ResourceId \nor v_Host_OMSAgentID == SourceComputerId\n| project TimeGenerated, EventID, Activity, Computer, TargetAccount, TargetUserName, TargetDomainName, TargetSid, SubjectUserName, SubjectUserSid, _ResourceId, SourceComputerId\n| extend AddedBy = SubjectUserName\n// Future support for Activities\n| extend timestamp = TimeGenerated, HostCustomEntity = Computer, AccountCustomEntity = TargetAccount\n};\nGetAccountActions('{{Host_HostName}}', '{{Host_NTDomain}}', '{{Host_DnsDomain}}', '{{Host_AzureID}}', '{{Host_OMSAgentID}}')\n \n| where EventID == 4726 "
    },
    "inputEntityType": "Host",
    "requiredInputFieldsSets": [
      [
        "Host_HostName",
        "Host_NTDomain"
      ],
      [
        "Host_HostName",
        "Host_DnsDomain"
      ],
      [
        "Host_AzureID"
      ],
      [
        "Host_OMSAgentID"
      ]
    ],
    "entitiesFilter": {
      "Host_OsFamily": [
        "Windows"
      ]
    },
    "enabled": true,
    "templateName": null,
    "createdTimeUtc": "2019-01-01T13:15:30Z",
    "lastModifiedTimeUtc": "2019-01-01T13:15:30Z"
  }
}

Get an Expansion entity query.

Sample Request

GET https://management.azure.com/subscriptions/d0cfe6b2-9ac0-4464-9919-dccaee2e48c0/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace/providers/Microsoft.SecurityInsights/entityQueries/07da3cc8-c8ad-4710-a44e-334cdcb7882b?api-version=2024-01-01-preview

Sample Response

{
  "id": "/subscriptions/d0cfe6b2-9ac0-4464-9919-dccaee2e48c0/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace/providers/Microsoft.SecurityInsights/entityQueries/07da3cc8-c8ad-4710-a44e-334cdcb7882b",
  "name": "07da3cc8-c8ad-4710-a44e-334cdcb7882b",
  "type": "Microsoft.SecurityInsights/entityQueries",
  "etag": null,
  "kind": "Expansion",
  "properties": {
    "queryTemplate": "let GetParentProcessesOnHost = (v_Host_HostName:string){\r\n                            SecurityEvent \r\n                            | where EventID == 4688 \r\n                            | where isnotempty(ParentProcessName)\r\n                            | where NewProcessName !contains ':\\\\Windows\\\\System32\\\\conhost.exe' and ParentProcessName !contains ':\\\\Windows\\\\System32\\\\conhost.exe'\r\n                            and NewProcessName !contains ':\\\\Windows\\\\Microsoft.NET\\\\Framework64\\\\v2.0.50727\\\\csc.exe' and ParentProcessName !contains ':\\\\Windows\\\\Microsoft.NET\\\\Framework64\\\\v2.0.50727\\\\csc.exe'\r\n                            and NewProcessName !contains ':\\\\Windows\\\\Microsoft.NET\\\\Framework64\\\\v2.0.50727\\\\cvtres.exe' and ParentProcessName !contains ':\\\\Windows\\\\Microsoft.NET\\\\Framework64\\\\v2.0.50727\\\\cvtres.exe'\r\n                            and NewProcessName!contains ':\\\\Program Files\\\\Microsoft Monitoring Agent\\\\Agent\\\\MonitoringHost.exe' and ParentProcessName !contains ':\\\\Program Files\\\\Microsoft Monitoring Agent\\\\Agent\\\\MonitoringHost.exe'\r\n                            and ParentProcessName !contains ':\\\\Windows\\\\CCM\\\\CcmExec.exe'\r\n                            | where(ParentProcessName !contains ':\\\\Windows\\\\System32\\\\svchost.exe' and (NewProcessName !contains ':\\\\Windows\\\\System32\\\\wbem\\\\WmiPrvSE.exe' or NewProcessName !contains ':\\\\Windows\\\\SysWOW64\\\\wbem\\\\WmiPrvSE.exe'))\r\n                            | where(ParentProcessName !contains ':\\\\Windows\\\\System32\\\\services.exe' and NewProcessName !contains ':\\\\Windows\\\\servicing\\\\TrustedInstaller.exe')\r\n                            | where toupper(Computer) contains v_Host_HostName or toupper(WorkstationName) contains v_Host_HostName\r\n                            | summarize min(TimeGenerated), max(TimeGenerated) by Account, Computer, ParentProcessName, NewProcessName, CommandLine, ProcessId\r\n                            | project min_TimeGenerated, max_TimeGenerated, Account, Computer, ParentProcessName, NewProcessName, CommandLine, ProcessId\r\n                            | project-rename Process_Host_UnstructuredName=Computer, Process_Account_UnstructuredName=Account, Process_CommandLine=CommandLine, Process_ProcessId=ProcessId, Process_ImageFile_FullPath=NewProcessName, Process_ParentProcess_ImageFile_FullPath=ParentProcessName\r\n                            | top 10 by min_TimeGenerated asc};\r\n                            GetParentProcessesOnHost(toupper('<hostName>'))",
    "inputFields": [
      "hostName"
    ],
    "outputEntityTypes": [
      "Process"
    ],
    "dataSources": [
      "SecurityEvent"
    ],
    "inputEntityType": "Host",
    "displayName": "Parent processes running on host"
  }
}

定义

名称 说明
ActivityEntityQuery

表示活动实体查询。

CloudError

错误响应结构。

CloudErrorBody

错误详细信息。

createdByType

创建资源的标识类型。

EntityQueryKind

实体查询的类型

EntityType

查询的源实体的类型

ExpansionEntityQuery

表示扩展实体查询。

QueryDefinitions

活动查询定义

systemData

与资源的创建和上次修改相关的元数据。

ActivityEntityQuery

表示活动实体查询。

名称 类型 说明
etag

string

Azure 资源的 Etag

id

string

资源的完全限定的资源 ID。 例如 - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}

kind string:

Activity

实体查询类型

name

string

资源的名称

properties.content

string

要显示在 时间线 中的实体查询内容

properties.createdTimeUtc

string

活动创建时间

properties.description

string

实体查询说明

properties.enabled

boolean

确定是启用还是禁用此活动。

properties.entitiesFilter

object

查询仅应用于与所有筛选器匹配的实体

properties.inputEntityType

EntityType

查询的源实体的类型

properties.lastModifiedTimeUtc

string

上次更新活动的时间

properties.queryDefinitions

QueryDefinitions

活动查询定义

properties.requiredInputFieldsSets

string[]

运行查询所需的源实体字段列表

properties.templateName

string

创建此活动的模板 ID

properties.title

string

实体查询标题

systemData

systemData

包含 createdBy 和 modifiedBy 信息的 Azure 资源管理器元数据。

type

string

资源类型。 例如“Microsoft.Compute/virtualMachines”或“Microsoft.Storage/storageAccounts”

CloudError

错误响应结构。

名称 类型 说明
error

CloudErrorBody

错误数据

CloudErrorBody

错误详细信息。

名称 类型 说明
code

string

错误的标识符。 代码是固定的,旨在以编程方式使用。

message

string

描述错误的消息,该消息适用于在用户界面中显示。

createdByType

创建资源的标识类型。

名称 类型 说明
Application

string

Key

string

ManagedIdentity

string

User

string

EntityQueryKind

实体查询的类型

名称 类型 说明
Activity

string

Expansion

string

Insight

string

EntityType

查询的源实体的类型

名称 类型 说明
Account

string

实体表示系统中的帐户。

AzureResource

string

实体表示系统中的 azure 资源。

CloudApplication

string

实体表示系统中的云应用程序。

DNS

string

实体表示系统中的 dns。

File

string

实体表示系统中的文件。

FileHash

string

实体表示系统中的文件哈希。

Host

string

实体表示系统中的主机。

HuntingBookmark

string

实体表示系统中的 HuntingBookmark。

IP

string

实体表示系统中的 IP。

IoTDevice

string

实体表示系统中的 IoT 设备。

MailCluster

string

实体表示系统中的邮件群集。

MailMessage

string

实体表示系统中的邮件。

Mailbox

string

实体表示系统中的邮箱。

Malware

string

实体表示系统中的恶意软件。

Nic

string

实体表示系统中的网络接口。

Process

string

实体表示系统中的进程。

RegistryKey

string

实体表示系统中的注册表项。

RegistryValue

string

实体表示系统中的注册表值。

SecurityAlert

string

实体表示系统中的安全警报。

SecurityGroup

string

实体表示系统中的安全组。

SubmissionMail

string

实体表示系统中的提交邮件。

URL

string

实体表示系统中的 URL。

ExpansionEntityQuery

表示扩展实体查询。

名称 类型 说明
etag

string

Azure 资源的 Etag

id

string

资源的完全限定的资源 ID。 例如 - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}

kind string:

Expansion

实体查询类型

name

string

资源的名称

properties.dataSources

string[]

运行查询所需的数据源列表

properties.displayName

string

查询显示名称

properties.inputEntityType

EntityType

查询的源实体的类型

properties.inputFields

string[]

运行查询所需的源实体字段列表

properties.outputEntityTypes

EntityType[]

要从结果构造的所需输出类型的列表

properties.queryTemplate

string

要分析和设置格式的模板查询字符串

systemData

systemData

包含 createdBy 和 modifiedBy 信息的 Azure 资源管理器元数据。

type

string

资源类型。 例如“Microsoft.Compute/virtualMachines”或“Microsoft.Storage/storageAccounts”

QueryDefinitions

活动查询定义

名称 类型 说明
query

string

在给定实体上运行的活动查询

systemData

与资源的创建和上次修改相关的元数据。

名称 类型 说明
createdAt

string

资源的创建时间戳 (UTC) 。

createdBy

string

创建资源的标识。

createdByType

createdByType

创建资源的标识类型。

lastModifiedAt

string

资源上次修改的时间戳 (UTC)

lastModifiedBy

string

上次修改资源的标识。

lastModifiedByType

createdByType

上次修改资源的标识类型。