Azure Networking Virtual Networks API

Operations for creating, updating, deleting, and listing Azure Virtual Networks within subscriptions and resource groups.

OpenAPI Specification

microsoft-azure-networking-virtual-networks-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: Azure Networking Azure Load Balancer Backend Address Pools Virtual Networks API
  description: Distribute traffic across multiple virtual machines and services with Azure Load Balancer. This API provides operations for creating, configuring, and managing load balancers including frontend IP configurations, backend address pools, health probes, load balancing rules, inbound NAT rules, and outbound rules.
  version: '2024-05-01'
  contact:
    name: Microsoft Azure Support
    url: https://azure.microsoft.com/en-us/support/
  license:
    name: Microsoft API License
    url: https://learn.microsoft.com/en-us/legal/microsoft-apis/terms-of-use
servers:
- url: https://management.azure.com
  description: Azure Resource Manager
security:
- OAuth2Auth: []
tags:
- name: Virtual Networks
  description: Operations for creating, updating, deleting, and listing Azure Virtual Networks within subscriptions and resource groups.
paths:
  /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks:
    get:
      operationId: VirtualNetworks_List
      summary: Azure Networking List virtual networks
      description: Gets all virtual networks in a resource group. Returns a paginated list of virtual network resources with their properties and configuration details.
      tags:
      - Virtual Networks
      parameters:
      - $ref: '#/components/parameters/SubscriptionIdParameter'
      - $ref: '#/components/parameters/ResourceGroupNameParameter'
      - $ref: '#/components/parameters/ApiVersionParameter'
      responses:
        '200':
          description: Successfully retrieved the list of virtual networks.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/VirtualNetworkListResult'
        '401':
          description: Unauthorized. Authentication credentials are missing or invalid.
        '404':
          description: Resource group not found.
  ? /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}
  : get:
      operationId: VirtualNetworks_Get
      summary: Azure Networking Get virtual network
      description: Gets the specified virtual network by resource group and name. Returns the full resource representation including address space, subnets, peerings, and provisioning state.
      tags:
      - Virtual Networks
      parameters:
      - $ref: '#/components/parameters/SubscriptionIdParameter'
      - $ref: '#/components/parameters/ResourceGroupNameParameter'
      - $ref: '#/components/parameters/VirtualNetworkNameParameter'
      - $ref: '#/components/parameters/ApiVersionParameter'
      responses:
        '200':
          description: Successfully retrieved the virtual network.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/VirtualNetwork'
        '401':
          description: Unauthorized. Authentication credentials are missing or invalid.
        '404':
          description: Virtual network not found.
    put:
      operationId: VirtualNetworks_CreateOrUpdate
      summary: Azure Networking Create or update virtual network
      description: Creates a new virtual network or updates an existing virtual network in the specified resource group. The request body must include the location and address space configuration.
      tags:
      - Virtual Networks
      parameters:
      - $ref: '#/components/parameters/SubscriptionIdParameter'
      - $ref: '#/components/parameters/ResourceGroupNameParameter'
      - $ref: '#/components/parameters/VirtualNetworkNameParameter'
      - $ref: '#/components/parameters/ApiVersionParameter'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/VirtualNetwork'
      responses:
        '200':
          description: Successfully updated the virtual network.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/VirtualNetwork'
        '201':
          description: Successfully created the virtual network.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/VirtualNetwork'
        '400':
          description: Bad request. The request body is invalid.
        '401':
          description: Unauthorized. Authentication credentials are missing or invalid.
    delete:
      operationId: VirtualNetworks_Delete
      summary: Azure Networking Delete virtual network
      description: Deletes the specified virtual network. This operation is asynchronous and returns a 202 Accepted status while the deletion is in progress.
      tags:
      - Virtual Networks
      parameters:
      - $ref: '#/components/parameters/SubscriptionIdParameter'
      - $ref: '#/components/parameters/ResourceGroupNameParameter'
      - $ref: '#/components/parameters/VirtualNetworkNameParameter'
      - $ref: '#/components/parameters/ApiVersionParameter'
      responses:
        '200':
          description: Successfully deleted the virtual network.
        '202':
          description: Accepted. The delete operation is in progress.
        '204':
          description: No content. The virtual network does not exist.
        '401':
          description: Unauthorized. Authentication credentials are missing or invalid.
  /subscriptions/{subscriptionId}/providers/Microsoft.Network/virtualNetworks:
    get:
      operationId: VirtualNetworks_ListAll
      summary: Azure Networking List all virtual networks
      description: Gets all virtual networks in a subscription. Returns a paginated list of all virtual network resources across all resource groups.
      tags:
      - Virtual Networks
      parameters:
      - $ref: '#/components/parameters/SubscriptionIdParameter'
      - $ref: '#/components/parameters/ApiVersionParameter'
      responses:
        '200':
          description: Successfully retrieved all virtual networks in the subscription.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/VirtualNetworkListResult'
        '401':
          description: Unauthorized. Authentication credentials are missing or invalid.
  /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{name}:
    parameters:
    - $ref: '#/components/parameters/subscriptionId'
    - $ref: '#/components/parameters/resourceGroupName'
    - name: name
      in: path
      required: true
      description: Name of the resource.
      schema:
        type: string
    - $ref: '#/components/parameters/apiVersion'
    get:
      operationId: getVirtualnetworks
      summary: Azure Virtual Network REST API Get resource
      description: Gets a specific virtualNetworks resource.
      tags:
      - Virtual Networks
      responses:
        '200':
          description: Resource
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Resource'
        '404':
          description: Not found
        default:
          description: Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
    put:
      operationId: createOrUpdateVirtualnetworks
      summary: Azure Virtual Network REST API Create or update resource
      description: Creates or updates a virtualNetworks resource.
      tags:
      - Virtual Networks
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Resource'
      responses:
        '200':
          description: Resource updated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Resource'
        '201':
          description: Resource created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Resource'
        default:
          description: Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
    patch:
      operationId: updateVirtualnetworks
      summary: Azure Virtual Network REST API Update resource
      description: Updates a virtualNetworks resource.
      tags:
      - Virtual Networks
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: true
      responses:
        '200':
          description: Resource updated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Resource'
        default:
          description: Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
    delete:
      operationId: deleteVirtualnetworks
      summary: Azure Virtual Network REST API Delete resource
      description: Deletes a virtualNetworks resource.
      tags:
      - Virtual Networks
      responses:
        '200':
          description: Resource deleted
        '202':
          description: Deletion accepted
        '204':
          description: Resource not found or already deleted
        default:
          description: Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    VirtualNetworkPeering:
      type: object
      description: Peerings in a virtual network resource.
      properties:
        id:
          type: string
          readOnly: true
          description: Resource ID.
        name:
          type: string
          description: The name of the resource.
        properties:
          type: object
          description: Properties of the virtual network peering.
          properties:
            allowVirtualNetworkAccess:
              type: boolean
              description: Whether the VMs in the local virtual network can access the VMs in the remote virtual network.
            allowForwardedTraffic:
              type: boolean
              description: Whether the forwarded traffic from the VMs in the local virtual network will be allowed or disallowed in the remote virtual network.
            allowGatewayTransit:
              type: boolean
              description: If gateway links can be used in remote virtual networking to link to this virtual network.
            useRemoteGateways:
              type: boolean
              description: If remote gateways can be used on this virtual network.
            remoteVirtualNetwork:
              type: object
              description: The reference to the remote virtual network.
              properties:
                id:
                  type: string
                  description: Resource ID.
            peeringState:
              type: string
              readOnly: true
              description: The status of the virtual network peering.
              enum:
              - Initiated
              - Connected
              - Disconnected
            provisioningState:
              type: string
              readOnly: true
              description: The provisioning state of the virtual network peering resource.
    Subnet:
      type: object
      description: Subnet in a virtual network resource.
      properties:
        id:
          type: string
          readOnly: true
          description: Resource ID.
        name:
          type: string
          description: The name of the resource.
        properties:
          type: object
          description: Properties of the subnet.
          properties:
            addressPrefix:
              type: string
              description: The address prefix for the subnet.
            addressPrefixes:
              type: array
              items:
                type: string
              description: List of address prefixes for the subnet.
            networkSecurityGroup:
              type: object
              description: The reference to the network security group resource.
              properties:
                id:
                  type: string
                  description: Resource ID.
            routeTable:
              type: object
              description: The reference to the route table resource.
              properties:
                id:
                  type: string
                  description: Resource ID.
            natGateway:
              type: object
              description: NAT gateway associated with this subnet.
              properties:
                id:
                  type: string
                  description: Resource ID.
            serviceEndpoints:
              type: array
              items:
                type: object
                properties:
                  service:
                    type: string
                    description: The type of the endpoint service.
                  locations:
                    type: array
                    items:
                      type: string
                    description: A list of locations.
                  provisioningState:
                    type: string
                    readOnly: true
                    description: The provisioning state of the service endpoint.
              description: An array of service endpoints.
            delegations:
              type: array
              items:
                type: object
                properties:
                  id:
                    type: string
                    description: Resource ID.
                  name:
                    type: string
                    description: The name of the resource.
                  properties:
                    type: object
                    properties:
                      serviceName:
                        type: string
                        description: The name of the service to whom the subnet should be delegated.
              description: An array of references to the delegations on the subnet.
            privateEndpointNetworkPolicies:
              type: string
              description: Enable or disable network policies on private endpoints in the subnet.
              enum:
              - Enabled
              - Disabled
            privateLinkServiceNetworkPolicies:
              type: string
              description: Enable or disable network policies on private link service in the subnet.
              enum:
              - Enabled
              - Disabled
            provisioningState:
              type: string
              readOnly: true
              description: The provisioning state of the subnet resource.
    DhcpOptions:
      type: object
      description: DhcpOptions contains an array of DNS servers.
      properties:
        dnsServers:
          type: array
          items:
            type: string
          description: The list of DNS servers IP addresses.
    Resource:
      type: object
      properties:
        id:
          type: string
          description: Resource ID.
        name:
          type: string
          description: Resource name.
        type:
          type: string
          description: Resource type.
        location:
          type: string
          description: Resource location.
        tags:
          type: object
          additionalProperties:
            type: string
        properties:
          type: object
          description: Resource-specific properties.
    VirtualNetworkListResult:
      type: object
      description: Response for the ListVirtualNetworks API service call.
      properties:
        value:
          type: array
          items:
            $ref: '#/components/schemas/VirtualNetwork'
          description: A list of virtual networks in a resource group.
        nextLink:
          type: string
          description: The URL to get the next set of results.
    VirtualNetwork:
      type: object
      description: A virtual network in a resource group.
      properties:
        id:
          type: string
          readOnly: true
          description: Resource ID.
        name:
          type: string
          readOnly: true
          description: Resource name.
        type:
          type: string
          readOnly: true
          description: Resource type.
        location:
          type: string
          description: Resource location.
        tags:
          type: object
          additionalProperties:
            type: string
          description: Resource tags.
        properties:
          type: object
          description: Properties of the virtual network.
          properties:
            addressSpace:
              $ref: '#/components/schemas/AddressSpace'
            dhcpOptions:
              $ref: '#/components/schemas/DhcpOptions'
            subnets:
              type: array
              items:
                $ref: '#/components/schemas/Subnet'
              description: A list of subnets in a virtual network.
            virtualNetworkPeerings:
              type: array
              items:
                $ref: '#/components/schemas/VirtualNetworkPeering'
              description: A list of peerings in a virtual network.
            provisioningState:
              type: string
              readOnly: true
              description: The provisioning state of the virtual network resource.
              enum:
              - Succeeded
              - Updating
              - Deleting
              - Failed
            enableDdosProtection:
              type: boolean
              description: Indicates if DDoS protection is enabled for all protected resources in the virtual network.
            enableVmProtection:
              type: boolean
              description: Indicates if VM protection is enabled for all subnets in the virtual network.
    ErrorResponse:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
            message:
              type: string
            target:
              type: string
    AddressSpace:
      type: object
      description: AddressSpace contains an array of IP address ranges.
      properties:
        addressPrefixes:
          type: array
          items:
            type: string
          description: A list of address blocks reserved for this virtual network in CIDR notation.
  parameters:
    VirtualNetworkNameParameter:
      name: virtualNetworkName
      in: path
      required: true
      description: The name of the virtual network.
      schema:
        type: string
    SubscriptionIdParameter:
      name: subscriptionId
      in: path
      required: true
      description: The subscription credentials which uniquely identify the Microsoft Azure subscription.
      schema:
        type: string
    resourceGroupName:
      name: resourceGroupName
      in: path
      required: true
      description: The name of the resource group.
      schema:
        type: string
    ResourceGroupNameParameter:
      name: resourceGroupName
      in: path
      required: true
      description: The name of the resource group.
      schema:
        type: string
    ApiVersionParameter:
      name: api-version
      in: query
      required: true
      description: Client API version.
      schema:
        type: string
        default: '2024-05-01'
    apiVersion:
      name: api-version
      in: query
      required: true
      description: The API version to use for this operation.
      schema:
        type: string
    subscriptionId:
      name: subscriptionId
      in: path
      required: true
      description: The ID of the target subscription.
      schema:
        type: string
  securitySchemes:
    OAuth2Auth:
      type: oauth2
      description: Azure Active Directory OAuth2 Flow
      flows:
        implicit:
          authorizationUrl: https://login.microsoftonline.com/common/oauth2/authorize
          scopes:
            user_impersonation: Access Azure Load Balancer API
externalDocs:
  description: Azure Load Balancer REST API Documentation
  url: https://learn.microsoft.com/en-us/rest/api/load-balancer/