# SqlServerServerResource

- Module: [Aspire.Hosting.SqlServer](/reference/api/typescript/aspire.hosting.sqlserver.md)
- Version: `13.4.0`
- Kind: `handle`
- Source: [GitHub](https://github.com/microsoft/aspire)

A resource that represents a SQL Server container.

## Definition

```typescript
interface SqlServerServerResource
  extends IComputeResource,
    IExpressionValue,
    IManifestExpressionProvider,
    IResource,
    IResourceWithArgs,
    IResourceWithConnectionString,
    IResourceWithEndpoints,
    IResourceWithEnvironment,
    IResourceWithProbes,
    IResourceWithWaitSupport,
    IValueProvider,
    IValueWithReferences {
  readonly connectionStringExpression: ReferenceExpression;
  readonly databases: Dict<string,string>;
  readonly host: EndpointReferenceExpression;
  readonly jdbcConnectionString: ReferenceExpression;
  passwordParameter: ParameterResource;
  readonly port: EndpointReferenceExpression;
  readonly primaryEndpoint: EndpointReference;
  readonly uriExpression: ReferenceExpression;
  readonly userNameReference: ReferenceExpression;
  addDatabase(
      name: string,
      databaseName?: string): SqlServerDatabaseResource;
  withDataBindMount(
      source: string,
      isReadOnly?: boolean): SqlServerServerResource;
  withDataVolume(
      name?: string,
      isReadOnly?: boolean): SqlServerServerResource;
  withHostPort(port: number): SqlServerServerResource;
  withPassword(password: ParameterResource): SqlServerServerResource;
}
```

## Properties

- `connectionStringExpression`: `ReferenceExpression` `get` -- Gets the connection string expression for the SQL Server.
- `databases`: `Dict<string,string>` `get` -- A dictionary where the key is the resource name and the value is the database name.
- `host`: `EndpointReferenceExpression` `get` -- Gets the host endpoint reference for this resource.
- `jdbcConnectionString`: `ReferenceExpression` `get` -- Gets the JDBC connection string for the SQL Server.
- `passwordParameter`: `ParameterResource` `get - set` -- Gets the parameter that contains the SQL Server password.
- `port`: `EndpointReferenceExpression` `get` -- Gets the port endpoint reference for this resource.
- `primaryEndpoint`: `EndpointReference` `get` -- Gets the primary endpoint for the SQL Server.
- `uriExpression`: `ReferenceExpression` `get` -- Gets the connection URI expression for the SQL Server.
- `userNameReference`: `ReferenceExpression` `get` -- Gets a reference to the user name for the SQL Server.

## Methods

- [addDatabase](/reference/api/typescript/aspire.hosting.sqlserver/sqlserverserverresource/adddatabase.md) -- `method` -- Adds a SQL Server database resource
    ```typescript
  addDatabase(name: string, databaseName?: string): SqlServerDatabaseResource
  ```
- [withDataBindMount](/reference/api/typescript/aspire.hosting.sqlserver/sqlserverserverresource/withdatabindmount.md) -- `method` -- Adds a bind mount for the data folder to a SQL Server resource.
    ```typescript
  withDataBindMount(source: string, isReadOnly?: boolean): SqlServerServerResource
  ```
- [withDataVolume](/reference/api/typescript/aspire.hosting.sqlserver/sqlserverserverresource/withdatavolume.md) -- `method` -- Adds a named volume for the data folder to a SQL Server resource.
    ```typescript
  withDataVolume(name?: string, isReadOnly?: boolean): SqlServerServerResource
  ```
- [withHostPort](/reference/api/typescript/aspire.hosting.sqlserver/sqlserverserverresource/withhostport.md) -- `method` -- Configures the host port that the SqlServer resource is exposed on instead of using randomly assigned port.
    ```typescript
  withHostPort(port: number): SqlServerServerResource
  ```
- [withPassword](/reference/api/typescript/aspire.hosting.sqlserver/sqlserverserverresource/withpassword.md) -- `method` -- Configures the password that the SqlServer resource is used.
    ```typescript
  withPassword(password: ParameterResource): SqlServerServerResource
  ```
