你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
- 最新
- 2026-03-01
- 2026-01-01
- 2025-09-01
- 2025-07-01
- 2025-05-01
- 2025-03-01
- 2025-01-01
- 2024-10-01
- 2024-07-01
- 2024-05-01
- 2024-03-01
- 2024-01-01
- 2024-01-01-预览版
- 2023-11-01
- 2023-09-01
- 2023-06-01
- 2023-05-01
- 2023-04-01
- 2023-02-01
- 2022-11-01
- 2022-09-01
- 2022-07-01
- 2022-05-01
- 2022-04-01-预览版
- 2022-02-01-预览版
- 2022-01-01
- 2021-05-01-预览版
- 2021-02-01-预览版
Bicep 资源定义
可以使用目标操作部署 networkManagers/securityAdminConfigurations/ruleCollections/rules 资源类型:
- 资源组 - 请参阅 资源组部署命令
有关每个 API 版本中已更改属性的列表,请参阅 更改日志。
用法示例
Bicep 示例
部署 Network Manager 管理规则的基本示例。
param resourceName string = 'acctest0001'
param location string = 'westeurope'
resource networkManager 'Microsoft.Network/networkManagers@2022-09-01' = {
name: resourceName
location: location
properties: {
description: ''
networkManagerScopeAccesses: [
'SecurityAdmin'
]
networkManagerScopes: {
managementGroups: []
subscriptions: [
subscription().id
]
}
}
}
resource securityAdminConfiguration 'Microsoft.Network/networkManagers/securityAdminConfigurations@2022-09-01' = {
name: resourceName
parent: networkManager
properties: {
applyOnNetworkIntentPolicyBasedServices: []
}
}
resource ruleCollection 'Microsoft.Network/networkManagers/securityAdminConfigurations/ruleCollections@2022-09-01' = {
name: resourceName
parent: securityAdminConfiguration
properties: {
appliesToGroups: [
{
networkGroupId: networkGroup.id
}
]
}
}
resource rule 'Microsoft.Network/networkManagers/securityAdminConfigurations/ruleCollections/rules@2022-09-01' = {
name: resourceName
parent: ruleCollection
kind: 'Custom'
properties: {
access: 'Deny'
destinationPortRanges: []
destinations: []
direction: 'Outbound'
priority: 1
protocol: 'Tcp'
sourcePortRanges: []
sources: []
}
}
resource networkGroup 'Microsoft.Network/networkManagers/networkGroups@2022-09-01' = {
name: resourceName
parent: networkManager
properties: {}
}
Azure 验证模块
以下 Azure 验证模块 可用于部署此资源类型。
| Module | 描述 |
|---|---|
| 网络管理器 - 安全管理员配置 - 规则 Coll - 规则 | 网络管理器的AVM子模块 - 安全管理员配置 - 规则集合 - 规则 |
资源格式
若要创建 Microsoft.Network/networkManagers/securityAdminConfigurations/ruleCollections/rules 资源,请将以下 Bicep 添加到模板。
resource symbolicname 'Microsoft.Network/networkManagers/securityAdminConfigurations/ruleCollections/rules@2023-09-01' = {
name: 'string'
kind: 'string'
// For remaining properties, see Microsoft.Network/networkManagers/securityAdminConfigurations/ruleCollections/rules objects
}
Microsoft.Network/networkManagers/securityAdminConfigurations/ruleCollections/rules 对象
设置 类型 属性以指定对象的类型。
对于 自定义,请使用:
{
kind: 'Custom'
properties: {
access: 'string'
description: 'string'
destinationPortRanges: [
'string'
]
destinations: [
{
addressPrefix: 'string'
addressPrefixType: 'string'
}
]
direction: 'string'
priority: int
protocol: 'string'
sourcePortRanges: [
'string'
]
sources: [
{
addressPrefix: 'string'
addressPrefixType: 'string'
}
]
}
}
对于 默认,请使用:
{
kind: 'Default'
properties: {
flag: 'string'
}
}
属性值
Microsoft.Network/networkManagers/securityAdminConfigurations/ruleCollections/rules
| 名字 | 描述 | 价值 |
|---|---|---|
| 类 | 对于 adminRule 类型,设置为“Custom”。 对于 type DefaultAdminRule,设置为“Default”。 | “Custom” “Default”(必需) |
| 名字 | 资源名称 | string (必需) |
| 父级 | 在 Bicep 中,可以为子资源指定父资源。 仅当子资源在父资源外部声明时,才需要添加此属性。 有关详细信息,请参阅 父资源外部的子资源。 |
类型资源的符号名称:networkManagers/securityAdminConfigurations/ruleCollections |
AddressPrefixItem
| 名字 | 描述 | 价值 |
|---|---|---|
| addressPrefix 的 | 地址前缀。 | 字符串 |
| addressPrefixType | 地址前缀类型。 | “IPPrefix” “ServiceTag” |
AdminPropertiesFormat
| 名字 | 描述 | 价值 |
|---|---|---|
| 访问 | 指示此特定规则允许的访问 | “允许” “AlwaysAllow” “拒绝”(必需) |
| 描述 | 此规则的说明。 限制为 140 个字符。 | 字符串 |
| destinationPortRanges | 目标端口范围。 | 字符串[] |
| 目的地 | 目标地址前缀。 CIDR 或目标 IP 范围。 | AddressPrefixItem[] |
| 方向 | 指示流量是否与入站或出站规则匹配。 | “Inbound” “出站”(必需) |
| 优先权 | 规则的优先级。 该值可以介于 1 和 4096 之间。 对于集合中的每个规则,优先级编号必须是唯一的。 优先级编号越低,规则优先级越高。 | int 约束: 最小值 = 1 最大值 = 4096 (必需) |
| 协议 | 此规则适用于的网络协议。 | “Ah” “Any” “Esp” “Icmp” “Tcp” “Udp”(必需) |
| sourcePort范围 | 源端口范围。 | 字符串[] |
| 来源 | CIDR 或源 IP 范围。 | AddressPrefixItem[] |
管理员规则
| 名字 | 描述 | 价值 |
|---|---|---|
| 类 | 规则是自定义还是默认值。 | “Custom”(必需) |
| 性能 | 指示安全管理规则的属性 | AdminPropertiesFormat |
DefaultAdminPropertiesFormat
| 名字 | 描述 | 价值 |
|---|---|---|
| 标志 | 默认规则标志。 | 字符串 |
默认管理员规则
| 名字 | 描述 | 价值 |
|---|---|---|
| 类 | 规则是自定义还是默认值。 | “Default”(必需) |
| 性能 | 指示安全管理规则的属性 | DefaultAdminPropertiesFormat |
ARM 模板资源定义
可以使用目标操作部署 networkManagers/securityAdminConfigurations/ruleCollections/rules 资源类型:
用法示例
资源格式
若要创建 Microsoft.Network/networkManagers/securityAdminConfigurations/ruleCollections/rules 资源,请将以下 JSON 添加到模板。
{
"name": "string",
"kind": "string"
// For remaining properties, see Microsoft.Network/networkManagers/securityAdminConfigurations/ruleCollections/rules objects
}
Microsoft.Network/networkManagers/securityAdminConfigurations/ruleCollections/rules 对象
设置 类型 属性以指定对象的类型。
对于 自定义,请使用:
{
"kind": "Custom",
"properties": {
"access": "string",
"description": "string",
"destinationPortRanges": [ "string" ],
"destinations": [
{
"addressPrefix": "string",
"addressPrefixType": "string"
}
],
"direction": "string",
"priority": "int",
"protocol": "string",
"sourcePortRanges": [ "string" ],
"sources": [
{
"addressPrefix": "string",
"addressPrefixType": "string"
}
]
}
}
对于 默认,请使用:
{
"kind": "Default",
"properties": {
"flag": "string"
}
}
属性值
Microsoft.Network/networkManagers/securityAdminConfigurations/ruleCollections/rules
| 名字 | 描述 | 价值 |
|---|---|---|
| apiVersion | API 版本 | '2023-09-01' |
| 类 | 对于 adminRule 类型,设置为“Custom”。 对于 type DefaultAdminRule,设置为“Default”。 | “Custom” “Default”(必需) |
| 名字 | 资源名称 | string (必需) |
| 类型 | 资源类型 | “Microsoft.Network/networkManagers/securityAdminConfigurations/ruleCollections/rules” |
AddressPrefixItem
| 名字 | 描述 | 价值 |
|---|---|---|
| addressPrefix 的 | 地址前缀。 | 字符串 |
| addressPrefixType | 地址前缀类型。 | “IPPrefix” “ServiceTag” |
AdminPropertiesFormat
| 名字 | 描述 | 价值 |
|---|---|---|
| 访问 | 指示此特定规则允许的访问 | “允许” “AlwaysAllow” “拒绝”(必需) |
| 描述 | 此规则的说明。 限制为 140 个字符。 | 字符串 |
| destinationPortRanges | 目标端口范围。 | 字符串[] |
| 目的地 | 目标地址前缀。 CIDR 或目标 IP 范围。 | AddressPrefixItem[] |
| 方向 | 指示流量是否与入站或出站规则匹配。 | “Inbound” “出站”(必需) |
| 优先权 | 规则的优先级。 该值可以介于 1 和 4096 之间。 对于集合中的每个规则,优先级编号必须是唯一的。 优先级编号越低,规则优先级越高。 | int 约束: 最小值 = 1 最大值 = 4096 (必需) |
| 协议 | 此规则适用于的网络协议。 | “Ah” “Any” “Esp” “Icmp” “Tcp” “Udp”(必需) |
| sourcePort范围 | 源端口范围。 | 字符串[] |
| 来源 | CIDR 或源 IP 范围。 | AddressPrefixItem[] |
管理员规则
| 名字 | 描述 | 价值 |
|---|---|---|
| 类 | 规则是自定义还是默认值。 | “Custom”(必需) |
| 性能 | 指示安全管理规则的属性 | AdminPropertiesFormat |
DefaultAdminPropertiesFormat
| 名字 | 描述 | 价值 |
|---|---|---|
| 标志 | 默认规则标志。 | 字符串 |
默认管理员规则
| 名字 | 描述 | 价值 |
|---|---|---|
| 类 | 规则是自定义还是默认值。 | “Default”(必需) |
| 性能 | 指示安全管理规则的属性 | DefaultAdminPropertiesFormat |
Terraform (AzAPI 提供程序)资源定义
可以使用目标操作部署 networkManagers/securityAdminConfigurations/ruleCollections/rules 资源类型:
- 资源组 关于每个API版本中变更属性的列表,请参见 更改日志。
用法示例
Terraform 示例
部署 Network Manager 管理规则的基本示例。
terraform {
required_providers {
azapi = {
source = "Azure/azapi"
}
azurerm = {
source = "hashicorp/azurerm"
}
}
}
provider "azurerm" {
features {
}
}
provider "azapi" {
skip_provider_registration = false
}
variable "resource_name" {
type = string
default = "acctest0001"
}
variable "location" {
type = string
default = "westeurope"
}
data "azurerm_client_config" "current" {
}
data "azapi_resource" "subscription" {
type = "Microsoft.Resources/subscriptions@2021-01-01"
resource_id = "/subscriptions/${data.azurerm_client_config.current.subscription_id}"
response_export_values = ["*"]
}
resource "azapi_resource" "resourceGroup" {
type = "Microsoft.Resources/resourceGroups@2020-06-01"
name = var.resource_name
location = var.location
}
resource "azapi_resource" "networkManager" {
type = "Microsoft.Network/networkManagers@2022-09-01"
parent_id = azapi_resource.resourceGroup.id
name = var.resource_name
location = var.location
body = {
properties = {
description = ""
networkManagerScopeAccesses = [
"SecurityAdmin",
]
networkManagerScopes = {
managementGroups = [
]
subscriptions = [
data.azapi_resource.subscription.id,
]
}
}
}
schema_validation_enabled = false
response_export_values = ["*"]
}
resource "azapi_resource" "securityAdminConfiguration" {
type = "Microsoft.Network/networkManagers/securityAdminConfigurations@2022-09-01"
parent_id = azapi_resource.networkManager.id
name = var.resource_name
body = {
properties = {
applyOnNetworkIntentPolicyBasedServices = []
}
}
schema_validation_enabled = false
response_export_values = ["*"]
}
resource "azapi_resource" "networkGroup" {
type = "Microsoft.Network/networkManagers/networkGroups@2022-09-01"
parent_id = azapi_resource.networkManager.id
name = var.resource_name
body = {
properties = {
}
}
schema_validation_enabled = false
response_export_values = ["*"]
}
resource "azapi_resource" "ruleCollection" {
type = "Microsoft.Network/networkManagers/securityAdminConfigurations/ruleCollections@2022-09-01"
parent_id = azapi_resource.securityAdminConfiguration.id
name = var.resource_name
body = {
properties = {
appliesToGroups = [
{
networkGroupId = azapi_resource.networkGroup.id
},
]
}
}
schema_validation_enabled = false
response_export_values = ["*"]
}
resource "azapi_resource" "rule" {
type = "Microsoft.Network/networkManagers/securityAdminConfigurations/ruleCollections/rules@2022-09-01"
parent_id = azapi_resource.ruleCollection.id
name = var.resource_name
body = {
kind = "Custom"
properties = {
access = "Deny"
destinationPortRanges = []
destinations = []
direction = "Outbound"
priority = 1
protocol = "Tcp"
sourcePortRanges = []
sources = []
}
}
schema_validation_enabled = false
response_export_values = ["*"]
}
资源格式
若要创建 Microsoft.Network/networkManagers/securityAdminConfigurations/ruleCollections/rules 资源,请将以下 Terraform 添加到模板。
resource "azapi_resource" "symbolicname" {
name = "string"
kind = "string"
// For remaining properties, see Microsoft.Network/networkManagers/securityAdminConfigurations/ruleCollections/rules objects
}
Microsoft.Network/networkManagers/securityAdminConfigurations/ruleCollections/rules 对象
设置 类型 属性以指定对象的类型。
对于 自定义,请使用:
{
kind = "Custom"
properties = {
access = "string"
description = "string"
destinationPortRanges = [
"string"
]
destinations = [
{
addressPrefix = "string"
addressPrefixType = "string"
}
]
direction = "string"
priority = int
protocol = "string"
sourcePortRanges = [
"string"
]
sources = [
{
addressPrefix = "string"
addressPrefixType = "string"
}
]
}
}
对于 默认,请使用:
{
kind = "Default"
properties = {
flag = "string"
}
}
属性值
Microsoft.Network/networkManagers/securityAdminConfigurations/ruleCollections/rules
| 名字 | 描述 | 价值 |
|---|---|---|
| 类 | 对于 adminRule 类型,设置为“Custom”。 对于 type DefaultAdminRule,设置为“Default”。 | “Custom” “Default”(必需) |
| 名字 | 资源名称 | string (必需) |
| parent_id | 此资源的父资源的 ID。 | 类型资源的 ID:networkManagers/securityAdminConfigurations/ruleCollections |
| 类型 | 资源类型 | “Microsoft.Network/networkManagers/securityAdminConfigurations/ruleCollections/rules@2023-09-01” |
AddressPrefixItem
| 名字 | 描述 | 价值 |
|---|---|---|
| addressPrefix 的 | 地址前缀。 | 字符串 |
| addressPrefixType | 地址前缀类型。 | “IPPrefix” “ServiceTag” |
AdminPropertiesFormat
| 名字 | 描述 | 价值 |
|---|---|---|
| 访问 | 指示此特定规则允许的访问 | “允许” “AlwaysAllow” “拒绝”(必需) |
| 描述 | 此规则的说明。 限制为 140 个字符。 | 字符串 |
| destinationPortRanges | 目标端口范围。 | 字符串[] |
| 目的地 | 目标地址前缀。 CIDR 或目标 IP 范围。 | AddressPrefixItem[] |
| 方向 | 指示流量是否与入站或出站规则匹配。 | “Inbound” “出站”(必需) |
| 优先权 | 规则的优先级。 该值可以介于 1 和 4096 之间。 对于集合中的每个规则,优先级编号必须是唯一的。 优先级编号越低,规则优先级越高。 | int 约束: 最小值 = 1 最大值 = 4096 (必需) |
| 协议 | 此规则适用于的网络协议。 | “Ah” “Any” “Esp” “Icmp” “Tcp” “Udp”(必需) |
| sourcePort范围 | 源端口范围。 | 字符串[] |
| 来源 | CIDR 或源 IP 范围。 | AddressPrefixItem[] |
管理员规则
| 名字 | 描述 | 价值 |
|---|---|---|
| 类 | 规则是自定义还是默认值。 | “Custom”(必需) |
| 性能 | 指示安全管理规则的属性 | AdminPropertiesFormat |
DefaultAdminPropertiesFormat
| 名字 | 描述 | 价值 |
|---|---|---|
| 标志 | 默认规则标志。 | 字符串 |
默认管理员规则
| 名字 | 描述 | 价值 |
|---|---|---|
| 类 | 规则是自定义还是默认值。 | “Default”(必需) |
| 性能 | 指示安全管理规则的属性 | DefaultAdminPropertiesFormat |