Flow Logs - Create Or Update
建立或更新指定網路安全性群組的流程記錄。
PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/flowLogs/{flowLogName}?api-version=2025-05-01
URI 參數
| 名稱 | 位於 | 必要 | 類型 | Description |
|---|---|---|---|---|
|
flow
|
path | True |
string |
流程記錄資源的名稱。 |
|
network
|
path | True |
string |
網路監看員的名稱。 |
|
resource
|
path | True |
string minLength: 1maxLength: 90 |
資源群組的名稱。 名稱不區分大小寫。 |
|
subscription
|
path | True |
string (uuid) |
目標訂用帳戶的標識碼。 此值必須是 UUID。 |
|
api-version
|
query | True |
string minLength: 1 |
用於此作業的 API 版本。 |
要求本文
| 名稱 | 必要 | 類型 | Description |
|---|---|---|---|
| properties.storageId | True |
string |
用來儲存流量記錄的記憶體帳戶標識碼。 |
| properties.targetResourceId | True |
string |
將套用流量記錄的網路安全組標識碼。 |
| id |
string |
資源標識碼。 |
|
| identity |
FlowLog 資源受控識別 |
||
| location |
string |
資源位置。 |
|
| properties.enabled |
boolean |
啟用/停用流量記錄的旗標。 |
|
| properties.enabledFilteringCriteria |
string |
選擇性欄位,可根據 SrcIP、SrcPort、DstIP、DstPort、通訊協定、加密、方向和動作來篩選網路流量記錄。 如果未指定,則會記錄所有網路流量。 |
|
| properties.flowAnalyticsConfiguration |
定義使用分析組態的參數。 |
||
| properties.format |
定義流程記錄格式的參數。 |
||
| properties.recordTypes |
string |
可選欄位可根據流量狀態過濾網路流量日誌。 此欄位的值可以是任何以逗號分隔的字母 B、C、E 或 D 組成的組合字串。B 代表開始,當流程被創造時。 C 代表每五分鐘產生的持續流量,持續進行。 E 代表結束,當流程終止時。 D 代表拒絕,當一個流被拒絕時。 如果未指定,則會記錄所有網路流量。 |
|
| properties.retentionPolicy |
定義流量記錄保留原則的參數。 |
||
| tags |
object |
資源標籤。 |
回應
| 名稱 | 類型 | Description |
|---|---|---|
| 200 OK |
資源「FlowLog」更新操作成功 |
|
| 201 Created |
資源「FlowLog」建立操作成功 標題
|
|
| Other Status Codes |
未預期的錯誤回應。 |
安全性
azure_auth
Azure Active Directory OAuth2 Flow。
類型:
oauth2
Flow:
implicit
授權 URL:
https://login.microsoftonline.com/common/oauth2/authorize
範圍
| 名稱 | Description |
|---|---|
| user_impersonation | 模擬您的用戶帳戶 |
範例
Create or update flow log
範例要求
PUT https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Network/networkWatchers/nw1/flowLogs/fl?api-version=2025-05-01
{
"identity": {
"type": "UserAssigned",
"userAssignedIdentities": {
"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id1": {}
}
},
"location": "centraluseuap",
"properties": {
"format": {
"type": "JSON",
"version": 1
},
"enabled": true,
"enabledFilteringCriteria": "srcIP=158.255.7.8 || dstPort=56891",
"recordTypes": "B,E",
"storageId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Storage/storageAccounts/nwtest1mgvbfmqsigdxe",
"targetResourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Network/networkSecurityGroups/desmondcentral-nsg"
}
}
範例回覆
{
"name": "Microsoft.Networkdesmond-rgdesmondcentral-nsg",
"type": "Microsoft.Network/networkWatchers/FlowLogs",
"etag": "W/\"00000000-0000-0000-0000-000000000000\"",
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Network/networkWatchers/nw/FlowLogs/fl",
"identity": {
"type": "UserAssigned",
"userAssignedIdentities": {
"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id1": {
"clientId": "c16d15e1-f60a-40e4-8a05-df3d3f655c14",
"principalId": "e3858881-e40c-43bd-9cde-88da39c05023"
}
}
},
"location": "centraluseuap",
"properties": {
"format": {
"type": "JSON",
"version": 1
},
"enabled": true,
"enabledFilteringCriteria": "srcIP=158.255.7.8 || dstPort=56891",
"flowAnalyticsConfiguration": {},
"provisioningState": "Updating",
"recordTypes": "B,E",
"retentionPolicy": {
"days": 0,
"enabled": false
},
"storageId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Storage/storageAccounts/nwtest1mgvbfmqsigdxe",
"targetResourceGuid": "00000000-0000-0000-0000-000000000000",
"targetResourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Network/networkSecurityGroups/desmondcentral-nsg"
}
}
{
"name": "Microsoft.Networkdesmond-rgdesmondcentral-nsg",
"type": "Microsoft.Network/networkWatchers/FlowLogs",
"etag": "W/\"00000000-0000-0000-0000-000000000000\"",
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Network/networkWatchers/nw/FlowLogs/fl",
"identity": {
"type": "UserAssigned",
"userAssignedIdentities": {
"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id1": {
"clientId": "c16d15e1-f60a-40e4-8a05-df3d3f655c14",
"principalId": "e3858881-e40c-43bd-9cde-88da39c05023"
}
}
},
"location": "centraluseuap",
"properties": {
"format": {
"type": "JSON",
"version": 1
},
"enabled": true,
"enabledFilteringCriteria": "srcIP=158.255.7.8 || dstPort=56891",
"flowAnalyticsConfiguration": {},
"provisioningState": "Succeeded",
"recordTypes": "B,E",
"retentionPolicy": {
"days": 0,
"enabled": false
},
"storageId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Storage/storageAccounts/nwtest1mgvbfmqsigdxe",
"targetResourceGuid": "00000000-0000-0000-0000-000000000000",
"targetResourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Network/networkSecurityGroups/desmondcentral-nsg"
}
}
定義
| 名稱 | Description |
|---|---|
|
Common. |
流量記錄資源。 |
|
Common. |
定義流程記錄格式的參數。 |
|
Common. |
資源的身分識別。 |
|
Common. |
定義流量記錄保留原則的參數。 |
|
Common. |
定義使用分析組態的參數。 |
|
Common. |
定義使用分析組態的參數。 |
|
Error |
常見的錯誤詳細數據表示。 |
|
Error |
錯誤物件。 |
|
Flow |
流量記錄檔的文件類型。 |
|
Managed |
|
|
Provisioning |
流量記錄的布建狀態。 |
|
Resource |
用於資源的身分識別類型。 類型 'SystemAssigned, UserAssigned' 包含隱含建立的身分識別和一組使用者指派的身分識別。 類型 『None』 會從虛擬機中移除任何身分識別。 |
Common.FlowLog
流量記錄資源。
| 名稱 | 類型 | Description |
|---|---|---|
| etag |
string |
每當更新資源時變更的唯一隻讀字串。 |
| id |
string |
資源標識碼。 |
| identity |
FlowLog 資源受控識別 |
|
| location |
string |
資源位置。 |
| name |
string |
資源名稱。 |
| properties.enabled |
boolean |
啟用/停用流量記錄的旗標。 |
| properties.enabledFilteringCriteria |
string |
選擇性欄位,可根據 SrcIP、SrcPort、DstIP、DstPort、通訊協定、加密、方向和動作來篩選網路流量記錄。 如果未指定,則會記錄所有網路流量。 |
| properties.flowAnalyticsConfiguration |
定義使用分析組態的參數。 |
|
| properties.format |
定義流程記錄格式的參數。 |
|
| properties.provisioningState |
流量記錄的布建狀態。 |
|
| properties.recordTypes |
string |
可選欄位可根據流量狀態過濾網路流量日誌。 此欄位的值可以是任何以逗號分隔的字母 B、C、E 或 D 組成的組合字串。B 代表開始,當流程被創造時。 C 代表每五分鐘產生的持續流量,持續進行。 E 代表結束,當流程終止時。 D 代表拒絕,當一個流被拒絕時。 如果未指定,則會記錄所有網路流量。 |
| properties.retentionPolicy |
定義流量記錄保留原則的參數。 |
|
| properties.storageId |
string |
用來儲存流量記錄的記憶體帳戶標識碼。 |
| properties.targetResourceGuid |
string |
將套用流量記錄的網路安全組 GUID。 |
| properties.targetResourceId |
string |
將套用流量記錄的網路安全組標識碼。 |
| tags |
object |
資源標籤。 |
| type |
string |
資源類型。 |
Common.FlowLogFormatParameters
定義流程記錄格式的參數。
| 名稱 | 類型 | 預設值 | Description |
|---|---|---|---|
| type |
流量記錄檔的文件類型。 |
||
| version |
integer (int32) |
0 |
流程記錄的版本(修訂)。 |
Common.ManagedServiceIdentity
資源的身分識別。
| 名稱 | 類型 | Description |
|---|---|---|
| principalId |
string |
系統指派身分的主體識別碼。 此屬性只會針對系統指派的身分識別提供。 |
| tenantId |
string |
系統指派身分識別的租用戶識別碼。 此屬性只會針對系統指派的身分識別提供。 |
| type |
用於資源的身分識別類型。 類型 'SystemAssigned, UserAssigned' 包含隱含建立的身分識別和一組使用者指派的身分識別。 類型 『None』 會從虛擬機中移除任何身分識別。 |
|
| userAssignedIdentities |
與資源相關聯的使用者身分識別清單。 使用者身分識別字典索引鍵參考的格式為 ARM 資源標識符:'/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'。 |
Common.RetentionPolicyParameters
定義流量記錄保留原則的參數。
| 名稱 | 類型 | 預設值 | Description |
|---|---|---|---|
| days |
integer (int32) |
0 |
保留流量記錄檔記錄的天數。 |
| enabled |
boolean |
False |
啟用/停用保留的旗標。 |
Common.TrafficAnalyticsConfigurationProperties
定義使用分析組態的參數。
| 名稱 | 類型 | Description |
|---|---|---|
| enabled |
boolean |
啟用/停用使用分析的旗標。 |
| trafficAnalyticsInterval |
integer (int32) |
以分鐘為單位的間隔,決定TA服務應該執行流程分析的頻率。 |
| workspaceId |
string |
附加工作區的資源 GUID。 |
| workspaceRegion |
string |
附加工作區的位置。 |
| workspaceResourceId |
string |
附加工作區的資源標識碼。 |
Common.TrafficAnalyticsProperties
定義使用分析組態的參數。
| 名稱 | 類型 | Description |
|---|---|---|
| networkWatcherFlowAnalyticsConfiguration |
定義使用分析組態的參數。 |
ErrorDetails
常見的錯誤詳細數據表示。
| 名稱 | 類型 | Description |
|---|---|---|
| code |
string |
錯誤碼。 |
| message |
string |
錯誤訊息。 |
| target |
string |
錯誤目標。 |
ErrorResponse
錯誤物件。
| 名稱 | 類型 | Description |
|---|---|---|
| error |
錯誤 |
FlowLogFormatType
流量記錄檔的文件類型。
| 值 | Description |
|---|---|
| JSON |
JSON |
ManagedServiceIdentityUserAssignedIdentities
| 名稱 | 類型 | Description |
|---|---|---|
| clientId |
string |
使用者指派身分識別的用戶端標識碼。 |
| principalId |
string |
使用者指派身分識別的主體標識碼。 |
ProvisioningState
流量記錄的布建狀態。
| 值 | Description |
|---|---|
| Failed |
失敗 |
| Succeeded |
成功 |
| Canceled |
已取消 |
| Creating |
建立中 |
| Updating |
更新中 |
| Deleting |
刪除中 |
ResourceIdentityType
用於資源的身分識別類型。 類型 'SystemAssigned, UserAssigned' 包含隱含建立的身分識別和一組使用者指派的身分識別。 類型 『None』 會從虛擬機中移除任何身分識別。
| 值 | Description |
|---|---|
| SystemAssigned |
系統分配的 |
| UserAssigned |
UserAssigned |
| SystemAssigned, UserAssigned |
SystemAssigned、UserAssigned |
| None |
沒有 |