# RunAsFoundryLocal

- Module: [Aspire.Hosting.Foundry](/reference/api/go/aspire.hosting.foundry.md)
- Version: `17.0.0-preview.1.26565.2`
- Kind: `method`
- Defined on: [`FoundryResource`](/reference/api/go/aspire.hosting.foundry/foundryresource.md)
- Source: [GitHub](https://github.com/microsoft/aspire/tree/bcfa151cdca6d0a573f22d5d9c23f9c727cb3b2f)

Configures a Microsoft Foundry resource to use an Aspire-managed or existing Foundry Local service.

## Remarks

When `endpoint` is provided, Aspire connects to that existing
Foundry Local service without starting, stopping, downloading, or loading anything on its host.
Models configured on the resource must already be loaded by the existing service.

## Definition

```go
func (FoundryResource) RunAsFoundryLocal(options ...*RunAsFoundryLocalOptions) FoundryResource
```

## Parameters

- `options` (`...*RunAsFoundryLocalOptions`) -- optional settings, see [Options](#options)

## Options

Optional parameters are passed in a trailing `options ...*RunAsFoundryLocalOptions` argument.

- `Endpoint` (`*string`) -- The endpoint of an existing Foundry Local service, or `null` for an Aspire-managed service.

## Returns

[`FoundryResource`](/reference/api/go/aspire.hosting.foundry/foundryresource.md) -- The configured Microsoft Foundry resource builder.

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

## Applies to

- [`FoundryResource`](/reference/api/go/aspire.hosting.foundry/foundryresource.md)
