共用方式為


適用於 Azure 監視器的內建原則

原則和原則計劃提供簡單的方法,可透過 Azure 監視器的診斷設定大規模啟用記錄。 您可以使用原則計劃,針對 Azure 環境中所有支援的資源開啟稽核記錄。

啟用資源記錄以追蹤在資源上發生的活動與事件,並讓您查看和深入解析已發生的任何變更。 指派原則以啟用資源記錄,並根據需求將其傳送至目的地。 將記錄傳送至第三方 SIEM 系統的事件中樞,以實現持續的安全性作業。 將記錄傳送至儲存體帳戶以進行長期儲存或履行法規合規性。

有一組內建原則和計劃可用來將資源記錄導向 Log Analytics 工作區、事件中樞和儲存體帳戶。 原則會啟用稽核記錄、將屬於核或所有記錄記錄類別群組的記錄傳送至事件中樞、Log Analytics 工作區或記憶體帳戶。 這些原則 effectDeployIfNotExists,如果未定義其他設定,則會將原則部署為預設值。

部署原則。

使用入口網站、CLI、PowerShell 或 Azure 資源管理範本來部署原則和計劃

下列步驟示範如何套用原則,以將金鑰保存庫的稽核記錄傳送至記錄分析工作區。

  1. 從 [原則] 頁面中,選取 [定義 ]

  2. 選取範圍。 您可以將原則套用至整個訂用帳戶、資源群組,或個別的資源。

  3. 從 [定義類型] 下拉式清單中,選取 [原則]

  4. 從 [類別] 下拉式清單中選取 [監視]

  5. 在 [搜尋] 欄位中輸入 keyvault

  6. 選取 [依類別群組 (microsoft.keyvault/vaults) 針對金鑰保存庫啟用目的地為 Log Analytics 的記錄] 原則,原則定義頁面的螢幕快照。

  7. 從原則定義頁面時,選取 [指派]

  8. 選取參數索引標籤。

  9. 選取要將稽核記錄傳送至其中的 Log Analytics 工作區。

  10. 選取 [補救] 索引標籤。指派原則頁面、參數索引標籤的螢幕快照。

  11. 在 [補救] 索引標籤上,從 [補救原則] 下拉式清單中選取 keyvault 原則。

  12. 選取 [建立受控識別] 核取方塊。

  13. 在 [受控識別類型] 下,選取 [系統指派的受控識別]

  14. 選取 [檢閱 + 建立],然後選取 [建立]指派原則頁面 [補救] 索引卷標的螢幕快照。

大約 30 分鐘後,資源診斷設定中便會顯示該原則。

補救工作

原則會在建立時套用至新資源。 若要將原則套用至現有的資源,請建立補救工作。 補救工作會使資源符合原則。

補救工作適用於特定原則。 針對包含多個原則的計劃,請為計劃每個原則建立補救工作,該計劃中會有您希望符合合規性的資源。

當您第一次指派原則時,或在指派後的任何階段定義補救工作。

若要在原則指派期間建立原則的補救工作,請選取 [指派原則] 頁面上的 [補救] 索引標籤,然後選取 [建立補救工作] 核取方塊。

若要在指派原則之後建立補救工作,請從 [原則指派] 頁面上的清單中選取您指派的原則。

顯示原則補救頁面的螢幕快照。

選取 [補救]。 在 [原則補救] 頁面的 [補救工作] 索引標籤中,追蹤補救工作的狀態。

顯示新補救工作頁面的螢幕快照。

如需補救工作的詳細資訊,請參閱補救不符合規範的資源

指派計劃

計劃是原則的集合。 Azure 監視器診斷設定有兩組計劃:

  1. 啟用稽核類別群組資源記錄

  2. 啟用allLogs類別群組資源記錄

在此範例中,我們會指派將稽核記錄傳送至 Log Analytics 工作區的計劃。

  1. 從原則 [定義] 頁面中,選取範圍。

  2. 從 [定義類型] 下拉式清單中,選取 [計劃]

  3. 從 [類別] 下拉式清單中選取 [監視]

  4. 在 [搜尋] 欄位中輸入 [稽核]

  5. 選取 [針對支援的資源啟用目的地為 Log Analytics 的稽核類別群組資源記錄] 計劃。

  6. 在以下頁面上選取 [指派]顯示計劃定義頁面的螢幕快照。

  7. 在 [指派計劃] 頁面的 [基本] 索引標籤上,選取您想要套用計劃的 [範圍]

  8. 在 [指派名稱] 欄位中輸入名稱。

  9. 選取 [參數] 索引標籤。顯示 [指派計劃基本] 索引標籤的螢幕快照。

    [參數] 包含原則中定義的參數。 在此案例中,我們需要選取記錄傳送目的地的 Log Analytics 工作區。 如需每個原則個別參數的詳細資訊,請參閱原則特定參數

  10. 選取稽核記錄傳送目的地的 [Log Analytics 工作區]

  11. 選取 [檢閱 + 建立],然後選取 [建立]顯示 [指派計劃參數] 索引標籤的螢幕快照。

若要確認原則或計劃指派是否正常運作,請在原則指派中定義的訂用帳戶或資源群組範圍中建立資源。

10 分鐘之後,選取資源的 [診斷設定] 頁面。 診斷設定會出現在清單中,其中包含預設名稱 setByPolicy-LogAnalytics,以及您在原則中設定的工作區名稱。

顯示資源 [診斷設定] 頁面的螢幕快照。

取消選取 [僅顯示需要輸入或檢閱的參數] 核取方塊,以在 [指派計劃] 或 [原則] 頁面中的 [參數] 索引標籤中變更預設名稱。

顯示 [編輯計劃指派] 頁面的螢幕快照,其中未選取複選框。

Common parameters

下表描述每組原則的共同參數。

參數 描述 有效的值 預設
效果 啟用或停用原則的執行 DeployIfNotExists、
AuditIfNotExists、
停用
DeployIfNotExists
diagnosticSettingName 診斷設定名稱 setByPolicy-{LogAnalytics|EventHubs|Storage}
categoryGroup 診斷類別群組 無、
稽核、
allLogs
稽核
resourceTypeList 針對計劃,要評估用於診斷設定存在的資源類型清單。 支援的資源 所有支持的資源

原則特有的參數

Log Analytics 原則參數

此原則會使用類別群組部署診斷設定,以將記錄路由傳送至 Log Analytics 工作區。

參數 描述 有效的值 預設
resourceLocationList 將記錄傳送至鄰近 Log Analytics 的資源位置清單。
"*" 選取所有位置
支援的位置 *
logAnalytics Log Analytics 工作區

事件中樞原則參數

此原則會使用類別群組部署診斷設定,以將記錄路由傳送至事件中樞。

參數 描述 有效的值 預設
resourceLocation 資源位置必須與事件中樞命名空間位於相同的位置 支援的位置
eventHubAuthorizationRuleId 事件中樞授權規則識別碼。 授權規則位於事件中樞命名空間層級。 例如,/subscriptions/{subscription ID}/resourceGroups/{resource group}/providers/Microsoft.EventHub/namespaces/{Event Hub namespace}/authorizationrules/{authorization rule}
eventHubName 事件中樞名稱 監視

儲存體帳戶原則參數

此原則會使用類別群組部署診斷設定,以將記錄路由傳送至儲存體帳戶。

參數 描述 有效的值 預設
resourceLocation 資源位置必須與儲存體帳戶位於相同位置 支援的位置
storageAccount 儲存體帳戶資源識別碼

支援的資源

Log Analytics 工作區、事件中樞和記憶體帳戶的內建所有記錄和稽核記錄原則,適用於下列資源:

資源類型 所有記錄 稽核記錄
microsoft.aad/domainservices Yes Yes
microsoft.agfoodplatform/farmbeats Yes Yes
microsoft.analysisservices/servers No
microsoft.apimanagement/service Yes Yes
microsoft.app/managedenvironments Yes Yes
microsoft.appconfiguration/configurationstores Yes Yes
microsoft.appplatform/spring No
microsoft.attestation/attestationproviders Yes Yes
microsoft.automation/automationaccounts Yes Yes
microsoft.autonomousdevelopmentplatform/workspaces No
microsoft.avs/privateclouds Yes Yes
microsoft.azureplaywrightservice/accounts Yes Yes
microsoft.azuresphere/catalogs Yes Yes
microsoft.batch/batchaccounts Yes Yes
microsoft.botservice/botservices No
microsoft.cache/redis Yes Yes
microsoft.cache/redisenterprise/databases Yes Yes
microsoft.cdn/cdnwebapplicationfirewallpolicies No
microsoft.cdn/profiles Yes Yes
microsoft.cdn/profiles/endpoints No
microsoft.chaos/experiments Yes Yes
microsoft.classicnetwork/networksecuritygroups No
microsoft.cloudtest/hostedpools No
microsoft.codeigning/codeigningaccounts Yes Yes
microsoft.cognitiveservices/accounts Yes Yes
microsoft.communication/communicationservices No
microsoft.community/communitytrainings Yes Yes
microsoft.confidentialledger/managedccfs Yes Yes
microsoft.connectedcache/enterprisemcccustomers No
microsoft.connectedcache/ispcustomers No
microsoft.containerinstance/containergroups No
microsoft.containerregistry/registries Yes Yes
microsoft.customproviders/resourceproviders No
microsoft.d365customerinsights/instances No
microsoft.dashboard/grafana Yes Yes
microsoft.databricks/workspaces No
microsoft.datafactory/factories No
microsoft.datalakeanalytics/accounts No
microsoft.datalakestore/accounts No
microsoft.dataprotection/backupvaults No
microsoft.datashare/accounts No
microsoft.dbformariadb/servers No
microsoft.dbformysql/flexibleservers Yes Yes
microsoft.dbformysql/servers No
microsoft.dbforpostgresql/flexibleservers Yes Yes
microsoft.dbforpostgresql/servergroupsv2 No
microsoft.dbforpostgresql/servers No
microsoft.desktopvirtualization/applicationgroups No
microsoft.desktopvirtualization/hostpools No
microsoft.desktopvirtualization/scalingplans No
microsoft.desktopvirtualization/workspaces No
microsoft.devcenter/devcenters Yes Yes
microsoft.devices/iothubs Yes Yes
microsoft.devices/provisioningservices No
microsoft.digitaltwins/digitaltwinsinstances No
microsoft.documentdb/cassandraclusters Yes Yes
microsoft.documentdb/databaseaccounts Yes Yes
microsoft.documentdb/mongoclusters Yes Yes
microsoft.eventgrid/domains Yes Yes
microsoft.eventgrid/partnernamespaces Yes Yes
microsoft.eventgrid/partnertopics No
microsoft.eventgrid/systemtopics No
microsoft.eventgrid/topics Yes Yes
microsoft.eventhub/namespaces Yes Yes
microsoft.experimentation/experimentworkspaces No
microsoft.healthcareapis/services No
microsoft.healthcareapis/workspaces/dicomservices No
microsoft.healthcareapis/workspaces/fhirservices No
microsoft.healthcareapis/workspaces/iotconnectors No
microsoft.insights/autoscalesettings No
microsoft.insights/components No
microsoft.insights/datacollectionrules No
microsoft.keyvault/managedhsms Yes Yes
microsoft.keyvault/vaults Yes Yes
microsoft.kusto/clusters Yes Yes
microsoft.loadtestservice/loadtests Yes Yes
microsoft.logic/integrationaccounts No
microsoft.logic/workflows No
microsoft.machinelearningservices/registries Yes Yes
microsoft.machinelearningservices/workspaces Yes Yes
microsoft.machinelearningservices/workspaces/onlineendpoints No
microsoft.managednetworkfabric/networkdevices No
microsoft.media/mediaservices Yes Yes
microsoft.media/mediaservices/liveevents Yes Yes
microsoft.media/mediaservices/streamingendpoints Yes Yes
microsoft.netapp/netappaccounts/capacitypools/volumes Yes Yes
microsoft.network/applicationgateways No
microsoft.network/azurefirewalls No
microsoft.network/bastionhosts Yes Yes
microsoft.network/dnsresolverpolicies No
microsoft.network/expressroutecircuits No
microsoft.network/frontdoors Yes Yes
microsoft.network/loadbalancers No
microsoft.network/networkmanagers Yes Yes
microsoft.network/networkmanagers/ipampools Yes Yes
microsoft.network/networksecuritygroups No
microsoft.network/networksecurityperimeters No
microsoft.network/p2svpngateways Yes Yes
microsoft.network/publicipaddresses Yes Yes
microsoft.network/publicipprefixes Yes Yes
microsoft.network/trafficmanagerprofiles No
microsoft.network/virtualnetworkgateways Yes Yes
microsoft.network/virtualnetworks No
microsoft.network/vpngateways No
microsoft.networkanalytics/dataproducts Yes Yes
microsoft.networkcloud/baremetalmachines No
microsoft.networkcloud/clusters No
microsoft.networkcloud/storageappliances No
microsoft.networkfunction/azuretrafficcollectors No
microsoft.notificationhubs/namespaces Yes Yes
microsoft.notificationhubs/namespaces/notificationhubs Yes Yes
microsoft.openenergyplatform/energyservices No
microsoft.operationalinsights/workspaces Yes Yes
microsoft.powerbi/tenants/workspaces No
microsoft.powerbidedicated/capacities No
microsoft.purview/accounts Yes Yes
microsoft.recoveryservices/vaults No
microsoft.relay/namespaces No
microsoft.search/searchservices Yes Yes
microsoft.servicebus/namespaces Yes Yes
microsoft.servicenetworking/trafficcontrollers No
microsoft.signalrservice/signalr Yes Yes
microsoft.signalrservice/webpubsub Yes Yes
microsoft.sql/managedinstances Yes Yes
microsoft.sql/managedinstances/databases No
microsoft.sql/servers/databases Yes Yes
microsoft.storagecache/caches No
microsoft.storagemover/storagemovers No
microsoft.streamanalytics/streamingjobs No
microsoft.synapse/workspaces Yes Yes
microsoft.synapse/workspaces/bigdatapools Yes Yes
microsoft.synapse/workspaces/kustopools Yes Yes
microsoft.synapse/workspaces/scopepools Yes Yes
microsoft.synapse/workspaces/sqlpools Yes Yes
microsoft.timeseriesinsights/environments No
microsoft.timeseriesinsights/environments/eventsources No
microsoft.videoindexer/accounts No
microsoft.web/hostingenvironments Yes Yes
microsoft.workloads/sapvirtualinstances Yes

後續步驟