# DevTunnelResource.WithTunnelReferenceAnonymous

- Module: [Aspire.Hosting.DevTunnels](/reference/api/go/aspire.hosting.devtunnels.md)
- Defined on: [DevTunnelResource](/reference/api/go/aspire.hosting.devtunnels/devtunnelresource.md)
- Version: `17.0.0`
- Kind: `method`

Exposes the specified endpoint via the dev tunnel and sets whether anonymous access is allowed.

## Definition

```go
type DevTunnelResource interface {
    // ... omitted for brevity
    WithTunnelReferenceAnonymous(
        targetEndpoint EndpointReference,
        allowAnonymous bool,
    ) DevTunnelResource
}
```

## Signature

```go
WithTunnelReferenceAnonymous(
    targetEndpoint EndpointReference,
    allowAnonymous bool,
) DevTunnelResource
```

## Parameters

- `targetEndpoint` (`EndpointReference`) -- The endpoint to expose via the dev tunnel.
- `allowAnonymous` (`bool`) -- Whether anonymous access is allowed.

## Returns

[`DevTunnelResource`](/reference/api/go/aspire.hosting.devtunnels/devtunnelresource.md) -- The resource builder.

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

## Defined on

- [DevTunnelResource](/reference/api/go/aspire.hosting.devtunnels/devtunnelresource.md) -- `handle`
