Virtual Network Subnets - Create Or Update

The operation to create or update a virtual network subnet.

PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}?api-version=2026-04-01-preview

URI Parameters

Name In Required Type Description
resourceGroupName
path True

string

minLength: 1
maxLength: 90

The name of the resource group. The name is case insensitive.

subnetName
path True

string

pattern: ^[a-zA-Z0-9]$|^[a-zA-Z0-9][-._a-zA-Z0-9]{0,62}[a-zA-Z0-9]$

Name of the virtual network subnet

subscriptionId
path True

string (uuid)

The ID of the target subscription. The value must be an UUID.

virtualNetworkName
path True

string

pattern: ^[a-zA-Z0-9]$|^[a-zA-Z0-9][-._a-zA-Z0-9]{0,62}[a-zA-Z0-9]$

Name of the virtual network

api-version
query True

string

minLength: 1

The API version to use for this operation.

Request Body

Name Type Description
extendedLocation

ExtendedLocation

The extendedLocation of the resource.

properties

VirtualNetworkSubnetProperties

The resource-specific properties for this resource.

Responses

Name Type Description
200 OK

VirtualNetworkSubnet

Resource 'VirtualNetworkSubnet' update operation succeeded

201 Created

VirtualNetworkSubnet

Resource 'VirtualNetworkSubnet' create operation succeeded

Headers

  • Azure-AsyncOperation: string
  • Retry-After: integer
Other Status Codes

ErrorResponse

An unexpected error response.

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

PutVirtualNetworkSubnet

Sample request

PUT https://management.azure.com/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/test-rg/providers/Microsoft.AzureStackHCI/virtualNetworks/test-vnet/subnets/subnet1?api-version=2026-04-01-preview

{
  "properties": {
    "addressPrefix": "10.0.0.0/28"
  }
}

Sample response

{
  "name": "subnet",
  "type": "Microsoft.AzureStackHCI/virtualNetworks/subnets",
  "extendedLocation": {
    "name": "/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location",
    "type": "CustomLocation"
  },
  "id": "/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/virtualNetworks/test-vnet/subnets/subnet1",
  "properties": {
    "addressPrefix": "10.0.0.0/28",
    "provisioningState": "Accepted"
  }
}
{
  "name": "test-vnet",
  "type": "Microsoft.AzureStackHCI/virtualNetworks",
  "extendedLocation": {
    "name": "/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location",
    "type": "CustomLocation"
  },
  "id": "/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/virtualNetworks/test-vnet/subnets/subnet1",
  "properties": {
    "addressPrefix": "10.0.0.0/28",
    "provisioningState": "Succeeded"
  }
}

Definitions

Name Description
createdByType

The type of identity that created the resource.

ErrorAdditionalInfo

The resource management error additional info.

ErrorDetail

The error detail.

ErrorResponse

Error response

ExtendedLocation

The complex type of the extended location.

ExtendedLocationTypes

The type of extendedLocation.

NatGatewayArmReference

The ARM ID for a Network Security Group.

NetworkSecurityGroupArmReference

The Azure Resource ID for a Network Security Group.

ProvisioningStateEnum

Provisioning state of the resource.

Route

Route - Route resource.

RouteTable

Route table resource.

Status

The status of the operation performed on the resource [Succeeded, Failed, InProgress]

systemData

Metadata pertaining to creation and last modification of the resource.

VirtualNetworkSubnet

The virtual network resource definition.

VirtualNetworkSubnetIpConfigurationReference

The Azure Resource ID for a resource consuming IP on a subnet

VirtualNetworkSubnetProperties

VirtualNetwork subnet resource

VirtualNetworkSubnetStatus

Status of virtual network subnet operations

VirtualNetworkSubnetStatusProvisioningStatus

Status of virtual network subnet operations

createdByType

The type of identity that created the resource.

Value Description
User
Application
ManagedIdentity
Key

ErrorAdditionalInfo

The resource management error additional info.

Name Type Description
info

object

The additional info.

type

string

The additional info type.

ErrorDetail

The error detail.

Name Type Description
additionalInfo

ErrorAdditionalInfo[]

The error additional info.

code

string

The error code.

details

ErrorDetail[]

The error details.

message

string

The error message.

target

string

The error target.

ErrorResponse

Error response

Name Type Description
error

ErrorDetail

The error object.

ExtendedLocation

The complex type of the extended location.

Name Type Description
name

string

The name of the extended location.

type

ExtendedLocationTypes

The type of the extended location.

ExtendedLocationTypes

The type of extendedLocation.

Value Description
CustomLocation

Custom extended location type

NatGatewayArmReference

The ARM ID for a Network Security Group.

Name Type Description
resourceId

string (arm-id)

The ARM ID for a Network Security Group.

NetworkSecurityGroupArmReference

The Azure Resource ID for a Network Security Group.

Name Type Description
id

string (arm-id)

The Azure Resource ID for a Network Security Group.

ProvisioningStateEnum

Provisioning state of the resource.

Value Description
Succeeded

Provisioning has succeeded

Failed

Provisioning has failed

InProgress

Provisioning is in progress

Accepted

Provisioning has been accepted

Deleting

Deletion of the resource is in progress

Canceled

Provisioning has been canceled

Route

Route - Route resource.

Name Type Description
name

string

pattern: ^[a-zA-Z0-9]$|^[a-zA-Z0-9][-._a-zA-Z0-9]{0,78}[_a-zA-Z0-9]$

Name - name of the subnet

properties.addressPrefix

string

The destination CIDR to which the route applies.

properties.nextHopIpAddress

string

The IP address packets should be forwarded to. Next hop values are only allowed in routes where the next hop type is VirtualAppliance.

RouteTable

Route table resource.

Name Type Description
etag

string

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

name

string

Resource name.

properties.routes

Route[]

Collection of routes contained within a route table.

type

string

Resource type.

Status

The status of the operation performed on the resource [Succeeded, Failed, InProgress]

Value Description
Succeeded

Operation succeeded

Failed

Operation failed

InProgress

Operation is in progress

systemData

Metadata pertaining to creation and last modification of the resource.

Name Type Description
createdAt

string (date-time)

The timestamp of resource creation (UTC).

createdBy

string

The identity that created the resource.

createdByType

createdByType

The type of identity that created the resource.

lastModifiedAt

string (date-time)

The timestamp of resource last modification (UTC)

lastModifiedBy

string

The identity that last modified the resource.

lastModifiedByType

createdByType

The type of identity that last modified the resource.

VirtualNetworkSubnet

The virtual network resource definition.

Name Type Description
extendedLocation

ExtendedLocation

The extendedLocation of the resource.

id

string (arm-id)

Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}"

name

string

The name of the resource

properties

VirtualNetworkSubnetProperties

The resource-specific properties for this resource.

systemData

systemData

Azure Resource Manager metadata containing createdBy and modifiedBy information.

type

string

The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"

VirtualNetworkSubnetIpConfigurationReference

The Azure Resource ID for a resource consuming IP on a subnet

Name Type Description
id

string (arm-id)

The Azure Resource ID for a Network Interface.

VirtualNetworkSubnetProperties

VirtualNetwork subnet resource

Name Type Description
addressPrefix

string

Subnet CIDR

ipConfigurations

VirtualNetworkSubnetIpConfigurationReference[]

List of ip configurations for the subnet

natGateway

NatGatewayArmReference

Nat Gateway attached to the subnet for non-vnet traffic.

networkSecurityGroup

NetworkSecurityGroupArmReference

Network Security Group attached to the subnet.

provisioningState

ProvisioningStateEnum

The provisioning state of the virtual network subnet resource.

routeTable

RouteTable

RouteTable defining custom routes for the subnet.

status

VirtualNetworkSubnetStatus

The observed status of the virtual network subnet resource.

VirtualNetworkSubnetStatus

Status of virtual network subnet operations

Name Type Description
errorCode

string

VirtualNetworkSubnet provisioning error code

errorMessage

string

Descriptive error message

provisioningStatus

VirtualNetworkSubnetStatusProvisioningStatus

Public IP provisioning status

VirtualNetworkSubnetStatusProvisioningStatus

Status of virtual network subnet operations

Name Type Description
operationId

string

The ID of the operation performed on the virtual network subnet

status

Status

The status of the operation performed on the virtual network subnet [Succeeded, Failed, InProgress]