Aspirerelease/17.0
Watch Aspire live streamsDocsTry Aspire

AzureSubnetResource

Handle
📦 Aspire.Hosting.Azure.Network v17.0.0

Represents an Azure Subnet resource.

type AzureSubnetResource interface {
Resource
ResourceWithParent
}

Methods

methodAddPrivateEndpointbuilder
Adds an Azure Private Endpoint resource to the subnet.
AddPrivateEndpoint(target AzurePrivateEndpointTarget) AzurePrivateEndpointResource
targetAzurePrivateEndpointTargetThe target Azure resource to connect via private link.
AzurePrivateEndpointResource

The resource builder.

Returns a handle; failures surface later via Err().

methodAllowInboundbuilder
Adds an inbound allow rule to the subnet's Network Security Group.
AllowInbound(options ...*AllowInboundOptions) AzureSubnetResource
options...*AllowInboundOptionsOptional settings, described under Options.

Optional parameters are passed in a trailing options ...*AllowInboundOptions argument.

Port*stringThe destination port range (e.g., "443", "80-443"). Defaults to "*" (any).
From*stringThe source address prefix (e.g., "AzureLoadBalancer", "Internet", "10.0.0.0/8"). Defaults to "*" (any).
To*stringThe destination address prefix. Defaults to "*" (any).
Protocol*SecurityRuleProtocolThe network protocol. Defaults to Asterisk (any).
Priority*float64The rule priority (100-4096). If not specified, auto-increments from 100 by 100.
Name*stringThe rule name. If not specified, auto-generated from parameters.
AzureSubnetResource

The resource builder.

Returns a handle; failures surface later via Err().

methodAllowOutboundbuilder
Adds an outbound allow rule to the subnet's Network Security Group.
AllowOutbound(options ...*AllowOutboundOptions) AzureSubnetResource
options...*AllowOutboundOptionsOptional settings, described under Options.

Optional parameters are passed in a trailing options ...*AllowOutboundOptions argument.

Port*stringThe destination port range (e.g., "443", "80-443"). Defaults to "*" (any).
From*stringThe source address prefix. Defaults to "*" (any).
To*stringThe destination address prefix (e.g., "Internet", "VirtualNetwork"). Defaults to "*" (any).
Protocol*SecurityRuleProtocolThe network protocol. Defaults to Asterisk (any).
Priority*float64The rule priority (100-4096). If not specified, auto-increments from 100 by 100.
Name*stringThe rule name. If not specified, auto-generated from parameters.
AzureSubnetResource

The resource builder.

Returns a handle; failures surface later via Err().

methodDenyInboundbuilder
Adds an inbound deny rule to the subnet's Network Security Group.
DenyInbound(options ...*DenyInboundOptions) AzureSubnetResource
options...*DenyInboundOptionsOptional settings, described under Options.

Optional parameters are passed in a trailing options ...*DenyInboundOptions argument.

Port*stringThe destination port range (e.g., "443", "80-443"). Defaults to "*" (any).
From*stringThe source address prefix (e.g., "Internet", "VirtualNetwork", "10.0.0.0/8"). Defaults to "*" (any).
To*stringThe destination address prefix. Defaults to "*" (any).
Protocol*SecurityRuleProtocolThe network protocol. Defaults to Asterisk (any).
Priority*float64The rule priority (100-4096). If not specified, auto-increments from 100 by 100.
Name*stringThe rule name. If not specified, auto-generated from parameters.
AzureSubnetResource

The resource builder.

Returns a handle; failures surface later via Err().

methodDenyOutboundbuilder
Adds an outbound deny rule to the subnet's Network Security Group.
DenyOutbound(options ...*DenyOutboundOptions) AzureSubnetResource
options...*DenyOutboundOptionsOptional settings, described under Options.

Optional parameters are passed in a trailing options ...*DenyOutboundOptions argument.

Port*stringThe destination port range (e.g., "443", "80-443"). Defaults to "*" (any).
From*stringThe source address prefix. Defaults to "*" (any).
To*stringThe destination address prefix (e.g., "Internet", "VirtualNetwork"). Defaults to "*" (any).
Protocol*SecurityRuleProtocolThe network protocol. Defaults to Asterisk (any).
Priority*float64The rule priority (100-4096). If not specified, auto-increments from 100 by 100.
Name*stringThe rule name. If not specified, auto-generated from parameters.
AzureSubnetResource

The resource builder.

Returns a handle; failures surface later via Err().

methodWithNatGatewaybuilder
Associates a NAT Gateway with the subnet.
WithNatGateway(natGateway AzureNatGatewayResource) AzureSubnetResource
natGatewayAzureNatGatewayResourceThe NAT Gateway to associate with the subnet.
AzureSubnetResource

The resource builder.

Returns a handle; failures surface later via Err().

Associates a Network Security Group with the subnet.
WithNetworkSecurityGroup(nsg AzureNetworkSecurityGroupResource) AzureSubnetResource
nsgAzureNetworkSecurityGroupResourceThe Network Security Group to associate with the subnet.
AzureSubnetResource

The resource builder.

Returns a handle; failures surface later via Err().

Delegates the subnet to the specified Azure service.
WithServiceDelegation(
serviceName string,
options ...*WithServiceDelegationOptions,
) AzureSubnetResource
serviceNamestringThe service name to delegate the subnet to (e.g., "Microsoft.App/environments"). See AzureSubnetServiceDelegations for well-known values.
options...*WithServiceDelegationOptionsOptional settings, described under Options.

Optional parameters are passed in a trailing options ...*WithServiceDelegationOptions argument.

Name*stringThe name of the service delegation. If not specified, defaults to serviceName.
AzureSubnetResource

The resource builder.

Returns a handle; failures surface later via Err().