Virtual Routers - Create Or Update

Creates or updates the specified Virtual Router.

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

URI Parameters

Name In Required Type Description
resourceGroupName
path True

string

The name of the resource group.

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.

virtualRouterName
path True

string

The name of the Virtual Router.

api-version
query True

string

Client API version.

Request Body

Name Type Description
id

string

Resource ID.

location

string

Resource location.

properties.hostedGateway

SubResource

The Gateway on which VirtualRouter is hosted.

properties.hostedSubnet

SubResource

The Subnet on which VirtualRouter is hosted.

properties.virtualRouterAsn

integer

VirtualRouter ASN.

properties.virtualRouterIps

string[]

VirtualRouter IPs.

tags

object

Resource tags.

Responses

Name Type Description
200 OK

VirtualRouter

Request successful. The operation returns the resulting Virtual Router resource.

201 Created

VirtualRouter

Request received successfully. The operation returns the resulting Virtual Router resource.

Other Status Codes

Error

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

Create VirtualRouter

Sample request

PUT https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualRouters/virtualRouter?api-version=2024-03-01

{
  "tags": {
    "key1": "value1"
  },
  "location": "West US",
  "properties": {
    "hostedGateway": {
      "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworkGateways/vnetGateway"
    }
  }
}

Sample response

{
  "name": "virtualRouter",
  "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualRouters/virtualRouter",
  "type": "Microsoft.Network/virtualRouters",
  "etag": "w/\\00000000-0000-0000-0000-000000000000\\",
  "location": "West US",
  "tags": {
    "key1": "value1"
  },
  "properties": {
    "provisioningState": "Succeeded",
    "virtualRouterAsn": 10000,
    "virtualRouterIps": [
      "192.168.1.1",
      "192.168.1.2"
    ],
    "hostedGateway": {
      "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworkGateways/vnetGateway"
    },
    "peerings": [
      {
        "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualRouters/virtualRouter/peerings/peering1"
      }
    ]
  }
}
{
  "name": "virtualRouter",
  "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualRouters/virtualRouter",
  "type": "Microsoft.Network/virtualRouters",
  "etag": "w/\\00000000-0000-0000-0000-000000000000\\",
  "location": "West US",
  "tags": {
    "key1": "value1"
  },
  "properties": {
    "provisioningState": "Succeeded",
    "virtualRouterAsn": 10000,
    "virtualRouterIps": [
      "192.168.1.1",
      "192.168.1.2"
    ],
    "hostedGateway": {
      "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworkGateways/vnetGateway"
    },
    "peerings": [
      {
        "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualRouters/virtualRouter/peerings/peering1"
      }
    ]
  }
}

Definitions

Name Description
Error

Common error representation.

ErrorDetails

Common error details representation.

ProvisioningState

The current provisioning state.

SubResource

Reference to another subresource.

VirtualRouter

VirtualRouter Resource.

Error

Common error representation.

Name Type Description
code

string

Error code.

details

ErrorDetails[]

Error details.

innerError

string

Inner error message.

message

string

Error message.

target

string

Error target.

ErrorDetails

Common error details representation.

Name Type Description
code

string

Error code.

message

string

Error message.

target

string

Error target.

ProvisioningState

The current provisioning state.

Name Type Description
Deleting

string

Failed

string

Succeeded

string

Updating

string

SubResource

Reference to another subresource.

Name Type Description
id

string

Resource ID.

VirtualRouter

VirtualRouter Resource.

Name Type Description
etag

string

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

id

string

Resource ID.

location

string

Resource location.

name

string

Resource name.

properties.hostedGateway

SubResource

The Gateway on which VirtualRouter is hosted.

properties.hostedSubnet

SubResource

The Subnet on which VirtualRouter is hosted.

properties.peerings

SubResource[]

List of references to VirtualRouterPeerings.

properties.provisioningState

ProvisioningState

The provisioning state of the resource.

properties.virtualRouterAsn

integer

VirtualRouter ASN.

properties.virtualRouterIps

string[]

VirtualRouter IPs.

tags

object

Resource tags.

type

string

Resource type.