# AzureVirtualNetworkResource

- 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/AzureVirtualNetworkResource.cs)
- Inherits: `AzureProvisioningResource`

Represents an Azure Virtual Network resource.

## Definition

```csharp
namespace Aspire.Hosting.Azure;

public class AzureVirtualNetworkResource
    : Aspire.Hosting.Azure.AzureProvisioningResource
{
    // ...
}
```

## ATS metadata

### ATS export

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

## Constructors

- [AzureVirtualNetworkResource(string, Action<AzureResourceInfrastructure>)](/reference/api/csharp/aspire.hosting.azure.network/azurevirtualnetworkresource/constructors.md#constructor-string-action-azureresourceinfrastructure) -- Represents an Azure Virtual Network resource.
- [AzureVirtualNetworkResource(string, Action<AzureResourceInfrastructure>, string?)](/reference/api/csharp/aspire.hosting.azure.network/azurevirtualnetworkresource/constructors.md#constructor-string-action-azureresourceinfrastructure-string) -- Initializes a new instance of the [AzureVirtualNetworkResource](/reference/api/csharp/aspire.hosting.azure.network/azurevirtualnetworkresource.md) class with a string address prefix.
- [AzureVirtualNetworkResource(string, Action<AzureResourceInfrastructure>, ParameterResource)](/reference/api/csharp/aspire.hosting.azure.network/azurevirtualnetworkresource/constructors.md#constructor-string-action-azureresourceinfrastructure-parameterresource) -- Initializes a new instance of the [AzureVirtualNetworkResource](/reference/api/csharp/aspire.hosting.azure.network/azurevirtualnetworkresource.md) class with a parameterized address prefix.

## Properties

- [AddressPrefix](/reference/api/csharp/aspire.hosting.azure.network/azurevirtualnetworkresource/properties.md#addressprefix) : `string?` `get` -- Gets the address prefix for the virtual network (e.g., "10.0.0.0/16"), or `null` if the address prefix is provided via a `ApplicationModel.ParameterResource`.
- [AddressPrefixParameter](/reference/api/csharp/aspire.hosting.azure.network/azurevirtualnetworkresource/properties.md#addressprefixparameter) : `ParameterResource?` `get` -- Gets the parameter resource containing the address prefix for the virtual network, or `null` if the address prefix is provided as a literal string.
- [Id](/reference/api/csharp/aspire.hosting.azure.network/azurevirtualnetworkresource/properties.md#id) : `BicepOutputReference` `get` -- Gets the "id" output reference from the Azure Virtual Network resource.
- [NameOutputReference](/reference/api/csharp/aspire.hosting.azure.network/azurevirtualnetworkresource/properties.md#nameoutputreference) : `BicepOutputReference` `get` -- Gets the "name" output reference for the resource.

## Methods

- [AddAsExistingResource(AzureResourceInfrastructure)](/reference/api/csharp/aspire.hosting.azure.network/azurevirtualnetworkresource/methods.md#addasexistingresource-azureresourceinfrastructure) : `ProvisionableResource`
