Azure 资源管理系统主题提供有关各种 Azure 资源的生命周期的见解。
Azure 订阅和 Azure 资源组的事件网格系统主题使用更广泛的事件类型提供资源生命周期事件,包括涉及成功、失败和取消的场景的操作、写入和删除事件。 但是,值得注意的是,它们不包括资源有效负载。 有关这些事件的详细信息,请参阅 Azure 订阅的事件网格系统主题和 Azure 资源组的事件网格系统主题。
相比之下,Azure 资源通知 (ARN) 支持的 Azure 资源管理系统主题提供更有针对性的事件类型选择,特别是 CreatedOrUpdated(对应于“事件网格”这一 Azure 订阅系统主题中的 ResourceWriteSuccess)和 Deleted(对应于“事件网格”这一 Azure 订阅系统主题中的 ResourceDeleteSuccess)。 这些事件附带了全面的有效负载信息,使客户更容易应用筛选并优化其通知流。
有关公开的资源类型列表,请参阅 Azure Resource Graph 资源或使用以下 Azure Resource Graph 查询。
resources
| distinct ['type']
注意
Azure 资源管理系统主题尚不支持 Azure Resource Graph 资源表中的所有资源类型。 我们正在努力改进此体验。
事件类型
ARN 资源系统主题提供两种事件类型供使用:
| 事件类型 | 说明 |
|---|---|
Microsoft.ResourceNotifications.Resources.CreatedOrUpdated |
在成功创建或更新资源时引发。 |
Microsoft.ResourceNotifications.Resources.Deleted |
在删除资源时引发。 |
基于角色的访问控制
目前,这些事件仅在 Azure 订阅范围内发出。 这意味着为此主题类型创建事件订阅的实体在整个 Azure 订阅过程中会接收通知。 出于安全原因,必须将在此主题上创建事件订阅的能力限制为对整个 Azure 订阅具有读取访问权限的主体。 若要通过此系统主题访问数据,除了事件网格所需的通用权限外,还需要以下 Azure 资源通知特定权限:Microsoft.ResourceNotifications/systemTopics/subscribeToResources/action。
事件架构
本部分提供 CreatedOrUpdated 和 Deleted 事件的架构。
CreatedOrUpdated 事件的事件架构
以下是架构:
{
"id": "string",
"source": "string",
"subject": "string",
"data": {
"resourceInfo": {
"id": "string",
"name": "string",
"type": "string",
"location": "string",
"tags": "string",
"properties": {
"_comment": "object-unique-to-each-publisher"
}
},
"apiVersion": "string",
"operationalInfo": {
"resourceEventTime": "datetime"
}
},
"type": "string",
"specversion": "string",
"time": "string"
}
Deleted 事件的事件架构
以下是架构:
{
"id": "string",
"source": "string",
"subject": "string",
"data": {
"resourceInfo": {
"id": "string",
"name": "string",
"type": "string"
},
"operationalInfo": {
"resourceEventTime": "datetime"
}
},
"type": "string",
"specversion": "string",
"time": "string"
}
“事件网格”事件架构格式中的事件具有以下顶级属性:
| properties | 类型 | 说明 |
|---|---|---|
id |
字符串 | 事件的唯一标识符 |
topic |
字符串 | 要为其创建此系统主题的 Azure 订阅 |
subject |
字符串 | 发布者定义了发出此事件的基础资源的路径。 |
data |
Object | 包含特定于资源提供程序的事件数据。 有关详细信息,请参阅下一个表格。 |
eventType |
字符串 | 此系统主题类型的已注册事件类型 |
dataVersion |
字符串 | 数据对象的架构版本 |
metadataVersion |
字符串 | 事件元数据的架构版本 |
eventTime |
字符串 格式: 2022-11-07T18:43:09.2894075Z |
事件的生成时间,基于提供程序的 UTC 时间 |
云事件架构格式中的事件具有以下顶级属性:
| properties | 类型 | 说明 |
|---|---|---|
id |
字符串 | 事件的唯一标识符 |
source |
字符串 | 要为其创建此系统主题的 Azure 订阅。 |
subject |
字符串 | 发布者定义了发出此事件的基础资源的路径。 |
type |
字符串 | 此系统主题类型的已注册事件类型 |
time |
字符串 格式: 2022-11-07T18:43:09.2894075Z |
事件的生成时间,基于提供程序的 UTC 时间 |
data |
对象 | 包含特定于资源提供程序的事件数据。 有关详细信息,请参阅下一个表格。 |
specversion |
字符串 | CloudEvents 架构规范版本。 |
data 对象具有以下属性:
| 属性 | 类型 | 说明 |
|---|---|---|
resourceInfo |
对象 | 特定于资源的数据。 有关详细信息,请参阅下一个表格。 |
apiVersion |
字符串 | 资源属性的 API 版本。 |
operationalInfo |
对象 | 与资源相关的操作信息的详细信息。 |
resourceInfo 对象在 CreatedOrUpdated 和 Deleted 事件中具有以下常见属性:
| properties | 类型 | 说明 |
|---|---|---|
id |
字符串 | 事件主题的发布者定义路径 |
name |
字符串 | 此字段指示事件 ID。它始终采用 id 字段的最后一部分的值。 |
type |
字符串 | 正在发出的事件的类型。 在此上下文中,它是 Microsoft.ResourceNotifications.Resources.CreatedOrUpdated 或 Microsoft.ResourceNotifications.Resources.Deleted。 |
CreatedOrUpdated 事件的 resourceInfo 对象另外具有以下属性:
| properties | 类型 | 说明 |
|---|---|---|
location |
字符串 | 资源所在的位置或区域。 |
tags |
字符串 | 资源的标记。 |
properties |
Object | 资源的有效负载。 |
只有 CreatedOrUpdated 事件包含 properties 对象。 此 properties 对象的架构对于每个发布者都是唯一的。 若要发现架构,请参阅有关特定 Azure 资源的 REST API 文档。 可在本文的“示例事件”部分中找到一个示例。
"properties": {
"_comment": "<< object-unique-to-each-publisher >>"
}
operationalInfo 对象具有以下属性:
| 属性 | 类型 | 说明 |
|---|---|---|
resourceEventTime |
DateTime | 创建或更新资源的日期和时间(对于 CreatedOrUpdated 事件),或删除资源的日期和时间(对于 Deleted 事件)。 |
示例事件
CreatedOrUpdated 事件
本部分介绍在创建系统主题的 Azure 订阅中创建 Azure 存储帐户时生成的 CreatedOrUpdated 事件。
{
"id": "4eef929a-a65c-47dd-93e2-46b8c17c6c17",
"source": "/subscriptions/{subscription-id}",
"subject": "/subscriptions/{subscription-id}/resourceGroups/{rg-name}/providers/Microsoft.Storage/storageAccounts/{storageAccount-name}",
"data": {
"resourceInfo": {
"tags": {},
"id": "/subscriptions/{subscription-id}/resourceGroups/{rg-name}/providers/Microsoft.Storage/storageAccounts/{storageAccount-name}",
"name": "StorageAccount-name",
"type": "Microsoft.Storage/storageAccounts",
"location": "chinanorth",
"properties": {
"privateEndpointConnections": [],
"minimumTlsVersion": "TLS1_2",
"allowBlobPublicAccess": 1,
"allowSharedKeyAccess": 1,
"networkAcls": {
"bypass": "AzureServices",
"virtualNetworkRules": [],
"ipRules": [],
"defaultAction": "Allow"
},
"supportsHttpsTrafficOnly": 1,
"encryption": {
"requireInfrastructureEncryption": 0,
"services": {
"file": {
"keyType": "Account",
"enabled": 1,
"lastEnabledTime": "2023-07-28T20:12:50.6380308Z"
},
"blob": {
"keyType": "Account",
"enabled": 1,
"lastEnabledTime": "2023-07-28T20:12:50.6380308Z"
}
},
"keySource": "Microsoft.Storage"
},
"accessTier": "Hot",
"provisioningState": "Succeeded",
"creationTime": "2023-07-28T20:12:50.4661564Z",
"primaryEndpoints": {
"dfs": "https://{storageAccount-name}.dfs.core.chinacloudapi.cn/",
"web": "https://{storageAccount-name}.z13.web.core.chinacloudapi.cn/",
"blob": "https://{storageAccount-name}.blob.core.chinacloudapi.cn/",
"queue": "https://{storageAccount-name}.queue.core.chinacloudapi.cn/",
"table": "https://{storageAccount-name}.table.core.chinacloudapi.cn/",
"file": "https://{storageAccount-name}.file.core.chinacloudapi.cn/"
},
"primaryLocation": "chinanorth",
"statusOfPrimary": "available",
"secondaryLocation": "chinaeast",
"statusOfSecondary": "available",
"secondaryEndpoints": {
"dfs": "https://{storageAccount-name} -secondary.dfs.core.chinacloudapi.cn/",
"web": "https://{storageAccount-name}-secondary.z13.web.core.chinacloudapi.cn/",
"blob": "https://{storageAccount-name}-secondary.blob.core.chinacloudapi.cn/",
"queue": "https://{storageAccount-name}-secondary.queue.core.chinacloudapi.cn/",
"table": "https://{storageAccount-name}-secondary.table.core.chinacloudapi.cn/"
}
}
},
"apiVersion": "2019-06-01",
"operationalInfo": {
"resourceEventTime": "2023-07-28T20:13:10.8418063Z"
}
},
"type": "Microsoft.ResourceNotifications.Resources.CreatedOrUpdated",
"specversion": "1.0",
"time": "2023-07-28T20:13:10.8418063Z"
}
Deleted 事件
本部分介绍在创建系统主题的 Azure 订阅中删除 Azure 存储帐户时生成的 Deleted 事件。
{
"id": "d4611260-d179-4f86-b196-3a9d4128be2d",
"source": "/subscriptions/{subscription-id}",
"subject": "/subscriptions/{subscription-id}/resourceGroups/{rg-name}/providers/Microsoft.Storage/storageAccounts/{storageAccount-name}",
"data": {
"resourceInfo": {
"id": "/subscriptions/{subscription-id}/resourceGroups/{rg-name}/providers/Microsoft.Storage/storageAccounts/{storageAccount-name}",
"name": "storageAccount-name",
"type": "Microsoft.Storage/storageAccounts"
},
"operationalInfo": {
"resourceEventTime": "2023-07-28T20:11:36.6347858Z"
}
},
"type": "Microsoft.ResourceNotifications.Resources.Deleted",
"specversion": "1.0",
"time": "2023-07-28T20:11:36.6347858Z"
}
联系我们
如果对此功能有任何疑问或反馈,请通过 arnsupport@microsoft.com 随时联系我们。
为了更好地帮助你提供有关特定事件的特定反馈,请提供以下信息:
对于丢失的事件:
- 系统主题类型名称
- 执行操作时的近似时间戳 (UTC)
- 为其生成通知的基本资源 ID
- 在 Azure 门户中导航到你的资源,然后选择最右侧的 JSON 视图。 资源 ID 是 JSON 视图页上的第一个字段。
- 预期的事件类型
- 执行的操作(例如 VM 已启动或停止、已创建存储帐户等)
- 遇到的问题的说明(例如,VM 已启动,但未生成 Microsoft.ResourceNotifications.HealthResources.AvailabilityStatusChanged 事件)
- 如果可能,请提供所执行的操作的相关 ID
对于延迟或具有意外内容的事件
- 系统主题类型名称
- 不包括 data.resourceInfo.properties 的通知的全部内容
- 遇到的问题的说明和受影响的字段值
请确保在共享此数据时未提供任何最终用户身份信息。