# AzureCosmosDBResource Properties

- Package: [Aspire.Hosting.Azure.CosmosDB](/reference/api/csharp/aspire.hosting.azure.cosmosdb.md)
- Type: [AzureCosmosDBResource](/reference/api/csharp/aspire.hosting.azure.cosmosdb/azurecosmosdbresource.md)
- Kind: `Properties`
- Members: `9`

A resource that represents an Azure Cosmos DB.

## AccountKey

- Name: `AccountKey`
- Modifiers: `nullable` `get`
- Returns: `ReferenceExpression?`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/cbc352350f1a9bafbaff10d14a2c8de4ac186a48/src/Aspire.Hosting.Azure.CosmosDB/AzureCosmosDBResource.cs#L117-L121)

Gets the account key expression for the Cosmos DB account.

```csharp
public ReferenceExpression? AccountKey { get; }
```

## Remarks

This is only available for emulator and access key authentication. For Entra ID authentication, this property will be null.

## ConnectionString

> **Obsolete:** BicepSecretOutputReference is no longer supported. Use ConnectionStringOutput instead.

- Name: `ConnectionString`
- Modifiers: `get`
- Returns: `BicepSecretOutputReference`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/cbc352350f1a9bafbaff10d14a2c8de4ac186a48/src/Aspire.Hosting.Azure.CosmosDB/AzureCosmosDBResource.cs#L35)

Gets the "connectionString" reference from the secret outputs of the Azure Cosmos DB resource.

```csharp
public BicepSecretOutputReference ConnectionString { get; }
```

## ConnectionStringExpression

- Name: `ConnectionStringExpression`
- Modifiers: `get`
- Returns: `ReferenceExpression`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/cbc352350f1a9bafbaff10d14a2c8de4ac186a48/src/Aspire.Hosting.Azure.CosmosDB/AzureCosmosDBResource.cs#L127-L131)

Gets the connection string template for the manifest for the Azure Cosmos DB resource.

```csharp
public ReferenceExpression ConnectionStringExpression { get; }
```

## ConnectionStringOutput

- Name: `ConnectionStringOutput`
- Modifiers: `get`
- Returns: `BicepOutputReference`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/cbc352350f1a9bafbaff10d14a2c8de4ac186a48/src/Aspire.Hosting.Azure.CosmosDB/AzureCosmosDBResource.cs#L45)

Gets the "connectionString" output reference from the bicep template for the Azure Cosmos DB resource. This is used when Entra ID authentication is used. The connection string is an output of the bicep template.

```csharp
public BicepOutputReference ConnectionStringOutput { get; }
```

## Remarks

The value is taken from the cosmos.properties.documentEndpoint bicep property and contains an endpoint.

## Id

- Name: `Id`
- Modifiers: `get`
- Returns: `BicepOutputReference`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/cbc352350f1a9bafbaff10d14a2c8de4ac186a48/src/Aspire.Hosting.Azure.CosmosDB/AzureCosmosDBResource.cs#L76)

Gets the "id" output reference for the resource.

```csharp
public BicepOutputReference Id { get; }
```

## IsEmulator

- Name: `IsEmulator`
- Modifiers: `get`
- Returns: `bool`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/cbc352350f1a9bafbaff10d14a2c8de4ac186a48/src/Aspire.Hosting.Azure.CosmosDB/AzureCosmosDBResource.cs#L88)

Gets a value indicating whether the Azure Cosmos DB resource is running in the local emulator.

```csharp
public bool IsEmulator { get; }
```

## NameOutputReference

- Name: `NameOutputReference`
- Modifiers: `get`
- Returns: `BicepOutputReference`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/cbc352350f1a9bafbaff10d14a2c8de4ac186a48/src/Aspire.Hosting.Azure.CosmosDB/AzureCosmosDBResource.cs#L71)

Gets the "name" output reference for the resource.

```csharp
public BicepOutputReference NameOutputReference { get; }
```

## UriExpression

- Name: `UriExpression`
- Modifiers: `get`
- Returns: `ReferenceExpression`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/cbc352350f1a9bafbaff10d14a2c8de4ac186a48/src/Aspire.Hosting.Azure.CosmosDB/AzureCosmosDBResource.cs#L106-L108)

Gets the account endpoint URI expression for the Cosmos DB account.

```csharp
public ReferenceExpression UriExpression { get; }
```

## Remarks

Format: `https://{name}.documents.azure.com:443/`.

## UseAccessKeyAuthentication

- Name: `UseAccessKeyAuthentication`
- Modifiers: `get`
- Returns: `bool`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/cbc352350f1a9bafbaff10d14a2c8de4ac186a48/src/Aspire.Hosting.Azure.CosmosDB/AzureCosmosDBResource.cs#L83)

Gets a value indicating whether the resource uses access key authentication.

```csharp
public bool UseAccessKeyAuthentication { get; }
```
