你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。

Microsoft.Network virtualHubs/routing意向 2023-04-01

Bicep 资源定义

可以使用目标操作部署 virtualHubs/routingIntent 资源类型:

有关每个 API 版本中已更改属性的列表,请参阅 更改日志。

用法示例

Azure 验证模块

以下 Azure 验证模块 可用于部署此资源类型。

模块 描述
虚拟枢纽 - 路由意图 虚拟枢纽的AVM子模块——路由意图

资源格式

若要创建 Microsoft.Network/virtualHubs/routingIntent 资源,请将以下 Bicep 添加到模板。

resource symbolicname 'Microsoft.Network/virtualHubs/routingIntent@2023-04-01' = {
  parent: resourceSymbolicName
  name: 'string'
  properties: {
    routingPolicies: [
      {
        destinations: [
          'string'
        ]
        name: 'string'
        nextHop: 'string'
      }
    ]
  }
}

属性值

Microsoft.Network/virtualHubs/routingIntent

名字 描述 价值
名字 资源名称 string (必需)
父级 在 Bicep 中,可以为子资源指定父资源。 仅当子资源在父资源外部声明时,才需要添加此属性。

有关详细信息,请参阅 父资源外部的子资源。
类型资源的符号名称:virtualHubs
性能 RoutingIntent 资源的属性。 RoutingIntentProperties

RoutingIntentProperties

名字 描述 价值
routingPolicies 路由策略列表。 路由策略

路由策略

名字 描述 价值
目的地 此路由策略适用于的所有目标列表(例如:Internet、PrivateTraffic)。 string[] (必需)
名字 路由策略的唯一名称。 string (必需)
nextHop 此路由策略适用的下一跃点资源 ID。 string (必需)

ARM 模板资源定义

可以使用目标操作部署 virtualHubs/routingIntent 资源类型:

用法示例

资源格式

若要创建 Microsoft.Network/virtualHubs/routingIntent 资源,请将以下 JSON 添加到模板。

{
  "type": "Microsoft.Network/virtualHubs/routingIntent",
  "apiVersion": "2023-04-01",
  "name": "string",
  "properties": {
    "routingPolicies": [
      {
        "destinations": [ "string" ],
        "name": "string",
        "nextHop": "string"
      }
    ]
  }
}

属性值

Microsoft.Network/virtualHubs/routingIntent

名字 描述 价值
apiVersion API 版本 '2023-04-01'
名字 资源名称 string (必需)
性能 RoutingIntent 资源的属性。 RoutingIntentProperties
类型 资源类型 “Microsoft.Network/virtualHubs/routingIntent”

RoutingIntentProperties

名字 描述 价值
routingPolicies 路由策略列表。 路由策略

路由策略

名字 描述 价值
目的地 此路由策略适用于的所有目标列表(例如:Internet、PrivateTraffic)。 string[] (必需)
名字 路由策略的唯一名称。 string (必需)
nextHop 此路由策略适用的下一跃点资源 ID。 string (必需)

Terraform (AzAPI 提供程序)资源定义

可以使用目标操作部署 virtualHubs/routingIntent 资源类型:

  • 资源组 关于每个API版本中变更属性的列表,请参见 更改日志。

用法示例

Terraform 示例

部署虚拟中心路由意图的基本示例。

terraform {
  required_providers {
    azapi = {
      source = "Azure/azapi"
    }
  }
}

provider "azurerm" {
  features {
  }
}

provider "azapi" {
  skip_provider_registration = false
}

variable "resource_name" {
  type    = string
  default = "acctest0001"
}

variable "location" {
  type    = string
  default = "westeurope"
}

resource "azapi_resource" "resourceGroup" {
  type     = "Microsoft.Resources/resourceGroups@2020-06-01"
  name     = var.resource_name
  location = var.location
}

resource "azapi_resource" "virtualWan" {
  type      = "Microsoft.Network/virtualWans@2022-07-01"
  parent_id = azapi_resource.resourceGroup.id
  name      = var.resource_name
  location  = var.location
  body = {
    properties = {
      allowBranchToBranchTraffic     = true
      disableVpnEncryption           = false
      office365LocalBreakoutCategory = "None"
      type                           = "Standard"
    }
  }
  schema_validation_enabled = false
  response_export_values    = ["*"]
}

resource "azapi_resource" "virtualHub" {
  type      = "Microsoft.Network/virtualHubs@2022-07-01"
  parent_id = azapi_resource.resourceGroup.id
  name      = var.resource_name
  location  = var.location
  body = {
    properties = {
      addressPrefix        = "10.0.2.0/24"
      hubRoutingPreference = "ExpressRoute"
      virtualRouterAutoScaleConfiguration = {
        minCapacity = 2
      }
      virtualWan = {
        id = azapi_resource.virtualWan.id
      }
    }
  }
  schema_validation_enabled = false
  response_export_values    = ["*"]
}

resource "azurerm_firewall" "test" {
  name                = var.resource_name
  location            = azapi_resource.resourceGroup.location
  resource_group_name = azapi_resource.resourceGroup.name
  sku_name            = "AZFW_Hub"
  sku_tier            = "Standard"

  virtual_hub {
    virtual_hub_id  = azapi_resource.virtualHub.id
    public_ip_count = 1
  }
}

resource "azapi_resource" "routingIntent" {
  name      = var.resource_name
  type      = "Microsoft.Network/virtualHubs/routingIntent@2022-09-01"
  parent_id = azapi_resource.virtualHub.id

  body = {
    properties = {
      routingPolicies = [
        {
          name = "InternetTraffic"
          destinations = [
            "Internet"
          ]
          nextHop = azurerm_firewall.test.id
        },
        {
          name = "PrivateTrafficPolicy"
          destinations = [
            "PrivateTraffic"
          ]
          nextHop = azurerm_firewall.test.id
        }
      ]
    }
  }
}

资源格式

若要创建 Microsoft.Network/virtualHubs/routingIntent 资源,请将以下 Terraform 添加到模板。

resource "azapi_resource" "symbolicname" {
  type = "Microsoft.Network/virtualHubs/routingIntent@2023-04-01"
  name = "string"
  parent_id = "string"
  body = {
    properties = {
      routingPolicies = [
        {
          destinations = [
            "string"
          ]
          name = "string"
          nextHop = "string"
        }
      ]
    }
  }
}

属性值

Microsoft.Network/virtualHubs/routingIntent

名字 描述 价值
名字 资源名称 string (必需)
parent_id 此资源的父资源的 ID。 类型资源的 ID:virtualHubs
性能 RoutingIntent 资源的属性。 RoutingIntentProperties
类型 资源类型 “Microsoft.Network/virtualHubs/routingIntent@2023-04-01”

RoutingIntentProperties

名字 描述 价值
routingPolicies 路由策略列表。 路由策略

路由策略

名字 描述 价值
目的地 此路由策略适用于的所有目标列表(例如:Internet、PrivateTraffic)。 string[] (必需)
名字 路由策略的唯一名称。 string (必需)
nextHop 此路由策略适用的下一跃点资源 ID。 string (必需)