Hub Virtual Network Connections - Create Or Update

Creates a hub virtual network connection if it doesn't exist else updates the existing one.

PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/hubVirtualNetworkConnections/{connectionName}?api-version=2024-03-01

URI Parameters

Name In Required Type Description
connectionName
path True

string

The name of the HubVirtualNetworkConnection.

resourceGroupName
path True

string

The resource group name of the HubVirtualNetworkConnection.

subscriptionId
path True

string

The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.

virtualHubName
path True

string

The name of the VirtualHub.

api-version
query True

string

Client API version.

Request Body

Name Type Description
id

string

Resource ID.

name

string

The name of the resource that is unique within a resource group. This name can be used to access the resource.

properties.allowHubToRemoteVnetTransit

boolean

Deprecated: VirtualHub to RemoteVnet transit to enabled or not.

properties.allowRemoteVnetToUseHubVnetGateways

boolean

Deprecated: Allow RemoteVnet to use Virtual Hub's gateways.

properties.enableInternetSecurity

boolean

Enable internet security.

properties.remoteVirtualNetwork

SubResource

Reference to the remote virtual network.

properties.routingConfiguration

RoutingConfiguration

The Routing Configuration indicating the associated and propagated route tables on this connection.

Responses

Name Type Description
200 OK

HubVirtualNetworkConnection

Request successful. Returns the details of the hub virtual network connection created or updated.

201 Created

HubVirtualNetworkConnection

Request successful. Returns the details of the hub virtual network connection retrieved.

Other Status Codes

CloudError

Error response describing why the operation failed.

Security

azure_auth

Azure Active Directory OAuth2 Flow.

Type: oauth2
Flow: implicit
Authorization URL: https://login.microsoftonline.com/common/oauth2/authorize

Scopes

Name Description
user_impersonation impersonate your user account

Examples

HubVirtualNetworkConnectionPut

Sample request

PUT https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/hubVirtualNetworkConnections/connection1?api-version=2024-03-01

{
  "properties": {
    "remoteVirtualNetwork": {
      "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/SpokeVnet1"
    },
    "enableInternetSecurity": false,
    "routingConfiguration": {
      "associatedRouteTable": {
        "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/hubRouteTables/hubRouteTable1"
      },
      "propagatedRouteTables": {
        "labels": [
          "label1",
          "label2"
        ],
        "ids": [
          {
            "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/hubRouteTables/hubRouteTable1"
          }
        ]
      },
      "vnetRoutes": {
        "staticRoutesConfig": {
          "vnetLocalRouteOverrideCriteria": "Equal"
        },
        "staticRoutes": [
          {
            "name": "route1",
            "addressPrefixes": [
              "10.1.0.0/16",
              "10.2.0.0/16"
            ],
            "nextHopIpAddress": "10.0.0.68"
          },
          {
            "name": "route2",
            "addressPrefixes": [
              "10.3.0.0/16",
              "10.4.0.0/16"
            ],
            "nextHopIpAddress": "10.0.0.65"
          }
        ]
      },
      "inboundRouteMap": {
        "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/routeMaps/routeMap1"
      },
      "outboundRouteMap": {
        "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/routeMaps/routeMap2"
      }
    }
  }
}

Sample response

{
  "name": "connection1",
  "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/hubVirtualNetworkConnections/connection1",
  "etag": "w/\\00000000-0000-0000-0000-000000000000\\",
  "properties": {
    "provisioningState": "Updating",
    "remoteVirtualNetwork": {
      "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/SpokeVnet1"
    },
    "enableInternetSecurity": false,
    "routingConfiguration": {
      "associatedRouteTable": {
        "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/hubRouteTables/hubRouteTable1"
      },
      "propagatedRouteTables": {
        "labels": [
          "label1",
          "label2"
        ],
        "ids": [
          {
            "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/hubRouteTables/hubRouteTable1"
          }
        ]
      },
      "vnetRoutes": {
        "staticRoutesConfig": {
          "propagateStaticRoutes": true,
          "vnetLocalRouteOverrideCriteria": "Equal"
        },
        "staticRoutes": [
          {
            "name": "route1",
            "addressPrefixes": [
              "10.1.0.0/16",
              "10.2.0.0/16"
            ],
            "nextHopIpAddress": "10.0.0.68"
          },
          {
            "name": "route2",
            "addressPrefixes": [
              "10.3.0.0/16",
              "10.4.0.0/16"
            ],
            "nextHopIpAddress": "10.0.0.65"
          }
        ],
        "bgpConnections": [
          {
            "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/bgpConnections/bgpConn1"
          }
        ]
      },
      "inboundRouteMap": {
        "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/routeMaps/routeMap1"
      },
      "outboundRouteMap": {
        "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/routeMaps/routeMap2"
      }
    }
  }
}
{
  "name": "connection1",
  "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/hubVirtualNetworkConnections/connection1",
  "etag": "w/\\00000000-0000-0000-0000-000000000000\\",
  "properties": {
    "provisioningState": "Updating",
    "remoteVirtualNetwork": {
      "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/SpokeVnet1"
    },
    "enableInternetSecurity": false,
    "routingConfiguration": {
      "associatedRouteTable": {
        "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/hubRouteTables/hubRouteTable1"
      },
      "propagatedRouteTables": {
        "labels": [
          "label1",
          "label2"
        ],
        "ids": [
          {
            "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/hubRouteTables/hubRouteTable1"
          }
        ]
      },
      "vnetRoutes": {
        "staticRoutesConfig": {
          "propagateStaticRoutes": true,
          "vnetLocalRouteOverrideCriteria": "Equal"
        },
        "staticRoutes": [
          {
            "name": "route1",
            "addressPrefixes": [
              "10.1.0.0/16",
              "10.2.0.0/16"
            ],
            "nextHopIpAddress": "10.0.0.68"
          },
          {
            "name": "route2",
            "addressPrefixes": [
              "10.3.0.0/16",
              "10.4.0.0/16"
            ],
            "nextHopIpAddress": "10.0.0.65"
          }
        ],
        "bgpConnections": [
          {
            "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/bgpConnections/bgpConn1"
          }
        ]
      },
      "inboundRouteMap": {
        "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/routeMaps/routeMap1"
      },
      "outboundRouteMap": {
        "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/routeMaps/routeMap2"
      }
    }
  }
}

Definitions

Name Description
CloudError

An error response from the service.

CloudErrorBody

An error response from the service.

HubVirtualNetworkConnection

HubVirtualNetworkConnection Resource.

PropagatedRouteTable

The list of RouteTables to advertise the routes to.

ProvisioningState

The current provisioning state.

RoutingConfiguration

Routing Configuration indicating the associated and propagated route tables for this connection.

StaticRoute

List of all Static Routes.

StaticRoutesConfig

Configuration for static routes on this HubVnetConnectionConfiguration for static routes on this HubVnetConnection.

SubResource

Reference to another subresource.

VnetLocalRouteOverrideCriteria

Parameter determining whether NVA in spoke vnet is bypassed for traffic with destination in spoke vnet.

VnetRoute

List of routes that control routing from VirtualHub into a virtual network connection.

CloudError

An error response from the service.

Name Type Description
error

CloudErrorBody

Cloud error body.

CloudErrorBody

An error response from the service.

Name Type Description
code

string

An identifier for the error. Codes are invariant and are intended to be consumed programmatically.

details

CloudErrorBody[]

A list of additional details about the error.

message

string

A message describing the error, intended to be suitable for display in a user interface.

target

string

The target of the particular error. For example, the name of the property in error.

HubVirtualNetworkConnection

HubVirtualNetworkConnection Resource.

Name Type Description
etag

string

A unique read-only string that changes whenever the resource is updated.

id

string

Resource ID.

name

string

The name of the resource that is unique within a resource group. This name can be used to access the resource.

properties.allowHubToRemoteVnetTransit

boolean

Deprecated: VirtualHub to RemoteVnet transit to enabled or not.

properties.allowRemoteVnetToUseHubVnetGateways

boolean

Deprecated: Allow RemoteVnet to use Virtual Hub's gateways.

properties.enableInternetSecurity

boolean

Enable internet security.

properties.provisioningState

ProvisioningState

The provisioning state of the hub virtual network connection resource.

properties.remoteVirtualNetwork

SubResource

Reference to the remote virtual network.

properties.routingConfiguration

RoutingConfiguration

The Routing Configuration indicating the associated and propagated route tables on this connection.

PropagatedRouteTable

The list of RouteTables to advertise the routes to.

Name Type Description
ids

SubResource[]

The list of resource ids of all the RouteTables.

labels

string[]

The list of labels.

ProvisioningState

The current provisioning state.

Name Type Description
Deleting

string

Failed

string

Succeeded

string

Updating

string

RoutingConfiguration

Routing Configuration indicating the associated and propagated route tables for this connection.

Name Type Description
associatedRouteTable

SubResource

The resource id RouteTable associated with this RoutingConfiguration.

inboundRouteMap

SubResource

The resource id of the RouteMap associated with this RoutingConfiguration for inbound learned routes.

outboundRouteMap

SubResource

The resource id of theRouteMap associated with this RoutingConfiguration for outbound advertised routes.

propagatedRouteTables

PropagatedRouteTable

The list of RouteTables to advertise the routes to.

vnetRoutes

VnetRoute

List of routes that control routing from VirtualHub into a virtual network connection.

StaticRoute

List of all Static Routes.

Name Type Description
addressPrefixes

string[]

List of all address prefixes.

name

string

The name of the StaticRoute that is unique within a VnetRoute.

nextHopIpAddress

string

The ip address of the next hop.

StaticRoutesConfig

Configuration for static routes on this HubVnetConnectionConfiguration for static routes on this HubVnetConnection.

Name Type Description
propagateStaticRoutes

boolean

Boolean indicating whether static routes on this connection are automatically propagate to route tables which this connection propagates to.

vnetLocalRouteOverrideCriteria

VnetLocalRouteOverrideCriteria

Parameter determining whether NVA in spoke vnet is bypassed for traffic with destination in spoke.

SubResource

Reference to another subresource.

Name Type Description
id

string

Resource ID.

VnetLocalRouteOverrideCriteria

Parameter determining whether NVA in spoke vnet is bypassed for traffic with destination in spoke vnet.

Name Type Description
Contains

string

Equal

string

VnetRoute

List of routes that control routing from VirtualHub into a virtual network connection.

Name Type Description
bgpConnections

SubResource[]

The list of references to HubBgpConnection objects.

staticRoutes

StaticRoute[]

List of all Static Routes.

staticRoutesConfig

StaticRoutesConfig

Configuration for static routes on this HubVnetConnection.