分享方式:


Azure 資源通知 - Azure 事件方格中的資源管理事件

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

事件結構描述

本節提供 CreatedOrUpdatedDeleted 事件的結構描述。

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"
}

已刪除事件的事件結構描述

以下是結構描述:

{
    "id": "string",
    "source": "string",
    "subject": "string",
    "data": {
        "resourceInfo": {
            "id": "string",
            "name": "string",
            "type": "string"
        },
        "operationalInfo": {
            "resourceEventTime": "datetime"
        }
    },
    "type": "string",
    "specversion": "string",
    "time": "string"
}

Event Grid 事件結構描述格式中的事件具有下列最上層屬性:

屬性 類型​ 描述
id String 活動的唯一識別碼
topic String 建立此系統主題的 Azure 訂用帳戶
subject String 發行者定義發出此事件之基底資源的路徑。
data Object 包含資源提供者特有的事件資料。 如需詳細資訊,請參閱下一個表格。
eventType String 此系統主題類型的已註冊事件類型
dataVersion String 資料物件的結構描述版本
metadataVersion String 事件中繼資料的結構描述版本
eventTime String
格式:2022-11-07T18:43:09.2894075Z
事件產生的時間,以提供者之 UTC 時間為準

雲端事件結構描述格式中的事件具有下列最上層屬性:

屬性 類型​ 描述
id String 活動的唯一識別碼
source String 建立此系統主題的 Azure 訂用帳戶。
subject String 發行者定義發出此事件之基底資源的路徑。
type String 此系統主題類型的已註冊事件類型
time String
格式:2022-11-07T18:43:09.2894075Z
事件產生的時間,以提供者之 UTC 時間為準
data Object 包含資源提供者特有的事件資料。 如需詳細資訊,請參閱下一個表格。
specversion String CloudEvents 結構描述規格版本。

data 物件具有下列屬性:

屬性 類型​ 描述
resourceInfo Object 資源特有的資料。 如需詳細資訊,請參閱下一個表格。
apiVersion String 資源執行階段的 API 版本。
operationalInfo Object 與資源相關的作業資訊詳細資料。

resourceInfo 物件在 CreatedOrUpdatedDeleted 事件之間具有下列通用屬性:

屬性 類型​ 描述
id String 發行者定義事件主體的路徑
name String 此欄位表示 Event-id。它一律會採用 id 欄位最後一個區段的值。
type String 正在發出的事件類型。 在此情況中,它是 Microsoft.ResourceNotifications.Resources.CreatedOrUpdatedMicrosoft.ResourceNotifications.Resources.Deleted

CreatedOrUpdated 事件的 resourceInfo 物件具有下列額外屬性:

屬性 類型​ 描述
location String 資源所在的位置或區域。
tags String 資源的自訂標籤。
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/{subcription-id}/resourceGroups/{rg-name}/providers/Microsoft.Storage/storageAccounts/{storageAccount-name}",
      "name": "StorageAccount-name",
      "type": "Microsoft.Storage/storageAccounts",
      "location": "eastus",
      "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.windows.net/",
          "web": "https://{storageAccount-name}.z13.web.core.windows.net/",
          "blob": "https://{storageAccount-name}.blob.core.windows.net/",
          "queue": "https://{storageAccount-name}.queue.core.windows.net/",
          "table": "https://{storageAccount-name}.table.core.windows.net/",
          "file": "https://{storageAccount-name}.file.core.windows.net/"
        },
        "primaryLocation": "eastus",
        "statusOfPrimary": "available",
        "secondaryLocation": "westus",
        "statusOfSecondary": "available",
        "secondaryEndpoints": {
          "dfs": "https://{storageAccount-name} -secondary.dfs.core.windows.net/",
          "web": "https://{storageAccount-name}-secondary.z13.web.core.windows.net/",
          "blob": "https://{storageAccount-name}-secondary.blob.core.windows.net/",
          "queue": "https://{storageAccount-name}-secondary.queue.core.windows.net/",
          "table": "https://{storageAccount-name}-secondary.table.core.windows.net/"
        }
      }
    },
    "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"
}

已刪除的事件

本節說明在建立系統主題的 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 的近似時間戳記
  • 產生通知的基底資源識別碼
  • 在 Azure 入口網站中瀏覽至您的資源,然後選取最右側的 JSON 檢視。 資源識別碼是 JSON 檢視頁面上的第一個欄位。
  • 預期的事件類型
  • 執行的作業 (例如 VM 已啟動或停止、已建立記憶體帳戶等)
  • 發生問題的描述 (例如,VM 已啟動,且未產生 Microsoft.ResourceNotifications.HealthResources.AvailabilityStatusChanged 事件)
  • 可能的話,請提供所執行作業的相互關聯識別碼

針對延遲或有非預期內容的事件

  • 系統主題類型名稱
  • 通知的整個內容 (排除 data.resourceInfo.properties)
  • 所遇到問題的描述和受影響欄位的值

請確定您在共用此資料時,未提供任何終端使用者可識別的資訊。

下一步

請參閱訂閱 Azure 資源通知 - 資源管理事件