# WithTunnelReferenceAnonymous

- Module: [Aspire.Hosting.DevTunnels](/reference/api/go/aspire.hosting.devtunnels.md)
- Version: `17.0.0`
- Kind: `method`
- Defined on: [`DevTunnelResource`](/reference/api/go/aspire.hosting.devtunnels/devtunnelresource.md)
- Source: [GitHub](https://github.com/microsoft/aspire/tree/2d325b13709752ba6d9a943635c5e2940a2530c0)

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

## Definition

```go
func (DevTunnelResource) 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()`.

## Applies to

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