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:

Request successful. The operation returns the resulting Subnet resource.

NameDatatypeDescription
idstringResource ID.
namestringThe name of the resource that is unique within a resource group. This name can be used to access the resource.
etagstringA unique read-only string that changes whenever the resource is updated.
propertiesobjectProperties of the subnet.
typestringResource type.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectresourceGroupName, virtualNetworkName, subnetName, subscriptionId$expandGets the specified subnet by virtual network and resource group.
listselectresourceGroupName, virtualNetworkName, subscriptionIdGets all subnets in a virtual network.
create_or_updateinsertresourceGroupName, virtualNetworkName, subnetName, subscriptionIdCreates or updates a subnet in the specified virtual network.
deletedeleteresourceGroupName, virtualNetworkName, subnetName, subscriptionIdDeletes the specified subnet.
prepare_network_policiesexecresourceGroupName, virtualNetworkName, subnetName, subscriptionIdPrepares a subnet by applying network intent policies.
unprepare_network_policiesexecresourceGroupName, virtualNetworkName, subnetName, subscriptionIdUnprepares 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
resourceGroupNamestringThe name of the resource group.
subnetNamestringThe name of the subnet.
subscriptionIdstring (uuid)The ID of the target subscription. The value must be an UUID.
virtualNetworkNamestringThe name of the virtual network.
$expandstringExpands referenced resources.

SELECT examples

Gets the specified subnet by virtual network and resource group.

SELECT
id,
name,
etag,
properties,
type
FROM azure.network.subnets
WHERE resourceGroupName = '{{ resourceGroupName }}' -- required
AND virtualNetworkName = '{{ virtualNetworkName }}' -- required
AND subnetName = '{{ subnetName }}' -- required
AND subscriptionId = '{{ subscriptionId }}' -- required
AND $expand = '{{ $expand }}'
;

INSERT examples

Creates or updates a subnet in the specified virtual network.

INSERT INTO azure.network.subnets (
data__properties,
data__name,
data__type,
data__id,
resourceGroupName,
virtualNetworkName,
subnetName,
subscriptionId
)
SELECT
'{{ properties }}',
'{{ name }}',
'{{ type }}',
'{{ id }}',
'{{ resourceGroupName }}',
'{{ virtualNetworkName }}',
'{{ subnetName }}',
'{{ subscriptionId }}'
RETURNING
id,
name,
etag,
properties,
type
;

DELETE examples

Deletes the specified subnet.

DELETE FROM azure.network.subnets
WHERE resourceGroupName = '{{ resourceGroupName }}' --required
AND virtualNetworkName = '{{ virtualNetworkName }}' --required
AND subnetName = '{{ subnetName }}' --required
AND subscriptionId = '{{ subscriptionId }}' --required
;

Lifecycle Methods

Prepares a subnet by applying network intent policies.

EXEC azure.network.subnets.prepare_network_policies 
@resourceGroupName='{{ resourceGroupName }}' --required,
@virtualNetworkName='{{ virtualNetworkName }}' --required,
@subnetName='{{ subnetName }}' --required,
@subscriptionId='{{ subscriptionId }}' --required
@@json=
'{
"serviceName": "{{ serviceName }}",
"networkIntentPolicyConfigurations": "{{ networkIntentPolicyConfigurations }}"
}'
;