# WithCosmos

- Module: [CommunityToolkit.Aspire.Hosting.Floci](/reference/api/go/communitytoolkit.aspire.hosting.floci.md)
- Version: `13.6.1`
- Kind: `method`
- Defined on: [`FlociAzureContainerResource`](/reference/api/go/communitytoolkit.aspire.hosting.floci/flociazurecontainerresource.md)
- Source: [GitHub](https://github.com/CommunityToolkit/Aspire/tree/d9c2addac6f527ef2e33712d290b84574b455a3b)

Adds a Cosmos DB child resource to the Floci Azure emulator

## Remarks

Reference the returned resource with Aspire's standard `WithReference` API to inject its
Cosmos DB connection string. floci-az serves the Cosmos SQL/NoSQL API from the parent
resource's endpoint under the `{account}-cosmos` path.

## Definition

```go
func (FlociAzureContainerResource) WithCosmos(options ...*WithCosmosOptions) FlociAzureCosmosResource
```

## Parameters

- `options` (`...*WithCosmosOptions`) -- optional settings, see [Options](#options)

## Options

Optional parameters are passed in a trailing `options ...*WithCosmosOptions` argument.

- `Name` (`*string`) -- The name of the Cosmos DB resource (default: `cosmos`).
- `AccountName` (`*string`) -- The Cosmos account name segment (default: `devstoreaccount1`).

## Returns

[`FlociAzureCosmosResource`](/reference/api/go/communitytoolkit.aspire.hosting.floci/flociazurecosmosresource.md) -- A reference to the `IResourceBuilder` for further configuration.

Returns a handle; failures surface later via `Err()`.

## Applies to

- [`FlociAzureContainerResource`](/reference/api/go/communitytoolkit.aspire.hosting.floci/flociazurecontainerresource.md)
