Skip to main content

subnets

Creates, updates, deletes, gets or lists a subnets resource.

Overview

Namesubnets
TypeResource
Idazure.network.subnets

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
idstringResource ID.
namestringName of the resource.
addressPrefixstringThe address prefix for the subnet.
addressPrefixesarrayList of address prefixes for the subnet.
applicationGatewayIPConfigurationsarrayApplication gateway IP configurations of virtual network resource.
defaultOutboundAccessbooleanSet this property to false to disable default outbound connectivity for all VMs in the subnet.
delegationsarrayAn array of references to the delegations on the subnet.
etagstringA unique read-only string that changes whenever the resource is updated.
ipAllocationsarrayArray of IpAllocation which reference this subnet.
ipConfigurationProfilesarrayArray of IP configuration profiles which reference this subnet.
ipConfigurationsarrayAn array of references to the network interface IP configurations using subnet.
ipamPoolPrefixAllocationsarrayA list of IPAM Pools for allocating IP address prefixes.
natGatewayobjectReference to another subresource.
networkSecurityGroupobjectThe reference to the NetworkSecurityGroup resource.
privateEndpointNetworkPoliciesstringEnable or Disable apply network policies on private end point in the subnet. Known values are: "Enabled", "Disabled", "NetworkSecurityGroupEnabled", and "RouteTableEnabled". (Enabled, Disabled, NetworkSecurityGroupEnabled, RouteTableEnabled)
privateEndpointsarrayAn array of references to private endpoints.
privateLinkServiceNetworkPoliciesstringEnable or Disable apply network policies on private link service in the subnet. Known values are: "Enabled" and "Disabled". (Enabled, Disabled)
provisioningStatestringThe provisioning state of the subnet resource. Known values are: "Failed", "Succeeded", "Canceled", "Creating", "Updating", and "Deleting". (Failed, Succeeded, Canceled, Creating, Updating, Deleting)
purposestringA read-only string identifying the intention of use for this subnet based on delegations and other user-defined properties.
resourceNavigationLinksarrayAn array of references to the external resources using subnet.
routeTableobjectThe reference to the RouteTable resource.
serviceAssociationLinksarrayAn array of references to services injecting into this subnet.
serviceEndpointPoliciesarrayAn array of service endpoint policies.
serviceEndpointsarrayAn array of service endpoints.
serviceGatewayobjectReference to another subresource.
sharingScopestringSet this property to Tenant to allow sharing subnet with other subscriptions in your AAD tenant. This property can only be set if defaultOutboundAccess is set to false, both properties can only be set if subnet is empty. Known values are: "Tenant" and "DelegatedServices". (Tenant, DelegatedServices)
typestringResource type.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectresource_group_name, virtual_network_name, subnet_name, subscription_id$expandGets the specified subnet by virtual network and resource group.
listselectresource_group_name, virtual_network_name, subscription_idGets all subnets in a virtual network.
create_or_updateinsertresource_group_name, virtual_network_name, subnet_name, subscription_idCreates or updates a subnet in the specified virtual network.
create_or_updatereplaceresource_group_name, virtual_network_name, subnet_name, subscription_idCreates or updates a subnet in the specified virtual network.
deletedeleteresource_group_name, virtual_network_name, subnet_name, subscription_idDeletes the specified subnet.
prepare_network_policiesexecresource_group_name, virtual_network_name, subnet_name, subscription_idPrepares a subnet by applying network intent policies.
unprepare_network_policiesexecresource_group_name, virtual_network_name, subnet_name, subscription_idUnprepares a subnet by removing network intent policies.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
resource_group_namestringThe name of the resource group. The name is case insensitive. Required.
subnet_namestringThe name of the subnet. Required.
subscription_idstring
virtual_network_namestringThe name of the virtual network. Required.
$expandstringExpands referenced resources. Default value is None.

SELECT examples

Gets the specified subnet by virtual network and resource group.

SELECT
id,
name,
addressPrefix,
addressPrefixes,
applicationGatewayIPConfigurations,
defaultOutboundAccess,
delegations,
etag,
ipAllocations,
ipConfigurationProfiles,
ipConfigurations,
ipamPoolPrefixAllocations,
natGateway,
networkSecurityGroup,
privateEndpointNetworkPolicies,
privateEndpoints,
privateLinkServiceNetworkPolicies,
provisioningState,
purpose,
resourceNavigationLinks,
routeTable,
serviceAssociationLinks,
serviceEndpointPolicies,
serviceEndpoints,
serviceGateway,
sharingScope,
type
FROM azure.network.subnets
WHERE resource_group_name = '{{ resource_group_name }}' -- required
AND virtual_network_name = '{{ virtual_network_name }}' -- required
AND subnet_name = '{{ subnet_name }}' -- required
AND subscription_id = '{{ subscription_id }}' -- required
AND $expand = '{{ $expand }}'
;

INSERT examples

Creates or updates a subnet in the specified virtual network.

INSERT INTO azure.network.subnets (
id,
name,
properties,
resource_group_name,
virtual_network_name,
subnet_name,
subscription_id
)
SELECT
'{{ id }}',
'{{ name }}',
'{{ properties }}',
'{{ resource_group_name }}',
'{{ virtual_network_name }}',
'{{ subnet_name }}',
'{{ subscription_id }}'
RETURNING
id,
name,
etag,
properties,
type
;

REPLACE examples

Creates or updates a subnet in the specified virtual network.

REPLACE azure.network.subnets
SET
id = '{{ id }}',
name = '{{ name }}',
properties = '{{ properties }}'
WHERE
resource_group_name = '{{ resource_group_name }}' --required
AND virtual_network_name = '{{ virtual_network_name }}' --required
AND subnet_name = '{{ subnet_name }}' --required
AND subscription_id = '{{ subscription_id }}' --required
RETURNING
id,
name,
etag,
properties,
type;

DELETE examples

Deletes the specified subnet.

DELETE FROM azure.network.subnets
WHERE resource_group_name = '{{ resource_group_name }}' --required
AND virtual_network_name = '{{ virtual_network_name }}' --required
AND subnet_name = '{{ subnet_name }}' --required
AND subscription_id = '{{ subscription_id }}' --required
;

Lifecycle Methods

Prepares a subnet by applying network intent policies.

EXEC azure.network.subnets.prepare_network_policies 
@resource_group_name='{{ resource_group_name }}' --required,
@virtual_network_name='{{ virtual_network_name }}' --required,
@subnet_name='{{ subnet_name }}' --required,
@subscription_id='{{ subscription_id }}' --required
@@json=
'{
"serviceName": "{{ serviceName }}",
"networkIntentPolicyConfigurations": "{{ networkIntentPolicyConfigurations }}"
}'
;