# AzureSubnetResource

- Module: [Aspire.Hosting.Azure.Network](/reference/api/go/aspire.hosting.azure.network.md)
- Version: `17.0.0`
- Kind: `handle`
- Source: [GitHub](https://github.com/microsoft/aspire/tree/2d325b13709752ba6d9a943635c5e2940a2530c0)

Represents an Azure Subnet resource.

## Definition

```go
type AzureSubnetResource interface {
    Resource
    ResourceWithParent
}
```

## Embeds

- `Resource`
- `ResourceWithParent`

## Methods

- [AddPrivateEndpoint](/reference/api/go/aspire.hosting.azure.network/azuresubnetresource/addprivateendpoint.md) -- `method` -- Adds an Azure Private Endpoint resource to the subnet.
  ```go
  AddPrivateEndpoint(target AzurePrivateEndpointTarget) AzurePrivateEndpointResource
  ```
- [AllowInbound](/reference/api/go/aspire.hosting.azure.network/azuresubnetresource/allowinbound.md) -- `method` -- Adds an inbound allow rule to the subnet's Network Security Group.
  ```go
  AllowInbound(options ...*AllowInboundOptions) AzureSubnetResource
  ```
- [AllowOutbound](/reference/api/go/aspire.hosting.azure.network/azuresubnetresource/allowoutbound.md) -- `method` -- Adds an outbound allow rule to the subnet's Network Security Group.
  ```go
  AllowOutbound(options ...*AllowOutboundOptions) AzureSubnetResource
  ```
- [DenyInbound](/reference/api/go/aspire.hosting.azure.network/azuresubnetresource/denyinbound.md) -- `method` -- Adds an inbound deny rule to the subnet's Network Security Group.
  ```go
  DenyInbound(options ...*DenyInboundOptions) AzureSubnetResource
  ```
- [DenyOutbound](/reference/api/go/aspire.hosting.azure.network/azuresubnetresource/denyoutbound.md) -- `method` -- Adds an outbound deny rule to the subnet's Network Security Group.
  ```go
  DenyOutbound(options ...*DenyOutboundOptions) AzureSubnetResource
  ```
- [WithNatGateway](/reference/api/go/aspire.hosting.azure.network/azuresubnetresource/withnatgateway.md) -- `method` -- Associates a NAT Gateway with the subnet.
  ```go
  WithNatGateway(natGateway AzureNatGatewayResource) AzureSubnetResource
  ```
- [WithNetworkSecurityGroup](/reference/api/go/aspire.hosting.azure.network/azuresubnetresource/withnetworksecuritygroup.md) -- `method` -- Associates a Network Security Group with the subnet.
  ```go
  WithNetworkSecurityGroup(nsg AzureNetworkSecurityGroupResource) AzureSubnetResource
  ```
- [WithServiceDelegation](/reference/api/go/aspire.hosting.azure.network/azuresubnetresource/withservicedelegation.md) -- `method` -- Delegates the subnet to the specified Azure service.
  ```go
  WithServiceDelegation(serviceName string, options ...*WithServiceDelegationOptions) AzureSubnetResource
  ```
