# AzureCognitiveServicesProjectResource Methods

- Package: [Aspire.Hosting.Foundry](/reference/api/csharp/aspire.hosting.foundry.md)
- Type: [AzureCognitiveServicesProjectResource](/reference/api/csharp/aspire.hosting.foundry/azurecognitiveservicesprojectresource.md)
- Kind: `Methods`
- Members: `3`

The Microsoft Foundry project resource that can be used for Microsoft Foundry AI agents. This also functions as an Aspire compute environment resource for deployment.

## FromExisting(string)

- Name: `FromExisting(string)`
- Modifiers: `override`
- Returns: `CognitiveServicesProject`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/becb48e2d61099e35ae336d527d3875e928d6594/src/Aspire.Hosting.Foundry/Project/ProjectResource.cs#L103)

Gets the Azure.Provisioning resource from an existing Bicep identifier. Because static methods can't be abstract, this is an instance method.

```csharp
public class AzureCognitiveServicesProjectResource
{
    public override CognitiveServicesProject FromExisting(
        string bicepIdentifier)
    {
        // ...
    }
}
```

## Parameters

- `bicepIdentifier` (`string`)

## SetName(CognitiveServicesProject, BicepValue<string>)

- Name: `SetName(CognitiveServicesProject, BicepValue<string>)`
- Modifiers: `override`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/becb48e2d61099e35ae336d527d3875e928d6594/src/Aspire.Hosting.Foundry/Project/ProjectResource.cs#L97-L98)

Sets the name of the provisionable resource. This is needed because not all ProvisionableResource classes have a name property with a setter, and we can't put a type bound on T to require it.

```csharp
public class AzureCognitiveServicesProjectResource
{
    public override void SetName(
        CognitiveServicesProject provisionableResource,
        BicepValue<string> name)
    {
        // ...
    }
}
```

## Parameters

- `provisionableResource` (`CognitiveServicesProject`)
- `name` (`BicepValue<string>`)

## TryGetAppIdentityResource(IAppIdentityResource?)

- Name: `TryGetAppIdentityResource(IAppIdentityResource?)`
- Returns: `bool`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/becb48e2d61099e35ae336d527d3875e928d6594/src/Aspire.Hosting.Foundry/Project/ProjectResource.cs#L278-L286)

Tries to get the application identity resource associated with this project via the `Azure.AppIdentityAnnotation`. This is the identity that will be used by the project to access other Azure resources such as the container registry.

```csharp
public class AzureCognitiveServicesProjectResource
{
    public bool TryGetAppIdentityResource(
        out IAppIdentityResource? identity)
    {
        // ...
    }
}
```

## Parameters

- `identity` (`IAppIdentityResource?`)
