or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

connection-configuration.mdfile-management.mdindex.mdmigration-task-types.mdproject-management.mdresource-information.mdservice-management.mdservice-tasks.mdtask-execution.md

connection-configuration.mddocs/

0

# Connection Configuration

1

2

Database connection classes and configuration for various source and target platforms. These classes encapsulate the connection details, authentication methods, and platform-specific settings required to connect to different database systems during migration operations.

3

4

## Capabilities

5

6

### SQL Server Connections

7

8

Connection configuration for SQL Server instances including on-premises, Azure SQL Database, Azure SQL Managed Instance, and cloud-hosted SQL Server.

9

10

```python { .api }

11

class SqlConnectionInfo(ConnectionInfo):

12

"""SQL Server connection information."""

13

14

def __init__(

15

self,

16

server_name: str,

17

authentication: str,

18

user_name: str = None,

19

password: str = None,

20

**kwargs

21

):

22

"""

23

Initialize SQL Server connection.

24

25

Parameters:

26

- server_name: SQL Server instance name or FQDN

27

- authentication: Authentication type

28

- database_name: Database name (optional)

29

- user_name: Username for SQL authentication

30

- password: Password for SQL authentication

31

- encrypt_connection: Enable SSL encryption

32

- trust_server_certificate: Trust server certificate

33

- connection_timeout: Connection timeout in seconds

34

"""

35

36

# Properties

37

server_name: str # Required: Server name or FQDN

38

database_name: str # Database name

39

authentication: str # SqlAuthentication, WindowsAuthentication, ActiveDirectoryPassword, etc.

40

user_name: str # Username for SQL auth

41

password: str # Password for SQL auth

42

encrypt_connection: bool # Enable encryption

43

trust_server_certificate: bool # Trust server certificate

44

connection_timeout: int # Connection timeout in seconds

45

additional_settings: str # Additional connection string parameters

46

```

47

48

**Usage Example:**

49

50

```python

51

from azure.mgmt.datamigration.models import SqlConnectionInfo

52

53

# SQL Server with SQL Authentication

54

sql_connection = SqlConnectionInfo(

55

server_name="myserver.database.windows.net",

56

database_name="MyDatabase",

57

authentication="SqlAuthentication",

58

user_name="myusername",

59

password="mypassword",

60

encrypt_connection=True,

61

trust_server_certificate=False,

62

connection_timeout=30

63

)

64

65

# SQL Server with Windows Authentication

66

sql_connection_windows = SqlConnectionInfo(

67

server_name="on-premises-server\\SQLEXPRESS",

68

authentication="WindowsAuthentication",

69

encrypt_connection=False,

70

trust_server_certificate=True

71

)

72

```

73

74

### MySQL Connections

75

76

Connection configuration for MySQL servers including on-premises MySQL, Amazon RDS for MySQL, and cloud-hosted MySQL instances.

77

78

```python { .api }

79

class MySqlConnectionInfo(ConnectionInfo):

80

"""MySQL connection information."""

81

82

def __init__(

83

self,

84

server_name: str,

85

port: int,

86

user_name: str,

87

password: str,

88

**kwargs

89

):

90

"""

91

Initialize MySQL connection.

92

93

Parameters:

94

- server_name: MySQL server hostname or IP

95

- port: MySQL server port (typically 3306)

96

- user_name: MySQL username

97

- password: MySQL password

98

- encrypt_connection: Enable SSL encryption

99

"""

100

101

# Properties

102

server_name: str # Required: Server hostname or IP

103

port: int # Required: Server port (typically 3306)

104

user_name: str # Required: MySQL username

105

password: str # Required: MySQL password

106

encrypt_connection: bool # Enable SSL encryption

107

```

108

109

**Usage Example:**

110

111

```python

112

from azure.mgmt.datamigration.models import MySqlConnectionInfo

113

114

mysql_connection = MySqlConnectionInfo(

115

server_name="mysql-server.example.com",

116

port=3306,

117

user_name="mysql_user",

118

password="mysql_password",

119

encrypt_connection=True

120

)

121

```

122

123

### PostgreSQL Connections

124

125

Connection configuration for PostgreSQL servers including on-premises PostgreSQL, Amazon RDS for PostgreSQL, and Google Cloud SQL for PostgreSQL.

126

127

```python { .api }

128

class PostgreSqlConnectionInfo(ConnectionInfo):

129

"""PostgreSQL connection information."""

130

131

def __init__(

132

self,

133

server_name: str,

134

port: int,

135

database_name: str,

136

user_name: str,

137

password: str,

138

**kwargs

139

):

140

"""

141

Initialize PostgreSQL connection.

142

143

Parameters:

144

- server_name: PostgreSQL server hostname or IP

145

- port: PostgreSQL server port (typically 5432)

146

- database_name: Database name

147

- user_name: PostgreSQL username

148

- password: PostgreSQL password

149

- encrypt_connection: Enable SSL encryption

150

- trust_server_certificate: Trust server certificate

151

"""

152

153

# Properties

154

server_name: str # Required: Server hostname or IP

155

port: int # Required: Server port (typically 5432)

156

database_name: str # Required: Database name

157

user_name: str # Required: PostgreSQL username

158

password: str # Required: PostgreSQL password

159

encrypt_connection: bool # Enable SSL encryption

160

trust_server_certificate: bool # Trust server certificate

161

```

162

163

**Usage Example:**

164

165

```python

166

from azure.mgmt.datamigration.models import PostgreSqlConnectionInfo

167

168

postgresql_connection = PostgreSqlConnectionInfo(

169

server_name="postgresql-server.example.com",

170

port=5432,

171

database_name="mydatabase",

172

user_name="postgres_user",

173

password="postgres_password",

174

encrypt_connection=True,

175

trust_server_certificate=False

176

)

177

```

178

179

### Oracle Connections

180

181

Connection configuration for Oracle Database instances including on-premises Oracle, Oracle Cloud, and Amazon RDS for Oracle.

182

183

```python { .api }

184

class OracleConnectionInfo(ConnectionInfo):

185

"""Oracle connection information."""

186

187

def __init__(

188

self,

189

server_name: str,

190

user_name: str,

191

password: str,

192

**kwargs

193

):

194

"""

195

Initialize Oracle connection.

196

197

Parameters:

198

- server_name: Oracle server hostname or TNS name

199

- user_name: Oracle username

200

- password: Oracle password

201

- port: Oracle listener port (typically 1521)

202

- service_name: Oracle service name

203

"""

204

205

# Properties

206

server_name: str # Required: Server hostname or TNS name

207

user_name: str # Required: Oracle username

208

password: str # Required: Oracle password

209

port: int # Oracle listener port (typically 1521)

210

service_name: str # Oracle service name

211

```

212

213

**Usage Example:**

214

215

```python

216

from azure.mgmt.datamigration.models import OracleConnectionInfo

217

218

oracle_connection = OracleConnectionInfo(

219

server_name="oracle-server.example.com",

220

port=1521,

221

service_name="ORCL",

222

user_name="oracle_user",

223

password="oracle_password"

224

)

225

```

226

227

### MongoDB Connections

228

229

Connection configuration for MongoDB instances including on-premises MongoDB, MongoDB Atlas, and Amazon DocumentDB.

230

231

```python { .api }

232

class MongoDbConnectionInfo(ConnectionInfo):

233

"""MongoDB connection information."""

234

235

def __init__(

236

self,

237

connection_string: str,

238

**kwargs

239

):

240

"""

241

Initialize MongoDB connection.

242

243

Parameters:

244

- connection_string: MongoDB connection string

245

"""

246

247

# Properties

248

connection_string: str # Required: Full MongoDB connection string

249

```

250

251

**Usage Example:**

252

253

```python

254

from azure.mgmt.datamigration.models import MongoDbConnectionInfo

255

256

# MongoDB with authentication

257

mongodb_connection = MongoDbConnectionInfo(

258

connection_string="mongodb://username:password@mongodb-server:27017/database?authSource=admin"

259

)

260

261

# MongoDB Atlas connection

262

mongodb_atlas_connection = MongoDbConnectionInfo(

263

connection_string="mongodb+srv://username:password@cluster.mongodb.net/database?retryWrites=true&w=majority"

264

)

265

```

266

267

### SQL Managed Instance Connections

268

269

Specialized connection information for Azure SQL Managed Instance targets.

270

271

```python { .api }

272

class MiSqlConnectionInfo(ConnectionInfo):

273

"""SQL Managed Instance connection information."""

274

275

def __init__(

276

self,

277

managed_instance_resource_id: str,

278

user_name: str,

279

password: str,

280

**kwargs

281

):

282

"""

283

Initialize SQL Managed Instance connection.

284

285

Parameters:

286

- managed_instance_resource_id: Azure resource ID of the Managed Instance

287

- user_name: SQL username

288

- password: SQL password

289

"""

290

291

# Properties

292

managed_instance_resource_id: str # Required: MI resource ID

293

user_name: str # Required: SQL username

294

password: str # Required: SQL password

295

```

296

297

## Base Connection Types

298

299

### ConnectionInfo

300

301

```python { .api }

302

class ConnectionInfo:

303

"""Base class for all connection information."""

304

305

def __init__(self, type: str, **kwargs):

306

"""

307

Base connection information.

308

309

Parameters:

310

- type: Connection type identifier

311

- user_name: Username for authentication

312

- password: Password for authentication

313

"""

314

315

# Properties

316

type: str # Required: Connection type

317

user_name: str # Username for authentication

318

password: str # Password for authentication

319

```

320

321

## Authentication Types

322

323

### SQL Server Authentication Types

324

325

- **SqlAuthentication**: Standard SQL Server username/password authentication

326

- **WindowsAuthentication**: Windows Integrated authentication

327

- **ActiveDirectoryPassword**: Azure Active Directory password authentication

328

- **ActiveDirectoryIntegrated**: Azure Active Directory integrated authentication

329

330

### Connection Security

331

332

Most connection types support these security options:

333

334

- **encrypt_connection**: Enable SSL/TLS encryption for data in transit

335

- **trust_server_certificate**: Whether to trust the server's SSL certificate

336

- **connection_timeout**: Connection timeout in seconds (default varies by platform)

337

338

## Connection Validation

339

340

Before using connections in migration tasks, validate them using connection test tasks:

341

342

```python

343

from azure.mgmt.datamigration.models import (

344

ConnectToSourceSqlServerTaskProperties,

345

ConnectToSourceSqlServerTaskInput,

346

ProjectTask

347

)

348

349

# Create connection test task

350

test_task_properties = ConnectToSourceSqlServerTaskProperties(

351

input=ConnectToSourceSqlServerTaskInput(

352

source_connection_info=sql_connection,

353

check_permissions_group="Default"

354

)

355

)

356

357

test_task = ProjectTask(

358

properties=test_task_properties

359

)

360

361

# Execute the connection test

362

task_result = client.tasks.create_or_update(

363

group_name="myResourceGroup",

364

service_name="myMigrationService",

365

project_name="myProject",

366

task_name="connectionTest",

367

parameters=test_task

368

)

369

```

370

371

## Error Handling

372

373

Common connection-related errors:

374

375

- **Authentication failures**: Invalid credentials or authentication method

376

- **Network connectivity**: Server unreachable or firewall blocking connections

377

- **SSL/TLS errors**: Certificate validation or encryption negotiation failures

378

- **Permission errors**: User lacks required database permissions

379

- **Connection timeout**: Server not responding within timeout period

380

381

Always test connections before using them in migration tasks to identify and resolve configuration issues early in the migration process.