Skip to main content

Configuring an ADF Linked Service Connection for Azure Database for PostgreSQL

note

For information on how to enable a connection for use with linked services, see Configuring a Linked Service Connection.

note

Field labels in this walkthrough follow the BimlFlex Connection Editor, with the connection column that carries each value and the Azure Data Factory property it maps to named alongside.

After selecting Azure PostgreSQL from the Linked Service Type dropdown, the form required for creating an Azure Database for PostgreSQL Linked Service will appear.

BimlFlex writes the Azure Database for PostgreSQL linked service with separate server, port, database, authentication, user and SSL mode properties, and sets the ADF version property to 2.0. The form edits each of these values in its own field.

Source Only Connector​

An Azure Database for PostgreSQL connection is used as a source. It is not available as a target. The Azure PostgreSQL Linked Service Type is offered on connections that use the PostgreSQL System Type.

Choosing an Authentication Method​

MethodAuthentication TypeCredentials
BasicBasicAuthUser Name and Password
Service PrincipalServicePrincipalTenant, Service Principal Id and Service Principal Key, with an optional Azure Cloud Type
System Assigned Managed IdentitySystemAssignedManagedIdentityNone. The system assigned managed identity of the data factory signs in.
User Assigned Managed IdentityUserAssignedManagedIdentityCredential

Recommendation: Store the Password and the Service Principal Key in Azure Key Vault rather than entering them as plaintext. The managed identity methods need no stored secret.

Complete Example: Basic Authentication with Azure Key Vault​

The values below are made up for illustration.

FieldExample Value
Connect via Integration RuntimeAutoResolveIntegrationRuntime
Hostexample-pg.postgres.database.azure.com
Port5432
Database Namebfx_src
AuthenticationBasic
User Namebfx-pg-user
AKV Linked Service (Password, Azure Key Vault tab)bfx-kv
Secret Name (Password, Azure Key Vault tab)BFX-SRC-PG-Password
SSL ModeRequired

Required Fields​

Common Required Fields

These fields are required for every Azure Database for PostgreSQL Linked Service connection:

Authentication Dependent Required Fields

Required for Basic:

Required for Service Principal:

Required for User Assigned Managed Identity:

System Assigned Managed Identity requires no further fields.

Optional fields are:

Connect via Integration Runtime​

Connect via Integration Runtime names the integration runtime for an Azure Database for PostgreSQL Linked Service connection. The default value is AutoResolveIntegrationRuntime. To use another runtime, select it from the dropdown or choose + New to add one. The custom values that appear in this dropdown can be maintained in Settings under Azure, in the AzureIntegrationRuntime setting. The value is stored in the connection's LS_ConnectVia_IntegrationRuntime column and maps to the ADF connectVia property. When the value is AutoResolveIntegrationRuntime, no connectVia property is written and the default Azure integration runtime is used.

Host​

The Host is the host name of the Azure Database for PostgreSQL server (for example, example-pg.postgres.database.azure.com). It is stored in the connection's LS_Server column and maps to the ADF server property.

Port​

The Port is the TCP port of the server. The form shows 5432 as a placeholder, and Data Factory uses 5432 when no port is written. It is stored in the connection's LS_Port column and maps to the ADF port property. The port must be a whole number from 1 to 65535. Any other value is not written, and the build reports a warning.

Database Name​

The Database Name is the name of the database to connect to. It is stored in the connection's LS_Db column and maps to the ADF database property. When the Database Name is blank, the connection's Catalog is written as the database.

Authentication​

The Authentication dropdown offers Basic, Service Principal, System Assigned Managed Identity and User Assigned Managed Identity. The selection is stored in two connection columns that always agree: LS_AuthenticationType holds the linked service value (BasicAuth, ServicePrincipal, SystemAssignedManagedIdentity or UserAssignedManagedIdentity) and LS_AuthenticationMethod holds the label. The LS_AuthenticationType value maps to the ADF authenticationType property.

When LS_AuthenticationType is blank, the build decides the authentication type from the connection:

  • BasicAuth for a user name with a password or an Azure Key Vault password secret
  • ServicePrincipal when the Service Principal Id is filled and no user name is set

When no authentication type can be decided, or LS_AuthenticationType holds a value the linked service does not accept, the build reports a warning. When Additional Connection String Properties is filled, the same cases keep the linked service in the connection string form, and the build reports one warning that names the reason.

User Name​

The User Name is the database user for Basic authentication. It is stored in the connection's LS_Username column and maps to the ADF username property.

Password​

The Password field accepts the password as plaintext in the LS_Password column, or an Azure Key Vault reference held in the LS_PasswordKVS_ fields that resolves to the password at runtime. Either form maps to the ADF password property. When an Azure Key Vault secret is named, the plaintext password is not written.

note

It is suggested that Azure Key Vault be used in place of manually entering the Password.

Service Principal​

Service Principal authentication signs in with a Microsoft Entra application that has access to the server.

The Tenant is the tenant in which the Azure Database for PostgreSQL server is located. It is stored in the connection's LS_Tenant column and maps to the ADF tenant property.

The Service Principal Id is the application id of the service principal. It is stored in the connection's LS_ServicePrincipalId column and maps to the ADF servicePrincipalId property. When it is blank, the build reports a warning, because the linked service cannot authenticate.

The Service Principal Key is the client secret, as plaintext in the LS_ServicePrincipalKey column, or as an Azure Key Vault reference held in the LS_ServicePrincipalKeyKVS_ fields that resolves to the secret at runtime. Either form maps to the ADF servicePrincipalKey property. When an Azure Key Vault secret is named, the plaintext key is not written.

note

It is suggested that Azure Key Vault be used in place of manually entering the Service Principal Key.

Azure Cloud Type​

The Azure Cloud Type is shown for Service Principal authentication. The options are (none), AzurePublic, AzureChina, AzureUsGovernment and AzureGermany. The selection is stored in the connection's LS_AzureCloudType column and maps to the ADF azureCloudType property.

System Assigned Managed Identity​

System Assigned Managed Identity signs in with the system assigned managed identity of the data factory. The identity must be added as a Microsoft Entra administrator of the server, as described in the Microsoft documentation. No credential is entered in the form.

Credential​

The Credential is shown for User Assigned Managed Identity authentication. It names the data factory credential that holds the user assigned managed identity. It is stored in the connection's LS_Credential column and maps to the ADF credential property. When it is blank, the build reports a warning, because the linked service cannot authenticate.

SSL Mode​

SSL Mode controls whether SSL is used for the connection. The options are:

SSL ModeStored ValueBehavior
Not set(none)When no connection string sets an SSL mode, no sslMode property is written and the Data Factory default applies.
DisabledDisabledSSL is disabled. The connection fails if the server requires SSL.
AllowAllowConnections without SSL are preferred, and SSL connections are allowed.
PreferredPreferredSSL connections are preferred, and connections without SSL are allowed.
RequiredRequiredThe connection fails if the server does not support SSL.
Verify CAVerify_caThe connection fails if the server does not support SSL, and the server certificate is verified.
Verify FullVerify_fullThe connection fails if the server does not support SSL, and the server certificate is verified against the host name.

The selection is stored in the connection's Additional Settings (LS_AdditionalSettings) under the key sslMode, and maps to the ADF sslMode property. The SSL Mode set in the form wins over an SSL mode in a connection string.

Connections with Encryption Method and Validate Server Certificate settings

A connection string can carry the Encryption Method (EncryptionMethod or EM) and Validate Server Certificate (ValidateServerCertificate, ValidateCertificate or VSC) settings in place of an SSL mode. The build writes such a connection with the matching SSL Mode, and the form shows the same SSL Mode when the connection is opened:

Encryption MethodValidate Server CertificateSSL Mode Written
0 (No Encryption)0, 1 or not setDisabled
1 (SSL)0 or not setRequired
1 (SSL)1Verify CA
2 or 6 (Request SSL)0, 1 or not setPreferred

Any other Encryption Method value, a Validate Server Certificate value other than 0 or 1, or a connection string that sets both these settings and an sslmode, keeps the linked service in the connection string form, and the build reports one warning that names the reason.

Additional Connection String Properties​

Additional Connection String Properties is in the Advanced section of the form. Enter settings the same way they appear in a connection string, as key=value pairs with a semicolon between settings, for example sslmode=require.

Settings entered here are saved as a connection string beside the fields above, in the connection's LS_ConnectionString column. The build reads that connection string and writes each setting it recognises as its own linked service property. A value in a field always wins over the same setting in the connection string.

The settings the build recognises are:

Connection String SettingADF Property
host, server or Data Sourceserver
portport
database, dbname or Initial Catalogdatabase
uid, User ID, user or usernameusername
password or pwdpassword
sslmode (disable, allow, prefer, require, verify-ca or verify-full)sslMode
EncryptionMethod and ValidateServerCertificatesslMode, as the table above shows

Application Name is read and not written.

A setting the build does not recognise, or a value it cannot read, keeps the whole linked service in the connection string form (version 1.0 in the editor's words), and the build reports one warning that names the reason. When the connection string holds a password, the warning does not list the settings it does not recognise.

When Additional Connection String Properties is empty, the connection string is saved empty and the linked service is written from the fields alone.

Connection String in Azure Key Vault​

The Advanced section also holds the Connection string in Azure Key Vault (version 1.0) toggle. When it is on, the connection string is held as one Azure Key Vault secret, named in the LS_ConnectionStringKVS_ fields, and the host, port, database, authentication, SSL Mode and Additional Connection String Properties fields are hidden.

A connection string held as one Azure Key Vault secret is written as the connection string form of the linked service, which the editor calls version 1.0. The build reports a warning for a linked service written in the connection string form, whether the string is entered or kept as an Azure Key Vault secret, because the Azure Data Factory service reads that form as version 1.0 of the connector, a version Microsoft lists as reaching end of support. The warning names the linked service, names the separate properties as the remedy and links Microsoft's connector lifecycle page for the date. To write the separate properties, turn the toggle off, enter the Host, Database Name and User Name, and keep the password in Azure Key Vault on the Password field's Azure Key Vault tab.

Azure Data Factory Linked Service Additional Information​

For additional information on ADF Azure Database for PostgreSQL Linked Service and its connection requirements see the Azure Data Factory Azure Database for PostgreSQL Connector documentation.