# AzureCognitiveServicesProjectResource.WithAppInsights

- Module: [Aspire.Hosting.Foundry](/reference/api/go/aspire.hosting.foundry.md)
- Defined on: [AzureCognitiveServicesProjectResource](/reference/api/go/aspire.hosting.foundry/azurecognitiveservicesprojectresource.md)
- Version: `17.0.0-preview.1.26567.5`
- Kind: `method`

Adds an Application Insights resource to the Microsoft Foundry project, overriding the default (which is to create a new Application Insights resource).

## Definition

```go
type AzureCognitiveServicesProjectResource interface {
    // ... omitted for brevity
    WithAppInsights(appInsights AzureApplicationInsightsResource) AzureCognitiveServicesProjectResource
}
```

## Signature

```go
WithAppInsights(appInsights AzureApplicationInsightsResource) AzureCognitiveServicesProjectResource
```

## Parameters

- `appInsights` ([`AzureApplicationInsightsResource`](/reference/api/go/aspire.hosting.foundry/azureapplicationinsightsresource.md)) -- The Application Insights resource to associate with the project.

## Returns

[`AzureCognitiveServicesProjectResource`](/reference/api/go/aspire.hosting.foundry/azurecognitiveservicesprojectresource.md) -- The resource builder.

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

## Defined on

- [AzureCognitiveServicesProjectResource](/reference/api/go/aspire.hosting.foundry/azurecognitiveservicesprojectresource.md) -- `handle`
