Admin Rules - Create Or Update
建立或更新管理規則。
PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityAdminConfigurations/{configurationName}/ruleCollections/{ruleCollectionName}/rules/{ruleName}?api-version=2025-05-01
URI 參數
| 名稱 | 位於 | 必要 | 類型 | Description |
|---|---|---|---|---|
|
configuration
|
path | True |
string |
網路管理員安全性組態的名稱。 |
|
network
|
path | True |
string pattern: ^[0-9a-zA-Z]([0-9a-zA-Z_.-]{0,62}[0-9a-zA-Z_])?$ |
網路管理員的名稱。 |
|
resource
|
path | True |
string minLength: 1maxLength: 90 |
資源群組的名稱。 名稱不區分大小寫。 |
|
rule
|
path | True |
string |
網路管理員安全性組態規則集合的名稱。 |
|
rule
|
path | True |
string |
規則的名稱。 |
|
subscription
|
path | True |
string (uuid) |
目標訂用帳戶的標識碼。 此值必須是 UUID。 |
|
api-version
|
query | True |
string minLength: 1 |
用於此作業的 API 版本。 |
要求本文
要求主體可以是下列其中一項:
| 名稱 | Description |
|---|---|
|
Admin |
網路管理規則。 |
|
Default |
網路預設管理員規則。 |
AdminRule
網路管理規則。
| 名稱 | 必要 | 類型 | Description |
|---|---|---|---|
| kind | True |
string:
Custom |
規則是自定義還是預設值。 |
| properties.access | True |
指出此特定規則所允許的存取權 |
|
| properties.direction | True |
指出流量是否符合輸入或輸出中的規則。 |
|
| properties.priority | True |
integer (int32) minimum: 1maximum: 4096 |
規則的優先順序。 此值可以介於 1 到 4096 之間。 集合中每個規則的優先順序號碼必須是唯一的。 優先順序數位越低,規則的優先順序就越高。 |
| properties.protocol | True |
此規則適用的網路協定。 |
|
| properties.description |
string |
此規則的描述。 限制為140個字元。 |
|
| properties.destinationPortRanges |
string[] |
目的地埠範圍。 |
|
| properties.destinations |
目的地位址前置詞。 CIDR 或目的地IP範圍。 |
||
| properties.sourcePortRanges |
string[] |
來源埠範圍。 |
|
| properties.sources |
CIDR 或來源IP範圍。 |
DefaultAdminRule
網路預設管理員規則。
| 名稱 | 必要 | 類型 | Description |
|---|---|---|---|
| kind | True |
string:
Default |
規則是自定義還是預設值。 |
| properties.flag |
string |
默認規則旗標。 |
回應
| 名稱 | 類型 | Description |
|---|---|---|
| 200 OK | BaseAdminRule: |
資源「BaseAdminRule」更新操作成功 |
| 201 Created | BaseAdminRule: |
資源 'BaseAdminRule' create 操作成功 |
| 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 a admin rule with network group as source or destination |
| Create an admin rule |
Create a admin rule with network group as source or destination
範例要求
PUT https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Network/networkManagers/testNetworkManager/securityAdminConfigurations/myTestSecurityConfig/ruleCollections/testRuleCollection/rules/SampleAdminRule?api-version=2025-05-01
{
"kind": "Custom",
"properties": {
"description": "This is Sample Admin Rule",
"access": "Deny",
"destinationPortRanges": [
"22"
],
"destinations": [
{
"addressPrefix": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Network/networkManagers/testNetworkManager/networkGroups/ng1",
"addressPrefixType": "NetworkGroup"
}
],
"direction": "Inbound",
"priority": 1,
"sourcePortRanges": [
"0-65535"
],
"sources": [
{
"addressPrefix": "Internet",
"addressPrefixType": "ServiceTag"
}
],
"protocol": "Tcp"
}
}
範例回覆
{
"name": "SampleAdminRule",
"type": "Microsoft.Network/networkManagers/securityAdminConfigurations/ruleCollections/rules",
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Network/networkManagers/testNetworkManager/securityAdminConfigurations/myTestSecurityConfig/ruleCollections/testRuleCollection/rules/SampleAdminRule",
"kind": "Custom",
"properties": {
"description": "This is Sample Admin Rule using a network group as a source and destination.",
"access": "Deny",
"destinationPortRanges": [
"22"
],
"destinations": [
{
"addressPrefix": "*",
"addressPrefixType": "IPPrefix"
}
],
"direction": "Inbound",
"priority": 1,
"provisioningState": "Succeeded",
"sourcePortRanges": [
"0-65535"
],
"sources": [
{
"addressPrefix": "Internet",
"addressPrefixType": "ServiceTag"
}
],
"protocol": "Tcp"
},
"systemData": {
"createdAt": "2021-01-11T18:52:27Z",
"createdBy": "b69a9388-9488-4534-b470-7ec6d41beef5",
"createdByType": "User",
"lastModifiedAt": "2021-01-11T18:52:27Z",
"lastModifiedBy": "b69a9388-9488-4534-b470-7ec6d41beef5",
"lastModifiedByType": "User"
}
}
{
"name": "SampleAdminRule",
"type": "Microsoft.Network/networkManagers/securityAdminConfigurations/ruleCollections/rules",
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Network/networkManagers/testNetworkManager/securityAdminConfigurations/myTestSecurityConfig/ruleCollections/testRuleCollection/rules/SampleAdminRule",
"kind": "Custom",
"properties": {
"description": "This is Sample Admin Rule using a network group as a source and destination.",
"access": "Deny",
"destinationPortRanges": [
"22"
],
"destinations": [
{
"addressPrefix": "*",
"addressPrefixType": "IPPrefix"
}
],
"direction": "Inbound",
"priority": 1,
"provisioningState": "Succeeded",
"sourcePortRanges": [
"0-65535"
],
"sources": [
{
"addressPrefix": "Internet",
"addressPrefixType": "ServiceTag"
}
],
"protocol": "Tcp"
},
"systemData": {
"createdAt": "2021-01-11T18:52:27Z",
"createdBy": "b69a9388-9488-4534-b470-7ec6d41beef5",
"createdByType": "User",
"lastModifiedAt": "2021-01-11T18:52:27Z",
"lastModifiedBy": "b69a9388-9488-4534-b470-7ec6d41beef5",
"lastModifiedByType": "User"
}
}
Create an admin rule
範例要求
PUT https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Network/networkManagers/testNetworkManager/securityAdminConfigurations/myTestSecurityConfig/ruleCollections/testRuleCollection/rules/SampleAdminRule?api-version=2025-05-01
{
"kind": "Custom",
"properties": {
"description": "This is Sample Admin Rule",
"access": "Deny",
"destinationPortRanges": [
"22"
],
"destinations": [
{
"addressPrefix": "*",
"addressPrefixType": "IPPrefix"
}
],
"direction": "Inbound",
"priority": 1,
"sourcePortRanges": [
"0-65535"
],
"sources": [
{
"addressPrefix": "Internet",
"addressPrefixType": "ServiceTag"
}
],
"protocol": "Tcp"
}
}
範例回覆
{
"name": "SampleAdminRule",
"type": "Microsoft.Network/networkManagers/securityAdminConfigurations/ruleCollections/rules",
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Network/networkManagers/testNetworkManager/securityAdminConfigurations/myTestSecurityConfig/ruleCollections/testRuleCollection/rules/SampleAdminRule",
"kind": "Custom",
"properties": {
"description": "This is Sample Admin Rule",
"access": "Deny",
"destinationPortRanges": [
"22"
],
"destinations": [
{
"addressPrefix": "*",
"addressPrefixType": "IPPrefix"
}
],
"direction": "Inbound",
"priority": 1,
"provisioningState": "Succeeded",
"resourceGuid": "00000000-0000-0000-0000-000000000000",
"sourcePortRanges": [
"0-65535"
],
"sources": [
{
"addressPrefix": "Internet",
"addressPrefixType": "ServiceTag"
}
],
"protocol": "Tcp"
},
"systemData": {
"createdAt": "2021-01-11T18:52:27Z",
"createdBy": "b69a9388-9488-4534-b470-7ec6d41beef5",
"createdByType": "User",
"lastModifiedAt": "2021-01-11T18:52:27Z",
"lastModifiedBy": "b69a9388-9488-4534-b470-7ec6d41beef5",
"lastModifiedByType": "User"
}
}
{
"name": "SampleAdminRule",
"type": "Microsoft.Network/networkManagers/securityAdminConfigurations/ruleCollections/rules",
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Network/networkManagers/testNetworkManager/securityAdminConfigurations/myTestSecurityConfig/ruleCollections/testRuleCollection/rules/SampleAdminRule",
"kind": "Custom",
"properties": {
"description": "This is Sample Admin Rule",
"access": "Deny",
"destinationPortRanges": [
"22"
],
"destinations": [
{
"addressPrefix": "*",
"addressPrefixType": "IPPrefix"
}
],
"direction": "Inbound",
"priority": 1,
"provisioningState": "Succeeded",
"resourceGuid": "00000000-0000-0000-0000-000000000000",
"sourcePortRanges": [
"0-65535"
],
"sources": [
{
"addressPrefix": "Internet",
"addressPrefixType": "ServiceTag"
}
],
"protocol": "Tcp"
},
"systemData": {
"createdAt": "2021-01-11T18:52:27Z",
"createdBy": "b69a9388-9488-4534-b470-7ec6d41beef5",
"createdByType": "User",
"lastModifiedAt": "2021-01-11T18:52:27Z",
"lastModifiedBy": "b69a9388-9488-4534-b470-7ec6d41beef5",
"lastModifiedByType": "User"
}
}
定義
| 名稱 | Description |
|---|---|
|
Address |
位址前置詞專案。 |
|
Address |
位址前置詞類型。 |
|
Admin |
網路管理規則。 |
|
Admin |
規則是自定義還是預設值。 |
|
Common |
資源管理錯誤其他資訊。 |
|
Common |
錯誤詳細數據。 |
|
Common |
錯誤回應 |
|
created |
建立資源的身分識別類型。 |
|
Default |
網路預設管理員規則。 |
|
Provisioning |
布建資源的狀態。 |
|
Security |
是否允許或拒絕網路流量。 |
|
Security |
規則的方向。 方向指定是否要評估規則的傳入或傳出流量。 |
|
Security |
此規則適用的網路協定。 |
|
system |
與建立和上次修改資源相關的元數據。 |
AddressPrefixItem
位址前置詞專案。
| 名稱 | 類型 | Description |
|---|---|---|
| addressPrefix |
string |
位址前置詞。 |
| addressPrefixType |
位址前置詞類型。 |
AddressPrefixType
位址前置詞類型。
| 值 | Description |
|---|---|
| IPPrefix |
IPPrefix |
| ServiceTag |
服務標籤 |
| NetworkGroup |
NetworkGroup |
AdminRule
網路管理規則。
| 名稱 | 類型 | Description |
|---|---|---|
| etag |
string |
每當更新資源時變更的唯一隻讀字串。 |
| id |
string |
資源標識碼。 |
| kind |
string:
Custom |
規則是自定義還是預設值。 |
| name |
string |
資源名稱。 |
| properties.access |
指出此特定規則所允許的存取權 |
|
| properties.description |
string |
此規則的描述。 限制為140個字元。 |
| properties.destinationPortRanges |
string[] |
目的地埠範圍。 |
| properties.destinations |
目的地位址前置詞。 CIDR 或目的地IP範圍。 |
|
| properties.direction |
指出流量是否符合輸入或輸出中的規則。 |
|
| properties.priority |
integer (int32) minimum: 1maximum: 4096 |
規則的優先順序。 此值可以介於 1 到 4096 之間。 集合中每個規則的優先順序號碼必須是唯一的。 優先順序數位越低,規則的優先順序就越高。 |
| properties.protocol |
此規則適用的網路協定。 |
|
| properties.provisioningState |
資源的布建狀態。 |
|
| properties.resourceGuid |
string |
此資源的唯一標識碼。 |
| properties.sourcePortRanges |
string[] |
來源埠範圍。 |
| properties.sources |
CIDR 或來源IP範圍。 |
|
| systemData |
與此資源相關的系統元數據。 |
|
| type |
string |
資源類型。 |
AdminRuleKind
規則是自定義還是預設值。
| 值 | Description |
|---|---|
| Custom |
自定義 |
| Default |
預設值 |
CommonErrorAdditionalInfo
資源管理錯誤其他資訊。
| 名稱 | 類型 | Description |
|---|---|---|
| info |
附加資訊。 |
|
| type |
string |
其他資訊類型。 |
CommonErrorDetail
錯誤詳細數據。
| 名稱 | 類型 | Description |
|---|---|---|
| additionalInfo |
錯誤附加資訊。 |
|
| code |
string |
錯誤碼。 |
| details |
錯誤詳細數據。 |
|
| message |
string |
錯誤訊息。 |
| target |
string |
錯誤目標。 |
CommonErrorResponse
錯誤回應
| 名稱 | 類型 | Description |
|---|---|---|
| error |
錯誤物件。 |
createdByType
建立資源的身分識別類型。
| 值 | Description |
|---|---|
| User | |
| Application | |
| ManagedIdentity | |
| Key |
DefaultAdminRule
網路預設管理員規則。
| 名稱 | 類型 | Description |
|---|---|---|
| etag |
string |
每當更新資源時變更的唯一隻讀字串。 |
| id |
string |
資源標識碼。 |
| kind |
string:
Default |
規則是自定義還是預設值。 |
| name |
string |
資源名稱。 |
| properties.access |
指出此特定規則所允許的存取權 |
|
| properties.description |
string |
此規則的描述。 限制為140個字元。 |
| properties.destinationPortRanges |
string[] |
目的地埠範圍。 |
| properties.destinations |
目的地位址前置詞。 CIDR 或目的地IP範圍。 |
|
| properties.direction |
指出流量是否符合輸入或輸出中的規則。 |
|
| properties.flag |
string |
默認規則旗標。 |
| properties.priority |
integer (int32) |
規則的優先順序。 此值可以介於 1 到 4096 之間。 集合中每個規則的優先順序號碼必須是唯一的。 優先順序數位越低,規則的優先順序就越高。 |
| properties.protocol |
此規則適用的網路協定。 |
|
| properties.provisioningState |
資源的布建狀態。 |
|
| properties.resourceGuid |
string |
此資源的唯一標識碼。 |
| properties.sourcePortRanges |
string[] |
來源埠範圍。 |
| properties.sources |
CIDR 或來源IP範圍。 |
|
| systemData |
與此資源相關的系統元數據。 |
|
| type |
string |
資源類型。 |
ProvisioningState
布建資源的狀態。
| 值 | Description |
|---|---|
| Failed |
失敗 |
| Succeeded |
成功 |
| Canceled |
已取消 |
| Creating |
建立中 |
| Updating |
更新中 |
| Deleting |
刪除中 |
SecurityConfigurationRuleAccess
是否允許或拒絕網路流量。
| 值 | Description |
|---|---|
| Allow |
允許 |
| Deny |
Deny |
| AlwaysAllow |
永遠允許 |
SecurityConfigurationRuleDirection
規則的方向。 方向指定是否要評估規則的傳入或傳出流量。
| 值 | Description |
|---|---|
| Inbound |
Inbound |
| Outbound |
Outbound |
SecurityConfigurationRuleProtocol
此規則適用的網路協定。
| 值 | Description |
|---|---|
| Tcp |
Tcp |
| Udp |
Udp |
| Icmp |
ICMP的 |
| Esp |
埃斯普 |
| Any |
任意 |
| Ah |
喲 |
systemData
與建立和上次修改資源相關的元數據。
| 名稱 | 類型 | Description |
|---|---|---|
| createdAt |
string (date-time) |
資源建立的時間戳(UTC)。 |
| createdBy |
string |
建立資源的身分識別。 |
| createdByType |
建立資源的身分識別類型。 |
|
| lastModifiedAt |
string (date-time) |
資源上次修改的時間戳記 (UTC) |
| lastModifiedBy |
string |
上次修改資源的身分識別。 |
| lastModifiedByType |
上次修改資源的身分識別類型。 |