# AzureOpenAIResource

- Kind: `class`
- Package: [Aspire.Hosting.Azure.CognitiveServices](/reference/api/csharp/aspire.hosting.azure.cognitiveservices.md)
- Version: `13.4.0`
- Namespace: `Aspire.Hosting.ApplicationModel`
- Target framework: `net8.0`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/cbc352350f1a9bafbaff10d14a2c8de4ac186a48/src/Aspire.Hosting.Azure.CognitiveServices/AzureOpenAIResource.cs)
- Inherits: `AzureProvisioningResource`
- Implements: `IExpressionValue`, `IManifestExpressionProvider`, `IResource`, `IResourceWithConnectionString`, `IValueProvider`, `IValueWithReferences`, `IAzureNspAssociationTarget`, `IAzurePrivateEndpointTarget`

Represents an Azure OpenAI resource.

## Definition

```csharp
namespace Aspire.Hosting.ApplicationModel;

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

## ATS metadata

### ATS export

- Type ID: `Aspire.Hosting.Azure.CognitiveServices/AzureOpenAIResource`

## Constructors

- [AzureOpenAIResource(string, Action<AzureResourceInfrastructure>)](/reference/api/csharp/aspire.hosting.azure.cognitiveservices/azureopenairesource/constructors.md#constructor-string-action-azureresourceinfrastructure) -- Represents an Azure OpenAI resource.

## Properties

- [ConnectionString](/reference/api/csharp/aspire.hosting.azure.cognitiveservices/azureopenairesource/properties.md#connectionstring) : `BicepOutputReference` `get` -- Gets the "connectionString" output reference from the Azure OpenAI resource.
- [ConnectionStringExpression](/reference/api/csharp/aspire.hosting.azure.cognitiveservices/azureopenairesource/properties.md#connectionstringexpression) : `ReferenceExpression` `get` -- Gets the connection string template for the manifest for the resource.
- [Deployments](/reference/api/csharp/aspire.hosting.azure.cognitiveservices/azureopenairesource/properties.md#deployments) : [IReadOnlyList<AzureOpenAIDeployment>](/reference/api/csharp/aspire.hosting.azure.cognitiveservices/azureopenaideployment.md) `get` `obsolete` -- Gets the list of deployments of the Azure OpenAI resource.
- [Endpoint](/reference/api/csharp/aspire.hosting.azure.cognitiveservices/azureopenairesource/properties.md#endpoint) : `BicepOutputReference` `get` -- Gets the service endpoint URI expression for the Azure OpenAI resource.
- [Id](/reference/api/csharp/aspire.hosting.azure.cognitiveservices/azureopenairesource/properties.md#id) : `BicepOutputReference` `get` -- Gets the "id" output reference for the resource.
- [NameOutputReference](/reference/api/csharp/aspire.hosting.azure.cognitiveservices/azureopenairesource/properties.md#nameoutputreference) : `BicepOutputReference` `get` -- Gets the "name" output reference for the resource.
- [UriExpression](/reference/api/csharp/aspire.hosting.azure.cognitiveservices/azureopenairesource/properties.md#uriexpression) : `ReferenceExpression` `get` -- Gets the connection URI expression for the Azure OpenAI endpoint.

## Methods

- [AddAsExistingResource(AzureResourceInfrastructure)](/reference/api/csharp/aspire.hosting.azure.cognitiveservices/azureopenairesource/methods.md#addasexistingresource-azureresourceinfrastructure) : `ProvisionableResource`
