1. Packages
  2. Packages
  3. Azure Classic
  4. API Docs
  5. network
  6. Subnet

We recommend using Azure Native.

Viewing docs for Azure v4.42.0 (Older version)
published on Monday, Mar 9, 2026 by Pulumi
azure logo

We recommend using Azure Native.

Viewing docs for Azure v4.42.0 (Older version)
published on Monday, Mar 9, 2026 by Pulumi

    Manages a subnet. Subnets represent network segments within the IP space defined by the virtual network.

    NOTE on Virtual Networks and Subnet’s: This provider currently provides both a standalone Subnet resource, and allows for Subnets to be defined in-line within the Virtual Network resource. At this time you cannot use a Virtual Network with in-line Subnets in conjunction with any Subnet resources. Doing so will cause a conflict of Subnet configurations and will overwrite Subnet’s.

    Example Usage

    using Pulumi;
    using Azure = Pulumi.Azure;
    
    class MyStack : Stack
    {
        public MyStack()
        {
            var exampleResourceGroup = new Azure.Core.ResourceGroup("exampleResourceGroup", new Azure.Core.ResourceGroupArgs
            {
                Location = "West Europe",
            });
            var exampleVirtualNetwork = new Azure.Network.VirtualNetwork("exampleVirtualNetwork", new Azure.Network.VirtualNetworkArgs
            {
                AddressSpaces = 
                {
                    "10.0.0.0/16",
                },
                Location = exampleResourceGroup.Location,
                ResourceGroupName = exampleResourceGroup.Name,
            });
            var exampleSubnet = new Azure.Network.Subnet("exampleSubnet", new Azure.Network.SubnetArgs
            {
                ResourceGroupName = exampleResourceGroup.Name,
                VirtualNetworkName = exampleVirtualNetwork.Name,
                AddressPrefixes = 
                {
                    "10.0.1.0/24",
                },
                Delegations = 
                {
                    new Azure.Network.Inputs.SubnetDelegationArgs
                    {
                        Name = "delegation",
                        ServiceDelegation = new Azure.Network.Inputs.SubnetDelegationServiceDelegationArgs
                        {
                            Name = "Microsoft.ContainerInstance/containerGroups",
                            Actions = 
                            {
                                "Microsoft.Network/virtualNetworks/subnets/join/action",
                                "Microsoft.Network/virtualNetworks/subnets/prepareNetworkPolicies/action",
                            },
                        },
                    },
                },
            });
        }
    
    }
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-azure/sdk/v4/go/azure/core"
    	"github.com/pulumi/pulumi-azure/sdk/v4/go/azure/network"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		exampleResourceGroup, err := core.NewResourceGroup(ctx, "exampleResourceGroup", &core.ResourceGroupArgs{
    			Location: pulumi.String("West Europe"),
    		})
    		if err != nil {
    			return err
    		}
    		exampleVirtualNetwork, err := network.NewVirtualNetwork(ctx, "exampleVirtualNetwork", &network.VirtualNetworkArgs{
    			AddressSpaces: pulumi.StringArray{
    				pulumi.String("10.0.0.0/16"),
    			},
    			Location:          exampleResourceGroup.Location,
    			ResourceGroupName: exampleResourceGroup.Name,
    		})
    		if err != nil {
    			return err
    		}
    		_, err = network.NewSubnet(ctx, "exampleSubnet", &network.SubnetArgs{
    			ResourceGroupName:  exampleResourceGroup.Name,
    			VirtualNetworkName: exampleVirtualNetwork.Name,
    			AddressPrefixes: pulumi.StringArray{
    				pulumi.String("10.0.1.0/24"),
    			},
    			Delegations: network.SubnetDelegationArray{
    				&network.SubnetDelegationArgs{
    					Name: pulumi.String("delegation"),
    					ServiceDelegation: &network.SubnetDelegationServiceDelegationArgs{
    						Name: pulumi.String("Microsoft.ContainerInstance/containerGroups"),
    						Actions: pulumi.StringArray{
    							pulumi.String("Microsoft.Network/virtualNetworks/subnets/join/action"),
    							pulumi.String("Microsoft.Network/virtualNetworks/subnets/prepareNetworkPolicies/action"),
    						},
    					},
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    

    Example coming soon!

    import * as pulumi from "@pulumi/pulumi";
    import * as azure from "@pulumi/azure";
    
    const exampleResourceGroup = new azure.core.ResourceGroup("exampleResourceGroup", {location: "West Europe"});
    const exampleVirtualNetwork = new azure.network.VirtualNetwork("exampleVirtualNetwork", {
        addressSpaces: ["10.0.0.0/16"],
        location: exampleResourceGroup.location,
        resourceGroupName: exampleResourceGroup.name,
    });
    const exampleSubnet = new azure.network.Subnet("exampleSubnet", {
        resourceGroupName: exampleResourceGroup.name,
        virtualNetworkName: exampleVirtualNetwork.name,
        addressPrefixes: ["10.0.1.0/24"],
        delegations: [{
            name: "delegation",
            serviceDelegation: {
                name: "Microsoft.ContainerInstance/containerGroups",
                actions: [
                    "Microsoft.Network/virtualNetworks/subnets/join/action",
                    "Microsoft.Network/virtualNetworks/subnets/prepareNetworkPolicies/action",
                ],
            },
        }],
    });
    
    import pulumi
    import pulumi_azure as azure
    
    example_resource_group = azure.core.ResourceGroup("exampleResourceGroup", location="West Europe")
    example_virtual_network = azure.network.VirtualNetwork("exampleVirtualNetwork",
        address_spaces=["10.0.0.0/16"],
        location=example_resource_group.location,
        resource_group_name=example_resource_group.name)
    example_subnet = azure.network.Subnet("exampleSubnet",
        resource_group_name=example_resource_group.name,
        virtual_network_name=example_virtual_network.name,
        address_prefixes=["10.0.1.0/24"],
        delegations=[azure.network.SubnetDelegationArgs(
            name="delegation",
            service_delegation=azure.network.SubnetDelegationServiceDelegationArgs(
                name="Microsoft.ContainerInstance/containerGroups",
                actions=[
                    "Microsoft.Network/virtualNetworks/subnets/join/action",
                    "Microsoft.Network/virtualNetworks/subnets/prepareNetworkPolicies/action",
                ],
            ),
        )])
    

    Example coming soon!

    Create Subnet Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new Subnet(name: string, args: SubnetArgs, opts?: CustomResourceOptions);
    @overload
    def Subnet(resource_name: str,
               args: SubnetArgs,
               opts: Optional[ResourceOptions] = None)
    
    @overload
    def Subnet(resource_name: str,
               opts: Optional[ResourceOptions] = None,
               resource_group_name: Optional[str] = None,
               virtual_network_name: Optional[str] = None,
               address_prefix: Optional[str] = None,
               address_prefixes: Optional[Sequence[str]] = None,
               delegations: Optional[Sequence[SubnetDelegationArgs]] = None,
               enforce_private_link_endpoint_network_policies: Optional[bool] = None,
               enforce_private_link_service_network_policies: Optional[bool] = None,
               name: Optional[str] = None,
               service_endpoint_policy_ids: Optional[Sequence[str]] = None,
               service_endpoints: Optional[Sequence[str]] = None)
    func NewSubnet(ctx *Context, name string, args SubnetArgs, opts ...ResourceOption) (*Subnet, error)
    public Subnet(string name, SubnetArgs args, CustomResourceOptions? opts = null)
    public Subnet(String name, SubnetArgs args)
    public Subnet(String name, SubnetArgs args, CustomResourceOptions options)
    
    type: azure:network:Subnet
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args SubnetArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args SubnetArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args SubnetArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args SubnetArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args SubnetArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Constructor example

    The following reference example uses placeholder values for all input properties.

    var subnetResource = new Azure.Network.Subnet("subnetResource", new()
    {
        ResourceGroupName = "string",
        VirtualNetworkName = "string",
        AddressPrefixes = new[]
        {
            "string",
        },
        Delegations = new[]
        {
            new Azure.Network.Inputs.SubnetDelegationArgs
            {
                Name = "string",
                ServiceDelegation = new Azure.Network.Inputs.SubnetDelegationServiceDelegationArgs
                {
                    Name = "string",
                    Actions = new[]
                    {
                        "string",
                    },
                },
            },
        },
        EnforcePrivateLinkEndpointNetworkPolicies = false,
        EnforcePrivateLinkServiceNetworkPolicies = false,
        Name = "string",
        ServiceEndpointPolicyIds = new[]
        {
            "string",
        },
        ServiceEndpoints = new[]
        {
            "string",
        },
    });
    
    example, err := network.NewSubnet(ctx, "subnetResource", &network.SubnetArgs{
    	ResourceGroupName:  pulumi.String("string"),
    	VirtualNetworkName: pulumi.String("string"),
    	AddressPrefixes: pulumi.StringArray{
    		pulumi.String("string"),
    	},
    	Delegations: network.SubnetDelegationArray{
    		&network.SubnetDelegationArgs{
    			Name: pulumi.String("string"),
    			ServiceDelegation: &network.SubnetDelegationServiceDelegationArgs{
    				Name: pulumi.String("string"),
    				Actions: pulumi.StringArray{
    					pulumi.String("string"),
    				},
    			},
    		},
    	},
    	EnforcePrivateLinkEndpointNetworkPolicies: pulumi.Bool(false),
    	EnforcePrivateLinkServiceNetworkPolicies:  pulumi.Bool(false),
    	Name:                                      pulumi.String("string"),
    	ServiceEndpointPolicyIds: pulumi.StringArray{
    		pulumi.String("string"),
    	},
    	ServiceEndpoints: pulumi.StringArray{
    		pulumi.String("string"),
    	},
    })
    
    var subnetResource = new Subnet("subnetResource", SubnetArgs.builder()
        .resourceGroupName("string")
        .virtualNetworkName("string")
        .addressPrefixes("string")
        .delegations(SubnetDelegationArgs.builder()
            .name("string")
            .serviceDelegation(SubnetDelegationServiceDelegationArgs.builder()
                .name("string")
                .actions("string")
                .build())
            .build())
        .enforcePrivateLinkEndpointNetworkPolicies(false)
        .enforcePrivateLinkServiceNetworkPolicies(false)
        .name("string")
        .serviceEndpointPolicyIds("string")
        .serviceEndpoints("string")
        .build());
    
    subnet_resource = azure.network.Subnet("subnetResource",
        resource_group_name="string",
        virtual_network_name="string",
        address_prefixes=["string"],
        delegations=[{
            "name": "string",
            "service_delegation": {
                "name": "string",
                "actions": ["string"],
            },
        }],
        enforce_private_link_endpoint_network_policies=False,
        enforce_private_link_service_network_policies=False,
        name="string",
        service_endpoint_policy_ids=["string"],
        service_endpoints=["string"])
    
    const subnetResource = new azure.network.Subnet("subnetResource", {
        resourceGroupName: "string",
        virtualNetworkName: "string",
        addressPrefixes: ["string"],
        delegations: [{
            name: "string",
            serviceDelegation: {
                name: "string",
                actions: ["string"],
            },
        }],
        enforcePrivateLinkEndpointNetworkPolicies: false,
        enforcePrivateLinkServiceNetworkPolicies: false,
        name: "string",
        serviceEndpointPolicyIds: ["string"],
        serviceEndpoints: ["string"],
    });
    
    type: azure:network:Subnet
    properties:
        addressPrefixes:
            - string
        delegations:
            - name: string
              serviceDelegation:
                actions:
                    - string
                name: string
        enforcePrivateLinkEndpointNetworkPolicies: false
        enforcePrivateLinkServiceNetworkPolicies: false
        name: string
        resourceGroupName: string
        serviceEndpointPolicyIds:
            - string
        serviceEndpoints:
            - string
        virtualNetworkName: string
    

    Subnet Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

    The Subnet resource accepts the following input properties:

    ResourceGroupName string
    The name of the resource group in which to create the subnet. Changing this forces a new resource to be created.
    VirtualNetworkName string
    The name of the virtual network to which to attach the subnet. Changing this forces a new resource to be created.
    AddressPrefix string
    The address prefix to use for the subnet.

    Deprecated: Use the address_prefixes property instead.

    AddressPrefixes List<string>
    The address prefixes to use for the subnet.
    Delegations List<SubnetDelegation>
    One or more delegation blocks as defined below.
    EnforcePrivateLinkEndpointNetworkPolicies bool
    Enable or Disable network policies for the private link endpoint on the subnet. Setting this to true will Disable the policy and setting this to false will Enable the policy. Default value is false.
    EnforcePrivateLinkServiceNetworkPolicies bool
    Enable or Disable network policies for the private link service on the subnet. Setting this to true will Disable the policy and setting this to false will Enable the policy. Default value is false.
    Name string
    The name of the subnet. Changing this forces a new resource to be created.
    ServiceEndpointPolicyIds List<string>
    The list of IDs of Service Endpoint Policies to associate with the subnet.
    ServiceEndpoints List<string>
    The list of Service endpoints to associate with the subnet. Possible values include: Microsoft.AzureActiveDirectory, Microsoft.AzureCosmosDB, Microsoft.ContainerRegistry, Microsoft.EventHub, Microsoft.KeyVault, Microsoft.ServiceBus, Microsoft.Sql, Microsoft.Storage and Microsoft.Web.
    ResourceGroupName string
    The name of the resource group in which to create the subnet. Changing this forces a new resource to be created.
    VirtualNetworkName string
    The name of the virtual network to which to attach the subnet. Changing this forces a new resource to be created.
    AddressPrefix string
    The address prefix to use for the subnet.

    Deprecated: Use the address_prefixes property instead.

    AddressPrefixes []string
    The address prefixes to use for the subnet.
    Delegations []SubnetDelegationArgs
    One or more delegation blocks as defined below.
    EnforcePrivateLinkEndpointNetworkPolicies bool
    Enable or Disable network policies for the private link endpoint on the subnet. Setting this to true will Disable the policy and setting this to false will Enable the policy. Default value is false.
    EnforcePrivateLinkServiceNetworkPolicies bool
    Enable or Disable network policies for the private link service on the subnet. Setting this to true will Disable the policy and setting this to false will Enable the policy. Default value is false.
    Name string
    The name of the subnet. Changing this forces a new resource to be created.
    ServiceEndpointPolicyIds []string
    The list of IDs of Service Endpoint Policies to associate with the subnet.
    ServiceEndpoints []string
    The list of Service endpoints to associate with the subnet. Possible values include: Microsoft.AzureActiveDirectory, Microsoft.AzureCosmosDB, Microsoft.ContainerRegistry, Microsoft.EventHub, Microsoft.KeyVault, Microsoft.ServiceBus, Microsoft.Sql, Microsoft.Storage and Microsoft.Web.
    resourceGroupName String
    The name of the resource group in which to create the subnet. Changing this forces a new resource to be created.
    virtualNetworkName String
    The name of the virtual network to which to attach the subnet. Changing this forces a new resource to be created.
    addressPrefix String
    The address prefix to use for the subnet.

    Deprecated: Use the address_prefixes property instead.

    addressPrefixes List<String>
    The address prefixes to use for the subnet.
    delegations List<SubnetDelegation>
    One or more delegation blocks as defined below.
    enforcePrivateLinkEndpointNetworkPolicies Boolean
    Enable or Disable network policies for the private link endpoint on the subnet. Setting this to true will Disable the policy and setting this to false will Enable the policy. Default value is false.
    enforcePrivateLinkServiceNetworkPolicies Boolean
    Enable or Disable network policies for the private link service on the subnet. Setting this to true will Disable the policy and setting this to false will Enable the policy. Default value is false.
    name String
    The name of the subnet. Changing this forces a new resource to be created.
    serviceEndpointPolicyIds List<String>
    The list of IDs of Service Endpoint Policies to associate with the subnet.
    serviceEndpoints List<String>
    The list of Service endpoints to associate with the subnet. Possible values include: Microsoft.AzureActiveDirectory, Microsoft.AzureCosmosDB, Microsoft.ContainerRegistry, Microsoft.EventHub, Microsoft.KeyVault, Microsoft.ServiceBus, Microsoft.Sql, Microsoft.Storage and Microsoft.Web.
    resourceGroupName string
    The name of the resource group in which to create the subnet. Changing this forces a new resource to be created.
    virtualNetworkName string
    The name of the virtual network to which to attach the subnet. Changing this forces a new resource to be created.
    addressPrefix string
    The address prefix to use for the subnet.

    Deprecated: Use the address_prefixes property instead.

    addressPrefixes string[]
    The address prefixes to use for the subnet.
    delegations SubnetDelegation[]
    One or more delegation blocks as defined below.
    enforcePrivateLinkEndpointNetworkPolicies boolean
    Enable or Disable network policies for the private link endpoint on the subnet. Setting this to true will Disable the policy and setting this to false will Enable the policy. Default value is false.
    enforcePrivateLinkServiceNetworkPolicies boolean
    Enable or Disable network policies for the private link service on the subnet. Setting this to true will Disable the policy and setting this to false will Enable the policy. Default value is false.
    name string
    The name of the subnet. Changing this forces a new resource to be created.
    serviceEndpointPolicyIds string[]
    The list of IDs of Service Endpoint Policies to associate with the subnet.
    serviceEndpoints string[]
    The list of Service endpoints to associate with the subnet. Possible values include: Microsoft.AzureActiveDirectory, Microsoft.AzureCosmosDB, Microsoft.ContainerRegistry, Microsoft.EventHub, Microsoft.KeyVault, Microsoft.ServiceBus, Microsoft.Sql, Microsoft.Storage and Microsoft.Web.
    resource_group_name str
    The name of the resource group in which to create the subnet. Changing this forces a new resource to be created.
    virtual_network_name str
    The name of the virtual network to which to attach the subnet. Changing this forces a new resource to be created.
    address_prefix str
    The address prefix to use for the subnet.

    Deprecated: Use the address_prefixes property instead.

    address_prefixes Sequence[str]
    The address prefixes to use for the subnet.
    delegations Sequence[SubnetDelegationArgs]
    One or more delegation blocks as defined below.
    enforce_private_link_endpoint_network_policies bool
    Enable or Disable network policies for the private link endpoint on the subnet. Setting this to true will Disable the policy and setting this to false will Enable the policy. Default value is false.
    enforce_private_link_service_network_policies bool
    Enable or Disable network policies for the private link service on the subnet. Setting this to true will Disable the policy and setting this to false will Enable the policy. Default value is false.
    name str
    The name of the subnet. Changing this forces a new resource to be created.
    service_endpoint_policy_ids Sequence[str]
    The list of IDs of Service Endpoint Policies to associate with the subnet.
    service_endpoints Sequence[str]
    The list of Service endpoints to associate with the subnet. Possible values include: Microsoft.AzureActiveDirectory, Microsoft.AzureCosmosDB, Microsoft.ContainerRegistry, Microsoft.EventHub, Microsoft.KeyVault, Microsoft.ServiceBus, Microsoft.Sql, Microsoft.Storage and Microsoft.Web.
    resourceGroupName String
    The name of the resource group in which to create the subnet. Changing this forces a new resource to be created.
    virtualNetworkName String
    The name of the virtual network to which to attach the subnet. Changing this forces a new resource to be created.
    addressPrefix String
    The address prefix to use for the subnet.

    Deprecated: Use the address_prefixes property instead.

    addressPrefixes List<String>
    The address prefixes to use for the subnet.
    delegations List<Property Map>
    One or more delegation blocks as defined below.
    enforcePrivateLinkEndpointNetworkPolicies Boolean
    Enable or Disable network policies for the private link endpoint on the subnet. Setting this to true will Disable the policy and setting this to false will Enable the policy. Default value is false.
    enforcePrivateLinkServiceNetworkPolicies Boolean
    Enable or Disable network policies for the private link service on the subnet. Setting this to true will Disable the policy and setting this to false will Enable the policy. Default value is false.
    name String
    The name of the subnet. Changing this forces a new resource to be created.
    serviceEndpointPolicyIds List<String>
    The list of IDs of Service Endpoint Policies to associate with the subnet.
    serviceEndpoints List<String>
    The list of Service endpoints to associate with the subnet. Possible values include: Microsoft.AzureActiveDirectory, Microsoft.AzureCosmosDB, Microsoft.ContainerRegistry, Microsoft.EventHub, Microsoft.KeyVault, Microsoft.ServiceBus, Microsoft.Sql, Microsoft.Storage and Microsoft.Web.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the Subnet resource produces the following output properties:

    Id string
    The provider-assigned unique ID for this managed resource.
    Id string
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.
    id string
    The provider-assigned unique ID for this managed resource.
    id str
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.

    Look up Existing Subnet Resource

    Get an existing Subnet resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

    public static get(name: string, id: Input<ID>, state?: SubnetState, opts?: CustomResourceOptions): Subnet
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            address_prefix: Optional[str] = None,
            address_prefixes: Optional[Sequence[str]] = None,
            delegations: Optional[Sequence[SubnetDelegationArgs]] = None,
            enforce_private_link_endpoint_network_policies: Optional[bool] = None,
            enforce_private_link_service_network_policies: Optional[bool] = None,
            name: Optional[str] = None,
            resource_group_name: Optional[str] = None,
            service_endpoint_policy_ids: Optional[Sequence[str]] = None,
            service_endpoints: Optional[Sequence[str]] = None,
            virtual_network_name: Optional[str] = None) -> Subnet
    func GetSubnet(ctx *Context, name string, id IDInput, state *SubnetState, opts ...ResourceOption) (*Subnet, error)
    public static Subnet Get(string name, Input<string> id, SubnetState? state, CustomResourceOptions? opts = null)
    public static Subnet get(String name, Output<String> id, SubnetState state, CustomResourceOptions options)
    resources:  _:    type: azure:network:Subnet    get:      id: ${id}
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    resource_name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    The following state arguments are supported:
    AddressPrefix string
    The address prefix to use for the subnet.

    Deprecated: Use the address_prefixes property instead.

    AddressPrefixes List<string>
    The address prefixes to use for the subnet.
    Delegations List<SubnetDelegation>
    One or more delegation blocks as defined below.
    EnforcePrivateLinkEndpointNetworkPolicies bool
    Enable or Disable network policies for the private link endpoint on the subnet. Setting this to true will Disable the policy and setting this to false will Enable the policy. Default value is false.
    EnforcePrivateLinkServiceNetworkPolicies bool
    Enable or Disable network policies for the private link service on the subnet. Setting this to true will Disable the policy and setting this to false will Enable the policy. Default value is false.
    Name string
    The name of the subnet. Changing this forces a new resource to be created.
    ResourceGroupName string
    The name of the resource group in which to create the subnet. Changing this forces a new resource to be created.
    ServiceEndpointPolicyIds List<string>
    The list of IDs of Service Endpoint Policies to associate with the subnet.
    ServiceEndpoints List<string>
    The list of Service endpoints to associate with the subnet. Possible values include: Microsoft.AzureActiveDirectory, Microsoft.AzureCosmosDB, Microsoft.ContainerRegistry, Microsoft.EventHub, Microsoft.KeyVault, Microsoft.ServiceBus, Microsoft.Sql, Microsoft.Storage and Microsoft.Web.
    VirtualNetworkName string
    The name of the virtual network to which to attach the subnet. Changing this forces a new resource to be created.
    AddressPrefix string
    The address prefix to use for the subnet.

    Deprecated: Use the address_prefixes property instead.

    AddressPrefixes []string
    The address prefixes to use for the subnet.
    Delegations []SubnetDelegationArgs
    One or more delegation blocks as defined below.
    EnforcePrivateLinkEndpointNetworkPolicies bool
    Enable or Disable network policies for the private link endpoint on the subnet. Setting this to true will Disable the policy and setting this to false will Enable the policy. Default value is false.
    EnforcePrivateLinkServiceNetworkPolicies bool
    Enable or Disable network policies for the private link service on the subnet. Setting this to true will Disable the policy and setting this to false will Enable the policy. Default value is false.
    Name string
    The name of the subnet. Changing this forces a new resource to be created.
    ResourceGroupName string
    The name of the resource group in which to create the subnet. Changing this forces a new resource to be created.
    ServiceEndpointPolicyIds []string
    The list of IDs of Service Endpoint Policies to associate with the subnet.
    ServiceEndpoints []string
    The list of Service endpoints to associate with the subnet. Possible values include: Microsoft.AzureActiveDirectory, Microsoft.AzureCosmosDB, Microsoft.ContainerRegistry, Microsoft.EventHub, Microsoft.KeyVault, Microsoft.ServiceBus, Microsoft.Sql, Microsoft.Storage and Microsoft.Web.
    VirtualNetworkName string
    The name of the virtual network to which to attach the subnet. Changing this forces a new resource to be created.
    addressPrefix String
    The address prefix to use for the subnet.

    Deprecated: Use the address_prefixes property instead.

    addressPrefixes List<String>
    The address prefixes to use for the subnet.
    delegations List<SubnetDelegation>
    One or more delegation blocks as defined below.
    enforcePrivateLinkEndpointNetworkPolicies Boolean
    Enable or Disable network policies for the private link endpoint on the subnet. Setting this to true will Disable the policy and setting this to false will Enable the policy. Default value is false.
    enforcePrivateLinkServiceNetworkPolicies Boolean
    Enable or Disable network policies for the private link service on the subnet. Setting this to true will Disable the policy and setting this to false will Enable the policy. Default value is false.
    name String
    The name of the subnet. Changing this forces a new resource to be created.
    resourceGroupName String
    The name of the resource group in which to create the subnet. Changing this forces a new resource to be created.
    serviceEndpointPolicyIds List<String>
    The list of IDs of Service Endpoint Policies to associate with the subnet.
    serviceEndpoints List<String>
    The list of Service endpoints to associate with the subnet. Possible values include: Microsoft.AzureActiveDirectory, Microsoft.AzureCosmosDB, Microsoft.ContainerRegistry, Microsoft.EventHub, Microsoft.KeyVault, Microsoft.ServiceBus, Microsoft.Sql, Microsoft.Storage and Microsoft.Web.
    virtualNetworkName String
    The name of the virtual network to which to attach the subnet. Changing this forces a new resource to be created.
    addressPrefix string
    The address prefix to use for the subnet.

    Deprecated: Use the address_prefixes property instead.

    addressPrefixes string[]
    The address prefixes to use for the subnet.
    delegations SubnetDelegation[]
    One or more delegation blocks as defined below.
    enforcePrivateLinkEndpointNetworkPolicies boolean
    Enable or Disable network policies for the private link endpoint on the subnet. Setting this to true will Disable the policy and setting this to false will Enable the policy. Default value is false.
    enforcePrivateLinkServiceNetworkPolicies boolean
    Enable or Disable network policies for the private link service on the subnet. Setting this to true will Disable the policy and setting this to false will Enable the policy. Default value is false.
    name string
    The name of the subnet. Changing this forces a new resource to be created.
    resourceGroupName string
    The name of the resource group in which to create the subnet. Changing this forces a new resource to be created.
    serviceEndpointPolicyIds string[]
    The list of IDs of Service Endpoint Policies to associate with the subnet.
    serviceEndpoints string[]
    The list of Service endpoints to associate with the subnet. Possible values include: Microsoft.AzureActiveDirectory, Microsoft.AzureCosmosDB, Microsoft.ContainerRegistry, Microsoft.EventHub, Microsoft.KeyVault, Microsoft.ServiceBus, Microsoft.Sql, Microsoft.Storage and Microsoft.Web.
    virtualNetworkName string
    The name of the virtual network to which to attach the subnet. Changing this forces a new resource to be created.
    address_prefix str
    The address prefix to use for the subnet.

    Deprecated: Use the address_prefixes property instead.

    address_prefixes Sequence[str]
    The address prefixes to use for the subnet.
    delegations Sequence[SubnetDelegationArgs]
    One or more delegation blocks as defined below.
    enforce_private_link_endpoint_network_policies bool
    Enable or Disable network policies for the private link endpoint on the subnet. Setting this to true will Disable the policy and setting this to false will Enable the policy. Default value is false.
    enforce_private_link_service_network_policies bool
    Enable or Disable network policies for the private link service on the subnet. Setting this to true will Disable the policy and setting this to false will Enable the policy. Default value is false.
    name str
    The name of the subnet. Changing this forces a new resource to be created.
    resource_group_name str
    The name of the resource group in which to create the subnet. Changing this forces a new resource to be created.
    service_endpoint_policy_ids Sequence[str]
    The list of IDs of Service Endpoint Policies to associate with the subnet.
    service_endpoints Sequence[str]
    The list of Service endpoints to associate with the subnet. Possible values include: Microsoft.AzureActiveDirectory, Microsoft.AzureCosmosDB, Microsoft.ContainerRegistry, Microsoft.EventHub, Microsoft.KeyVault, Microsoft.ServiceBus, Microsoft.Sql, Microsoft.Storage and Microsoft.Web.
    virtual_network_name str
    The name of the virtual network to which to attach the subnet. Changing this forces a new resource to be created.
    addressPrefix String
    The address prefix to use for the subnet.

    Deprecated: Use the address_prefixes property instead.

    addressPrefixes List<String>
    The address prefixes to use for the subnet.
    delegations List<Property Map>
    One or more delegation blocks as defined below.
    enforcePrivateLinkEndpointNetworkPolicies Boolean
    Enable or Disable network policies for the private link endpoint on the subnet. Setting this to true will Disable the policy and setting this to false will Enable the policy. Default value is false.
    enforcePrivateLinkServiceNetworkPolicies Boolean
    Enable or Disable network policies for the private link service on the subnet. Setting this to true will Disable the policy and setting this to false will Enable the policy. Default value is false.
    name String
    The name of the subnet. Changing this forces a new resource to be created.
    resourceGroupName String
    The name of the resource group in which to create the subnet. Changing this forces a new resource to be created.
    serviceEndpointPolicyIds List<String>
    The list of IDs of Service Endpoint Policies to associate with the subnet.
    serviceEndpoints List<String>
    The list of Service endpoints to associate with the subnet. Possible values include: Microsoft.AzureActiveDirectory, Microsoft.AzureCosmosDB, Microsoft.ContainerRegistry, Microsoft.EventHub, Microsoft.KeyVault, Microsoft.ServiceBus, Microsoft.Sql, Microsoft.Storage and Microsoft.Web.
    virtualNetworkName String
    The name of the virtual network to which to attach the subnet. Changing this forces a new resource to be created.

    Supporting Types

    SubnetDelegation, SubnetDelegationArgs

    Name string
    A name for this delegation.
    ServiceDelegation SubnetDelegationServiceDelegation
    A service_delegation block as defined below.
    Name string
    A name for this delegation.
    ServiceDelegation SubnetDelegationServiceDelegation
    A service_delegation block as defined below.
    name String
    A name for this delegation.
    serviceDelegation SubnetDelegationServiceDelegation
    A service_delegation block as defined below.
    name string
    A name for this delegation.
    serviceDelegation SubnetDelegationServiceDelegation
    A service_delegation block as defined below.
    name str
    A name for this delegation.
    service_delegation SubnetDelegationServiceDelegation
    A service_delegation block as defined below.
    name String
    A name for this delegation.
    serviceDelegation Property Map
    A service_delegation block as defined below.

    SubnetDelegationServiceDelegation, SubnetDelegationServiceDelegationArgs

    Name string
    The name of service to delegate to. Possible values include Microsoft.ApiManagement/service, Microsoft.AzureCosmosDB/clusters, Microsoft.BareMetal/AzureVMware, Microsoft.BareMetal/CrayServers, Microsoft.Batch/batchAccounts, Microsoft.ContainerInstance/containerGroups, Microsoft.ContainerService/managedClusters, Microsoft.Databricks/workspaces, Microsoft.DBforMySQL/flexibleServers, Microsoft.DBforMySQL/serversv2, Microsoft.DBforPostgreSQL/flexibleServers, Microsoft.DBforPostgreSQL/serversv2, Microsoft.DBforPostgreSQL/singleServers, Microsoft.HardwareSecurityModules/dedicatedHSMs, Microsoft.Kusto/clusters, Microsoft.Logic/integrationServiceEnvironments, Microsoft.MachineLearningServices/workspaces, Microsoft.Netapp/volumes, Microsoft.Network/managedResolvers, Microsoft.PowerPlatform/vnetaccesslinks, Microsoft.ServiceFabricMesh/networks, Microsoft.Sql/managedInstances, Microsoft.Sql/servers, Microsoft.StoragePool/diskPools, Microsoft.StreamAnalytics/streamingJobs, Microsoft.Synapse/workspaces, Microsoft.Web/hostingEnvironments, and Microsoft.Web/serverFarms.
    Actions List<string>
    A list of Actions which should be delegated. This list is specific to the service to delegate to. Possible values include Microsoft.Network/networkinterfaces/*, Microsoft.Network/virtualNetworks/subnets/action, Microsoft.Network/virtualNetworks/subnets/join/action, Microsoft.Network/virtualNetworks/subnets/prepareNetworkPolicies/action and Microsoft.Network/virtualNetworks/subnets/unprepareNetworkPolicies/action.
    Name string
    The name of service to delegate to. Possible values include Microsoft.ApiManagement/service, Microsoft.AzureCosmosDB/clusters, Microsoft.BareMetal/AzureVMware, Microsoft.BareMetal/CrayServers, Microsoft.Batch/batchAccounts, Microsoft.ContainerInstance/containerGroups, Microsoft.ContainerService/managedClusters, Microsoft.Databricks/workspaces, Microsoft.DBforMySQL/flexibleServers, Microsoft.DBforMySQL/serversv2, Microsoft.DBforPostgreSQL/flexibleServers, Microsoft.DBforPostgreSQL/serversv2, Microsoft.DBforPostgreSQL/singleServers, Microsoft.HardwareSecurityModules/dedicatedHSMs, Microsoft.Kusto/clusters, Microsoft.Logic/integrationServiceEnvironments, Microsoft.MachineLearningServices/workspaces, Microsoft.Netapp/volumes, Microsoft.Network/managedResolvers, Microsoft.PowerPlatform/vnetaccesslinks, Microsoft.ServiceFabricMesh/networks, Microsoft.Sql/managedInstances, Microsoft.Sql/servers, Microsoft.StoragePool/diskPools, Microsoft.StreamAnalytics/streamingJobs, Microsoft.Synapse/workspaces, Microsoft.Web/hostingEnvironments, and Microsoft.Web/serverFarms.
    Actions []string
    A list of Actions which should be delegated. This list is specific to the service to delegate to. Possible values include Microsoft.Network/networkinterfaces/*, Microsoft.Network/virtualNetworks/subnets/action, Microsoft.Network/virtualNetworks/subnets/join/action, Microsoft.Network/virtualNetworks/subnets/prepareNetworkPolicies/action and Microsoft.Network/virtualNetworks/subnets/unprepareNetworkPolicies/action.
    name String
    The name of service to delegate to. Possible values include Microsoft.ApiManagement/service, Microsoft.AzureCosmosDB/clusters, Microsoft.BareMetal/AzureVMware, Microsoft.BareMetal/CrayServers, Microsoft.Batch/batchAccounts, Microsoft.ContainerInstance/containerGroups, Microsoft.ContainerService/managedClusters, Microsoft.Databricks/workspaces, Microsoft.DBforMySQL/flexibleServers, Microsoft.DBforMySQL/serversv2, Microsoft.DBforPostgreSQL/flexibleServers, Microsoft.DBforPostgreSQL/serversv2, Microsoft.DBforPostgreSQL/singleServers, Microsoft.HardwareSecurityModules/dedicatedHSMs, Microsoft.Kusto/clusters, Microsoft.Logic/integrationServiceEnvironments, Microsoft.MachineLearningServices/workspaces, Microsoft.Netapp/volumes, Microsoft.Network/managedResolvers, Microsoft.PowerPlatform/vnetaccesslinks, Microsoft.ServiceFabricMesh/networks, Microsoft.Sql/managedInstances, Microsoft.Sql/servers, Microsoft.StoragePool/diskPools, Microsoft.StreamAnalytics/streamingJobs, Microsoft.Synapse/workspaces, Microsoft.Web/hostingEnvironments, and Microsoft.Web/serverFarms.
    actions List<String>
    A list of Actions which should be delegated. This list is specific to the service to delegate to. Possible values include Microsoft.Network/networkinterfaces/*, Microsoft.Network/virtualNetworks/subnets/action, Microsoft.Network/virtualNetworks/subnets/join/action, Microsoft.Network/virtualNetworks/subnets/prepareNetworkPolicies/action and Microsoft.Network/virtualNetworks/subnets/unprepareNetworkPolicies/action.
    name string
    The name of service to delegate to. Possible values include Microsoft.ApiManagement/service, Microsoft.AzureCosmosDB/clusters, Microsoft.BareMetal/AzureVMware, Microsoft.BareMetal/CrayServers, Microsoft.Batch/batchAccounts, Microsoft.ContainerInstance/containerGroups, Microsoft.ContainerService/managedClusters, Microsoft.Databricks/workspaces, Microsoft.DBforMySQL/flexibleServers, Microsoft.DBforMySQL/serversv2, Microsoft.DBforPostgreSQL/flexibleServers, Microsoft.DBforPostgreSQL/serversv2, Microsoft.DBforPostgreSQL/singleServers, Microsoft.HardwareSecurityModules/dedicatedHSMs, Microsoft.Kusto/clusters, Microsoft.Logic/integrationServiceEnvironments, Microsoft.MachineLearningServices/workspaces, Microsoft.Netapp/volumes, Microsoft.Network/managedResolvers, Microsoft.PowerPlatform/vnetaccesslinks, Microsoft.ServiceFabricMesh/networks, Microsoft.Sql/managedInstances, Microsoft.Sql/servers, Microsoft.StoragePool/diskPools, Microsoft.StreamAnalytics/streamingJobs, Microsoft.Synapse/workspaces, Microsoft.Web/hostingEnvironments, and Microsoft.Web/serverFarms.
    actions string[]
    A list of Actions which should be delegated. This list is specific to the service to delegate to. Possible values include Microsoft.Network/networkinterfaces/*, Microsoft.Network/virtualNetworks/subnets/action, Microsoft.Network/virtualNetworks/subnets/join/action, Microsoft.Network/virtualNetworks/subnets/prepareNetworkPolicies/action and Microsoft.Network/virtualNetworks/subnets/unprepareNetworkPolicies/action.
    name str
    The name of service to delegate to. Possible values include Microsoft.ApiManagement/service, Microsoft.AzureCosmosDB/clusters, Microsoft.BareMetal/AzureVMware, Microsoft.BareMetal/CrayServers, Microsoft.Batch/batchAccounts, Microsoft.ContainerInstance/containerGroups, Microsoft.ContainerService/managedClusters, Microsoft.Databricks/workspaces, Microsoft.DBforMySQL/flexibleServers, Microsoft.DBforMySQL/serversv2, Microsoft.DBforPostgreSQL/flexibleServers, Microsoft.DBforPostgreSQL/serversv2, Microsoft.DBforPostgreSQL/singleServers, Microsoft.HardwareSecurityModules/dedicatedHSMs, Microsoft.Kusto/clusters, Microsoft.Logic/integrationServiceEnvironments, Microsoft.MachineLearningServices/workspaces, Microsoft.Netapp/volumes, Microsoft.Network/managedResolvers, Microsoft.PowerPlatform/vnetaccesslinks, Microsoft.ServiceFabricMesh/networks, Microsoft.Sql/managedInstances, Microsoft.Sql/servers, Microsoft.StoragePool/diskPools, Microsoft.StreamAnalytics/streamingJobs, Microsoft.Synapse/workspaces, Microsoft.Web/hostingEnvironments, and Microsoft.Web/serverFarms.
    actions Sequence[str]
    A list of Actions which should be delegated. This list is specific to the service to delegate to. Possible values include Microsoft.Network/networkinterfaces/*, Microsoft.Network/virtualNetworks/subnets/action, Microsoft.Network/virtualNetworks/subnets/join/action, Microsoft.Network/virtualNetworks/subnets/prepareNetworkPolicies/action and Microsoft.Network/virtualNetworks/subnets/unprepareNetworkPolicies/action.
    name String
    The name of service to delegate to. Possible values include Microsoft.ApiManagement/service, Microsoft.AzureCosmosDB/clusters, Microsoft.BareMetal/AzureVMware, Microsoft.BareMetal/CrayServers, Microsoft.Batch/batchAccounts, Microsoft.ContainerInstance/containerGroups, Microsoft.ContainerService/managedClusters, Microsoft.Databricks/workspaces, Microsoft.DBforMySQL/flexibleServers, Microsoft.DBforMySQL/serversv2, Microsoft.DBforPostgreSQL/flexibleServers, Microsoft.DBforPostgreSQL/serversv2, Microsoft.DBforPostgreSQL/singleServers, Microsoft.HardwareSecurityModules/dedicatedHSMs, Microsoft.Kusto/clusters, Microsoft.Logic/integrationServiceEnvironments, Microsoft.MachineLearningServices/workspaces, Microsoft.Netapp/volumes, Microsoft.Network/managedResolvers, Microsoft.PowerPlatform/vnetaccesslinks, Microsoft.ServiceFabricMesh/networks, Microsoft.Sql/managedInstances, Microsoft.Sql/servers, Microsoft.StoragePool/diskPools, Microsoft.StreamAnalytics/streamingJobs, Microsoft.Synapse/workspaces, Microsoft.Web/hostingEnvironments, and Microsoft.Web/serverFarms.
    actions List<String>
    A list of Actions which should be delegated. This list is specific to the service to delegate to. Possible values include Microsoft.Network/networkinterfaces/*, Microsoft.Network/virtualNetworks/subnets/action, Microsoft.Network/virtualNetworks/subnets/join/action, Microsoft.Network/virtualNetworks/subnets/prepareNetworkPolicies/action and Microsoft.Network/virtualNetworks/subnets/unprepareNetworkPolicies/action.

    Import

    Subnets can be imported using the resource id, e.g.

     $ pulumi import azure:network/subnet:Subnet exampleSubnet /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Network/virtualNetworks/myvnet1/subnets/mysubnet1
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    Azure Classic pulumi/pulumi-azure
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the azurerm Terraform Provider.
    azure logo

    We recommend using Azure Native.

    Viewing docs for Azure v4.42.0 (Older version)
    published on Monday, Mar 9, 2026 by Pulumi

      Try Pulumi Cloud free.
      Your team will thank you.

      Start free trial