# GetConnectionProperty

- Module: [Aspire.Hosting](/reference/api/go/aspire.hosting.md)
- Version: `17.0.0`
- Kind: `method`
- Defined on: [`ResourceWithConnectionString`](/reference/api/go/aspire.hosting/resourcewithconnectionstring.md)
- Source: [GitHub](https://github.com/microsoft/aspire/tree/bcfa151cdca6d0a573f22d5d9c23f9c727cb3b2f)

Retrieves the value of a specified connection property from the resource's connection properties.

## Remarks

Throws a KeyNotFoundException if the specified key does not exist in the resource's
connection properties.

## Definition

```go
func (ResourceWithConnectionString) GetConnectionProperty(key string) *ReferenceExpression
```

## Parameters

- `key` (`string`) -- The key of the connection property to retrieve. Cannot be null.

## Returns

`*ReferenceExpression` -- The value associated with the specified connection property key.

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

## Applies to

- [`ResourceWithConnectionString`](/reference/api/go/aspire.hosting/resourcewithconnectionstring.md)
