# AzureNatGatewayResource.WithPublicIPAddress

- Module: [Aspire.Hosting.Azure.Network](/reference/api/go/aspire.hosting.azure.network.md)
- Defined on: [AzureNatGatewayResource](/reference/api/go/aspire.hosting.azure.network/azurenatgatewayresource.md)
- Version: `17.0.0`
- Kind: `method`

Associates an explicit Public IP Address resource with the NAT Gateway.

## Remarks

When an explicit Public IP Address is provided, the NAT Gateway will not auto-create one.

## Definition

```go
type AzureNatGatewayResource interface {
    // ... omitted for brevity
    WithPublicIPAddress(publicIPAddress AzurePublicIPAddressResource) AzureNatGatewayResource
}
```

## Signature

```go
WithPublicIPAddress(publicIPAddress AzurePublicIPAddressResource) AzureNatGatewayResource
```

## Parameters

- `publicIPAddress` ([`AzurePublicIPAddressResource`](/reference/api/go/aspire.hosting.azure.network/azurepublicipaddressresource.md)) -- The Public IP Address resource to associate.

## Returns

[`AzureNatGatewayResource`](/reference/api/go/aspire.hosting.azure.network/azurenatgatewayresource.md) -- The resource builder.

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

## Defined on

- [AzureNatGatewayResource](/reference/api/go/aspire.hosting.azure.network/azurenatgatewayresource.md) -- `handle`
