Creating Virtual Networks
This section explains how to create a new virtual network.
Request
POST https://<hostname>/api/v1/cloudInfrastructure/virtualNetworks |
Request Headers
The request header must contain an authorization token of the current session.
Request Parameters
None.
Request Body
Property | Type | Description |
networkName | string | Sets the virtual network name. |
region | string | Sets the region to which the virtual network belongs. |
networkAddressSpace | string | Sets the IP address space for the virtual network. |
subnetName | string | Sets the subnet name. |
subnetAddressSpace | string | Sets the IP address space for the subnet. |
createPeering | string | Defines if the peering must be created. |
Request Example
Request: POST https://<hostname>/api/v1/cloudInfrastructure/virtualNetworks
Request Header: Authorization: Bearer <Access-Token>
Request Header: { "networkName": "TW_Virtual_Network", "region": "ukwest", "networkAddressSpace": "10.76.0.0/16", "subnetName": "TW_Virtual_Network_sub", "subnetAddressSpace": "10.76.0.0/24", "createPeering": true } |
Response
The server returns the following response to the client.
Response Codes
A successfully completed operation returns a response code 200 (OK).
Response Headers
The response to this request contains the following headers. The response may also include additional standard HTTPS headers.
Header | Description |
Content-length | The length of the response body. |
Content-type | The media type and syntax of the response body message: application/json; charset=utf-8 |
Response Body
The response contains the following information.
Property | Type | Description |
|---|---|---|
id | string | Shows the identification number of the created virtual network. |
name | string | Shows the name of the virtual network. |
regionName | string | Shows the region name to which the network belongs. |
addressSpaces | string | Shows the IP address range of the created virtual network. |
_links | Dictionary of string [key] and Object [value] | Links to related resources (navigation property). |
_embeddedResources | Contains the VirtualNetworkEmbeddedResources object. |
VirtualNetworkEmbeddedResources Object
Property | Type | Description |
|---|---|---|
subnets | Contains the VirtualNetworkSubnet object. | |
peerings | Contains the VirtualNetworkPeering object. |
Property | Type | Description |
|---|---|---|
name | string | Shows the name if the virtual network subnet. |
addressSpace | string | Shows the IP address range of the created subnetwork. |
Property | Type | Description |
|---|---|---|
id | string | Shows the identification number of the peering. |
addressSpaces | string | Shows the IP address range. |
remoteNetworkId | string | Shows the identification number of the remote network. |
networkId | string | Shows the identification number of the network. |
Response Example
Response: 200 OK
Response Body: { "id": "/subscriptions/3a9a8330-7bbc-4b03-9c68-15d674fbc809/resourcegroups/jenkins-abc/providers/microsoft.network/virtualnetworks/tw_virtual_network", "name": "TW_Virtual_Network", "regionName": "ukwest", "addressSpaces": ["10.76.0.0/16"], "_links": { "subscription": {"href": "https://abc.ukwest.cloudapp.azure.com/api/v1/cloudInfrastructure/subscriptions/3a9a8330-7bbc-4b03-9c68-15d674fbc809"}, "self": {"href": "https://abc.ukwest.cloudapp.azure.com/api/v1/cloudInfrastructure/virtualNetworks/%2Fsubscriptions%2F3a9a8330-7bbc-4b03-9c68-15d674fbc809%2Fresourcegroups%2Fjenkins-abc%2Fproviders%2Fmicrosoft.network%2Fvirtualnetworks%2Ftw_virtual_network?expand=Subnets&expand=Peerings"} }, "_embeddedResources": { "subnets": [ { "name": "TW_Virtual_Network_sub", "addressSpace": "10.76.0.0/24" }], "peerings": [ { "id": "/subscriptions/3a9a8330-7bbc-4b03-9c68-15d674fbc809/resourcegroups/jenkins-abc/providers/microsoft.network/virtualnetworks/tw_virtual_network/virtualnetworkpeerings/vba-ukwest", "addressSpaces": ["10.4.15.0/24"], "remoteNetworkId": "/subscriptions/3a9a8330-7bbc-4b03-9c68-15d674fbc809/resourcegroups/jenkins-abc/providers/microsoft.network/virtualnetworks/abc-network", "networkId": "/subscriptions/3a9a8330-7bbc-4b03-9c68-15d674fbc809/resourcegroups/jenkins-abc/providers/microsoft.network/virtualnetworks/tw_virtual_network" }] } } |