# AzureSubnetResource

- Kind: `class`
- Package: [Aspire.Hosting.Azure.Network](/reference/api/csharp/aspire.hosting.azure.network.md)
- Version: `13.4.0`
- Namespace: `Aspire.Hosting.Azure`
- Target framework: `net8.0`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/cbc352350f1a9bafbaff10d14a2c8de4ac186a48/src/Aspire.Hosting.Azure.Network/AzureSubnetResource.cs)
- Inherits: `Resource`
- Implements: `IResource`, `IResourceWithParent`, `IResourceWithParent<AzureVirtualNetworkResource>`

Represents an Azure Subnet resource.

## Definition

```csharp
namespace Aspire.Hosting.Azure;

public class AzureSubnetResource
    : Aspire.Hosting.ApplicationModel.Resource,
      Aspire.Hosting.ApplicationModel.IResource,
      Aspire.Hosting.ApplicationModel.IResourceWithParent,
      Aspire.Hosting.ApplicationModel.IResourceWithParent<Aspire.Hosting.Azure.AzureVirtualNetworkResource>
{
    // ...
}
```

## ATS metadata

### ATS export

- Type ID: `Aspire.Hosting.Azure.Network/AzureSubnetResource`

## Remarks

Use `AzureProvisioningResourceExtensions.ConfigureInfrastructure` to configure specific `Azure.Provisioning` properties.

## Constructors

- [AzureSubnetResource(string, string, string, AzureVirtualNetworkResource)](/reference/api/csharp/aspire.hosting.azure.network/azuresubnetresource/constructors.md#constructor-string-string-string-azurevirtualnetworkresource) -- Initializes a new instance of the [AzureSubnetResource](/reference/api/csharp/aspire.hosting.azure.network/azuresubnetresource.md) class.
- [AzureSubnetResource(string, string, ParameterResource, AzureVirtualNetworkResource)](/reference/api/csharp/aspire.hosting.azure.network/azuresubnetresource/constructors.md#constructor-string-string-parameterresource-azurevirtualnetworkresource) -- Initializes a new instance of the [AzureSubnetResource](/reference/api/csharp/aspire.hosting.azure.network/azuresubnetresource.md) class with a parameterized address prefix.

## Properties

- [AddressPrefix](/reference/api/csharp/aspire.hosting.azure.network/azuresubnetresource/properties.md#addressprefix) : `string?` `get` -- Gets the address prefix for the subnet (e.g., "10.0.1.0/24"), or `null` if the address prefix is provided via a `ApplicationModel.ParameterResource`.
- [AddressPrefixParameter](/reference/api/csharp/aspire.hosting.azure.network/azuresubnetresource/properties.md#addressprefixparameter) : `ParameterResource?` `get` -- Gets the parameter resource containing the address prefix for the subnet, or `null` if the address prefix is provided as a literal string.
- [Id](/reference/api/csharp/aspire.hosting.azure.network/azuresubnetresource/properties.md#id) : `BicepOutputReference` `get` -- Gets the subnet Id output reference.
- [Parent](/reference/api/csharp/aspire.hosting.azure.network/azuresubnetresource/properties.md#parent) : [AzureVirtualNetworkResource](/reference/api/csharp/aspire.hosting.azure.network/azurevirtualnetworkresource.md) `get` -- Gets the parent Azure Virtual Network resource.
- [SubnetName](/reference/api/csharp/aspire.hosting.azure.network/azuresubnetresource/properties.md#subnetname) : `string` `get` -- Gets the subnet name.
