# WithVirtualNetworkIntegration

- Module: [Aspire.Hosting.Azure.ApiManagement](/reference/api/go/aspire.hosting.azure.apimanagement.md)
- Version: `17.0.0-preview.1.26567.5`
- Kind: `method`
- Defined on: [`AzureApiManagementResource`](/reference/api/go/aspire.hosting.azure.apimanagement/azureapimanagementresource.md)
- Source: [GitHub](https://github.com/microsoft/aspire/tree/2d325b13709752ba6d9a943635c5e2940a2530c0)

Integrates a Standard v2 or Premium v2 API Management service with a virtual network for outbound access.

## Remarks

The subnet is delegated to `Microsoft.Web/serverFarms`. The APIM gateway remains publicly accessible,
while backend traffic can reach resources in the virtual network.
See APIM outbound virtual network integration.

## Definition

```go
func (AzureApiManagementResource) WithVirtualNetworkIntegration(subnet AzureSubnetResource) AzureApiManagementResource
```

## Parameters

- `subnet` ([`AzureSubnetResource`](/reference/api/go/aspire.hosting.azure.apimanagement/azuresubnetresource.md)) -- A dedicated subnet for API Management virtual network integration.

## Returns

[`AzureApiManagementResource`](/reference/api/go/aspire.hosting.azure.apimanagement/azureapimanagementresource.md) -- The resource builder.

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

## Applies to

- [`AzureApiManagementResource`](/reference/api/go/aspire.hosting.azure.apimanagement/azureapimanagementresource.md)
