This page describes how to create source connection profiles for
homogeneous SQL Server migrations. Source connection profiles
for this migration scenario differ depending on your source database:

- Source connection profiles for self-managed and Amazon RDS sources.
- Source connection profiles for Cloud SQL for SQL Server sources.

## For self-managed and Amazon RDS sources

To create a source connection profile for a self-managed or Amazon RDS source,
follow these steps:

### Console

1. In the Google Cloud console, go to the **Connection profiles** page.

   [Go to Connection profiles](https://console.cloud.google.com/dbmigration/connection-profiles)
2. Click **Create profile**.
3. On the **Create a connection profile** page, from the **Profile role** list, select **Source**.
4. From the **Database engine** list, select **SQL Server**.
5. Supply the following information for your connection profile:
   - Connection profile name.
   - Connection profile ID.
   - Region.
   - The Cloud Storage bucket that contains [the parent database folder](https://docs.cloud.google.com/database-migration/docs/sqlserver/storage-buckets.md.txt) where you create the full, diff, and logs folders (that hold the full backup, differential backup, and transaction log files).

   For more information about connection profile fields, see
   [Connection profiles overview](https://docs.cloud.google.com/database-migration/docs/sqlserver/about-connection-profiles.md.txt).
6. Optional: In the **Test connection profile** section, click **Run test** .

   Database Migration Service performs a quick check to verify that
   the connection details you supplied are sufficient to reach
   your data.
7. Click **Create** at the bottom of the page.

   The **Connection profiles** page appears, and the newly
   created connection profile is displayed.

### gcloud

This sample uses the optional `--no-async` flag so that all operations
are performed synchronously. This means that some commands might take
a while to complete. You can skip the `--no-async` flag to run commands asynchronously.
If you do, you need to use the
[`gcloud database-migration operations describe`](https://docs.cloud.google.com/sdk/gcloud/reference/database-migration/migration-jobs/describe.md.txt)
command to verify if your operation is successful.


Before using any of the command data below,
make the following replacements:

- <var class="edit" scope="CONNECTION_PROFILE_ID" translate="no">CONNECTION_PROFILE_ID</var> with a machine-readable identifier for your connection profile.
- <var class="edit" scope="REGION" translate="no">REGION</var> with the identifier of the region where you want to save the connection profile.
- <var class="edit" scope="CONNECTION_PROFILE_NAME" translate="no">CONNECTION_PROFILE_NAME</var> with a human-readable name for your connection profile. This value is displayed in Database Migration Service in the Google Cloud console.
- <var class="edit" scope="SOURCE_STORAGE_BUCKET_NAME" translate="no">SOURCE_STORAGE_BUCKET_NAME</var> with the Cloud Storage [bucket name](https://docs.cloud.google.com/storage/docs/bucket-metadata.md.txt) that contains the parent database folder where you create the full, diff, and logs folders (that hold the full backup, differential backup, and transaction log files).

For more information on these values, see [Connection profiles overview](https://docs.cloud.google.com/database-migration/docs/sqlserver/about-connection-profiles.md.txt).


Execute the

following

command:

#### Linux, macOS, or Cloud Shell

> [!NOTE]
> **Note:** Ensure you have initialized the Google Cloud CLI with authentication and a project by running either [gcloud init](https://docs.cloud.google.com/sdk/gcloud/reference/init); or [gcloud auth login](https://docs.cloud.google.com/sdk/gcloud/reference/auth/login.md.txt) and [gcloud config set project](https://docs.cloud.google.com/sdk/gcloud/reference/config/set.md.txt).

```bash
gcloud database-migration connection-profiles \
create sqlserver CONNECTION_PROFILE_ID \
  --no-async \
  --display-name=CONNECTION_PROFILE_NAME \
  --gcs-bucket=SOURCE_STORAGE_BUCKET_NAME \
  --region=REGION
```

#### Windows (PowerShell)

> [!NOTE]
> **Note:** Ensure you have initialized the Google Cloud CLI with authentication and a project by running either [gcloud init](https://docs.cloud.google.com/sdk/gcloud/reference/init); or [gcloud auth login](https://docs.cloud.google.com/sdk/gcloud/reference/auth/login.md.txt) and [gcloud config set project](https://docs.cloud.google.com/sdk/gcloud/reference/config/set.md.txt).

```bash
gcloud database-migration connection-profiles `
create sqlserver CONNECTION_PROFILE_ID `
  --no-async `
  --display-name=CONNECTION_PROFILE_NAME `
  --gcs-bucket=SOURCE_STORAGE_BUCKET_NAME `
  --region=REGION
```

#### Windows (cmd.exe)

> [!NOTE]
> **Note:** Ensure you have initialized the Google Cloud CLI with authentication and a project by running either [gcloud init](https://docs.cloud.google.com/sdk/gcloud/reference/init); or [gcloud auth login](https://docs.cloud.google.com/sdk/gcloud/reference/auth/login.md.txt) and [gcloud config set project](https://docs.cloud.google.com/sdk/gcloud/reference/config/set.md.txt).

```bash
gcloud database-migration connection-profiles ^
create sqlserver CONNECTION_PROFILE_ID ^
  --no-async ^
  --display-name=CONNECTION_PROFILE_NAME ^
  --gcs-bucket=SOURCE_STORAGE_BUCKET_NAME ^
  --region=REGION
```

You should receive a response similar to the following:

```
Waiting for connection profile [CONNECTION_PROFILE_ID]
to be created with [OPERATION_ID]

Waiting for operation [OPERATION_ID] to complete...done.

Created connection profile CONNECTION_PROFILE_ID [OPERATION_ID]
```

## For Cloud SQL for SQL Server sources

You can create source connection profiles for a Cloud SQL for SQL Server source
with Google Cloud CLI.

This sample uses the optional `--no-async` flag so that all operations
are performed synchronously. This means that some commands might take
a while to complete. You can skip the `--no-async` flag to run commands asynchronously.
If you do, you need to use the
[`gcloud database-migration operations describe`](https://docs.cloud.google.com/sdk/gcloud/reference/database-migration/migration-jobs/describe.md.txt)
command to verify if your operation is successful.


Before using any of the command data below,
make the following replacements:

- <var class="edit" scope="CONNECTION_PROFILE_NAME" translate="no">CONNECTION_PROFILE_NAME</var> with a human-readable name for your connection profile. This value is displayed in Database Migration Service in the Google Cloud console.
- <var class="edit" scope="CONNECTION_PROFILE_ID" translate="no">CONNECTION_PROFILE_ID</var> with a machine-readable identifier for your connection profile.
- <var class="edit" scope="REGION" translate="no">REGION</var> with the identifier of the region where you want to save the connection profile. This must be the same region where you have your destination instance.
- <var class="edit" scope="SOURCE_STORAGE_BUCKET_NAME" translate="no">SOURCE_STORAGE_BUCKET_NAME</var> with the Cloud Storage [bucket name](https://docs.cloud.google.com/storage/docs/bucket-metadata.md.txt) where you want to store the backup files created by Database Migration Service.
- <var class="edit" scope="SOURCE_STORAGE_BUCKET_FOLDER_PREFIX" translate="no">SOURCE_STORAGE_BUCKET_FOLDER_PREFIX</var> with the path to the folder where you want to store the backup files created by Database Migration Service. This path should end with a backslash character (that is, `\`), for example: `my-backup-directory/my-database/`. For more information on Cloud Storage object namespaces, see [About Cloud Storage objects](https://docs.cloud.google.com/storage/docs/objects.md.txt#namespace) in the Cloud Storage documentation.
- <var class="edit" scope="SOURCE_CLOUD_SQL_PROJECT_ID" translate="no">SOURCE_CLOUD_SQL_PROJECT_ID</var> with the Google Cloud project identifier where you have your **source** Cloud SQL for SQL Server instance.
- <var class="edit" scope="SOURCE_CLOUD_SQL_INSTANCE_ID" translate="no">SOURCE_CLOUD_SQL_INSTANCE_ID</var> with the identifier of your source Cloud SQL for SQL Server instance.
- <var class="edit" scope="DESTINATION_PROJECT_ID" translate="no">DESTINATION_PROJECT_ID</var> with the Google Cloud project identifier where you have your **destination** Cloud SQL for SQL Server instance. This must be the same project where you have your Database Migration Service API enabled and where you create the migration job.
- <var class="edit" scope="USERNAME" translate="no">USERNAME</var> with the name of the database account that Database Migration Service uses to connect to your source database.
- <var class="edit" scope="PASSWORD" translate="no">PASSWORD</var> with the password for the database account that Database Migration Service uses to connect to your source database.

For more information on these values, see [Connection profiles overview](https://docs.cloud.google.com/database-migration/docs/sqlserver/about-connection-profiles.md.txt).


Execute the

following

command:

#### Linux, macOS, or Cloud Shell

> [!NOTE]
> **Note:** Ensure you have initialized the Google Cloud CLI with authentication and a project by running either [gcloud init](https://docs.cloud.google.com/sdk/gcloud/reference/init); or [gcloud auth login](https://docs.cloud.google.com/sdk/gcloud/reference/auth/login.md.txt) and [gcloud config set project](https://docs.cloud.google.com/sdk/gcloud/reference/config/set.md.txt).

```bash
gcloud database-migration connection-profiles \
create sqlserver CONNECTION_PROFILE_ID \
  --no-async \
  --display-name=CONNECTION_PROFILE_NAME \
  --gcs-bucket=SOURCE_STORAGE_BUCKET_NAME \
  --gcs-prefix=SOURCE_STORAGE_BUCKET_FOLDER_PREFIX \
  --cloudsql-instance=SOURCE_CLOUD_SQL_INSTANCE_ID \
  --cloudsql-project-id=SOURCE_CLOUD_SQL_PROJECT_ID \
  --region=REGION \
  --project=DESTINATION_PROJECT_ID \
  --username=USERNAME \
  --password=PASSWORD \
  --role=SOURCE
```

#### Windows (PowerShell)

> [!NOTE]
> **Note:** Ensure you have initialized the Google Cloud CLI with authentication and a project by running either [gcloud init](https://docs.cloud.google.com/sdk/gcloud/reference/init); or [gcloud auth login](https://docs.cloud.google.com/sdk/gcloud/reference/auth/login.md.txt) and [gcloud config set project](https://docs.cloud.google.com/sdk/gcloud/reference/config/set.md.txt).

```bash
gcloud database-migration connection-profiles `
create sqlserver CONNECTION_PROFILE_ID `
  --no-async `
  --display-name=CONNECTION_PROFILE_NAME `
  --gcs-bucket=SOURCE_STORAGE_BUCKET_NAME `
  --gcs-prefix=SOURCE_STORAGE_BUCKET_FOLDER_PREFIX `
  --cloudsql-instance=SOURCE_CLOUD_SQL_INSTANCE_ID `
  --cloudsql-project-id=SOURCE_CLOUD_SQL_PROJECT_ID `
  --region=REGION `
  --project=DESTINATION_PROJECT_ID `
  --username=USERNAME `
  --password=PASSWORD `
  --role=SOURCE
```

#### Windows (cmd.exe)

> [!NOTE]
> **Note:** Ensure you have initialized the Google Cloud CLI with authentication and a project by running either [gcloud init](https://docs.cloud.google.com/sdk/gcloud/reference/init); or [gcloud auth login](https://docs.cloud.google.com/sdk/gcloud/reference/auth/login.md.txt) and [gcloud config set project](https://docs.cloud.google.com/sdk/gcloud/reference/config/set.md.txt).

```bash
gcloud database-migration connection-profiles ^
create sqlserver CONNECTION_PROFILE_ID ^
  --no-async ^
  --display-name=CONNECTION_PROFILE_NAME ^
  --gcs-bucket=SOURCE_STORAGE_BUCKET_NAME ^
  --gcs-prefix=SOURCE_STORAGE_BUCKET_FOLDER_PREFIX ^
  --cloudsql-instance=SOURCE_CLOUD_SQL_INSTANCE_ID ^
  --cloudsql-project-id=SOURCE_CLOUD_SQL_PROJECT_ID ^
  --region=REGION ^
  --project=DESTINATION_PROJECT_ID ^
  --username=USERNAME ^
  --password=PASSWORD ^
  --role=SOURCE
```

You should receive a response similar to the following:

```
Waiting for connection profile [CONNECTION_PROFILE_ID]
to be created with [OPERATION_ID]

Waiting for operation [OPERATION_ID] to complete...done.

Created connection profile CONNECTION_PROFILE_ID [OPERATION_ID]
```