# AzureSqlServerResource

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

Represents an Azure Sql Server resource.

## Definition

```typescript
interface AzureSqlServerResource
  extends IAzureResource,
    IExpressionValue,
    IManifestExpressionProvider,
    IResource,
    IResourceWithConnectionString,
    IResourceWithParameters,
    IValueProvider,
    IValueWithReferences,
    IAzureNspAssociationTarget,
    IAzurePrivateEndpointTarget,
    IAzurePrivateEndpointTargetNotification {
  readonly azureSqlDatabases: Dict<string,Aspire.Hosting.Azure.Sql/Aspire.Hosting.Azure.AzureSqlDatabaseResource>;
  readonly connectionStringExpression: ReferenceExpression;
  readonly databases: Dict<string,string>;
  readonly fullyQualifiedDomainName: BicepOutputReference;
  readonly hostName: ReferenceExpression;
  readonly id: BicepOutputReference;
  readonly isContainer: boolean;
  readonly jdbcConnectionString: ReferenceExpression;
  readonly nameOutputReference: BicepOutputReference;
  readonly port: ReferenceExpression;
  readonly uriExpression: ReferenceExpression;
  addDatabase(
      name: string,
      databaseName?: string): AzureSqlDatabaseResource;
  runAsContainer(configureContainer?: (obj: SqlServerServerResource) => Promise<void>): AzureSqlServerResource;
  withAdminDeploymentScriptStorage(storage: AzureStorageResource): AzureSqlServerResource;
  withAdminDeploymentScriptSubnet(subnet: AzureSubnetResource): AzureSqlServerResource;
}
```

## Properties

- `azureSqlDatabases`: `AzureSqlDatabaseResource>` `get` -- A dictionary where the key is the resource name and the value is the Azure SQL database resource.
- `connectionStringExpression`: `ReferenceExpression` `get` -- Gets the connection template for the manifest for the Azure SQL Server resource.
- `databases`: `Dict<string,string>` `get` -- A dictionary where the key is the resource name and the value is the Azure SQL database name.
- `fullyQualifiedDomainName`: `BicepOutputReference` `get` -- Gets the fully qualified domain name (FQDN) output reference from the bicep template for the Azure SQL Server resource.
- `hostName`: `ReferenceExpression` `get` -- Gets the host name for the SQL Server.
- `id`: `BicepOutputReference` `get` -- Gets the "id" output reference for the resource.
- `isContainer`: `boolean` `get` -- Gets a value indicating whether the current resource represents a container. If so the actual resource is not running in Azure.
- `jdbcConnectionString`: `ReferenceExpression` `get` -- Gets the JDBC connection string for the server.
- `nameOutputReference`: `BicepOutputReference` `get` -- Gets the "name" output reference for the resource.
- `port`: `ReferenceExpression` `get` -- Gets the port for the PostgreSQL server.
- `uriExpression`: `ReferenceExpression` `get` -- Gets the connection URI expression for the SQL Server.

## Methods

- [addDatabase](/reference/api/typescript/aspire.hosting.azure.sql/azuresqlserverresource/adddatabase.md) -- `method` -- Adds an Azure SQL Database to the application model. The Free Offer option will be used when deploying the resource in Azure
    ```typescript
  addDatabase(name: string, databaseName?: string): AzureSqlDatabaseResource
  ```
- [runAsContainer](/reference/api/typescript/aspire.hosting.azure.sql/azuresqlserverresource/runascontainer.md) -- `method` -- Configures an Azure SQL Database (server) resource to run locally in a container.
    ```typescript
  runAsContainer(configureContainer?: (obj: SqlServerServerResource) => Promise<void>): AzureSqlServerResource
  ```
- [withAdminDeploymentScriptStorage](/reference/api/typescript/aspire.hosting.azure.sql/azuresqlserverresource/withadmindeploymentscriptstorage.md) -- `method` -- Configures the Azure SQL Server to use the specified storage account for deployment script execution.
    ```typescript
  withAdminDeploymentScriptStorage(storage: AzureStorageResource): AzureSqlServerResource
  ```
- [withAdminDeploymentScriptSubnet](/reference/api/typescript/aspire.hosting.azure.sql/azuresqlserverresource/withadmindeploymentscriptsubnet.md) -- `method` -- Configures the Azure SQL Server to use the specified subnet for deployment script execution.
    ```typescript
  withAdminDeploymentScriptSubnet(subnet: AzureSubnetResource): AzureSqlServerResource
  ```
