# withAppInsights

- Module: [Aspire.Hosting.Foundry](/reference/api/typescript/aspire.hosting.foundry.md)
- Version: `13.6.5-preview.1.26559.7`
- Kind: `method`
- Source: [GitHub](https://github.com/microsoft/aspire/tree/b33d222049f1ecc3bc7257ec07b622fe550b2580)

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

## Definition

```typescript
interface AzureCognitiveServicesProjectResource {
  // ... omitted for brevity
  withAppInsights(appInsights: AzureApplicationInsightsResource): AzureCognitiveServicesProjectResource
}
```

## Parameters

- `appInsights` (`AzureApplicationInsightsResource`)

## Returns

[AzureCognitiveServicesProjectResource](/reference/api/typescript/aspire.hosting.foundry/azurecognitiveservicesprojectresource.md) `builder`

## Applies to

- [AzureCognitiveServicesProjectResource](/reference/api/typescript/aspire.hosting.foundry/azurecognitiveservicesprojectresource.md)
