# FoundryResource

- Kind: `class`
- Package: [Aspire.Hosting.Foundry](/reference/api/csharp/aspire.hosting.foundry.md)
- Version: `13.4.0-preview.1.26281.18`
- Namespace: `Aspire.Hosting.Foundry`
- Target framework: `net8.0`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/becb48e2d61099e35ae336d527d3875e928d6594/src/Aspire.Hosting.Foundry/FoundryResource.cs)
- Inherits: `AzureProvisioningResource`
- Implements: `IExpressionValue`, `IManifestExpressionProvider`, `IResource`, `IResourceWithConnectionString`, `IResourceWithEndpoints`, `IValueProvider`, `IValueWithReferences`, `IAzureNspAssociationTarget`, `IAzurePrivateEndpointTarget`

Represents a Microsoft Foundry resource. This corresponds to the Azure Cognitive Services account with Microsoft Foundry capabilities enabled.

## Definition

```csharp
namespace Aspire.Hosting.Foundry;

public class FoundryResource
    : Aspire.Hosting.Azure.AzureProvisioningResource,
      Aspire.Hosting.ApplicationModel.IExpressionValue,
      Aspire.Hosting.ApplicationModel.IManifestExpressionProvider,
      Aspire.Hosting.ApplicationModel.IResource,
      Aspire.Hosting.ApplicationModel.IResourceWithConnectionString,
      Aspire.Hosting.ApplicationModel.IResourceWithEndpoints,
      Aspire.Hosting.ApplicationModel.IValueProvider,
      Aspire.Hosting.ApplicationModel.IValueWithReferences,
      Aspire.Hosting.Azure.IAzureNspAssociationTarget,
      Aspire.Hosting.Azure.IAzurePrivateEndpointTarget
{
    // ...
}
```

## ATS metadata

### ATS export

- Type ID: `Aspire.Hosting.Foundry/FoundryResource`

## Constructors

- [FoundryResource(string, Action<AzureResourceInfrastructure>)](/reference/api/csharp/aspire.hosting.foundry/foundryresource/constructors.md#constructor-string-action-azureresourceinfrastructure) -- Represents a Microsoft Foundry resource. This corresponds to the Azure Cognitive Services account with Microsoft Foundry capabilities enabled.

## Properties

- [AIFoundryApiEndpoint](/reference/api/csharp/aspire.hosting.foundry/foundryresource/properties.md#aifoundryapiendpoint) : `BicepOutputReference` `get` -- Gets the "aiFoundryApiEndpoint" output reference from the Microsoft Foundry resource.
- [ApiKey](/reference/api/csharp/aspire.hosting.foundry/foundryresource/properties.md#apikey) : `string?` `get` -- The API key to access Foundry Local.
- [CapabilityHost](/reference/api/csharp/aspire.hosting.foundry/foundryresource/properties.md#capabilityhost) : `CognitiveServicesCapabilityHost?` `get; set` -- The capability host associated with this project, if any. If none is set, we provision a default capability host for hosted agents.
- [ConnectionStringExpression](/reference/api/csharp/aspire.hosting.foundry/foundryresource/properties.md#connectionstringexpression) : `ReferenceExpression` `get` -- Gets the connection string template for the manifest for the resource.
- [Deployments](/reference/api/csharp/aspire.hosting.foundry/foundryresource/properties.md#deployments) : [IReadOnlyList<FoundryDeploymentResource>](/reference/api/csharp/aspire.hosting.foundry/foundrydeploymentresource.md) `get` -- Gets the list of deployment resources associated with the Microsoft Foundry.
- [Endpoint](/reference/api/csharp/aspire.hosting.foundry/foundryresource/properties.md#endpoint) : `BicepOutputReference` `get` -- Gets the "endpoint" output reference from the Microsoft Foundry resource.
- [Id](/reference/api/csharp/aspire.hosting.foundry/foundryresource/properties.md#id) : `BicepOutputReference` `get` -- Gets the "id" output reference for the resource.
- [IsEmulator](/reference/api/csharp/aspire.hosting.foundry/foundryresource/properties.md#isemulator) : `bool` `get` -- Gets whether the resource is running in Foundry Local.
- [NameOutputReference](/reference/api/csharp/aspire.hosting.foundry/foundryresource/properties.md#nameoutputreference) : `BicepOutputReference` `get` -- Gets the "name" output reference for the resource.
- [UriExpression](/reference/api/csharp/aspire.hosting.foundry/foundryresource/properties.md#uriexpression) : `ReferenceExpression` `get` -- Gets the connection URI expression for the Microsoft Foundry endpoint.

## Methods

- [AddAsExistingResource(AzureResourceInfrastructure)](/reference/api/csharp/aspire.hosting.foundry/foundryresource/methods.md#addasexistingresource-azureresourceinfrastructure) : `CognitiveServicesAccount` `virtual`
