New-VEPSQLInstanceCredentials

Short Description

Creates a PostgreSQL credential object to authenticate to a PostgreSQL database.

Product: Veeam Backup & Replication

Product Edition: Enterprise, Enterprise Plus, Veeam Universal License

Syntax

This cmdlet provides the following parameter sets:

  • UseLinuxUserParameterSet

    New-VEPSQLInstanceCredentials [-UseLinuxUserForPeerAuthentication] [<CommonParameters>]

  • PeerAuthUserParameterSet

    New-VEPSQLInstanceCredentials -PeerAuthenticationUser <String> [<CommonParameters>]

  • SqlCredentialsParameterSet

    New-VEPSQLInstanceCredentials -SQLCredentials <PSCredential> [<CommonParameters>]

Detailed Description

This cmdlet creates a VEPSQLInstanceCredentials object that specifies authentication credentials for a PostgreSQL database. Use the resulting object with the Start-VEPSQLDatabaseRestoreRestores a backed-up PostgreSQL database. cmdlet to restore a PostgreSQL database.

You can define one of the following PostgreSQL authentication methods:

  • Authentication using the current Linux OS user. PostgreSQL authenticates the client as the PostgreSQL role with the same name as the current Linux OS user. This works for peer authentication and also for password authentication if the password of the Linux OS user is the same as the password of the PostgreSQL role.
  • Peer authentication using a specified Linux OS user. PostgreSQL authenticates the client as the PostgreSQL role mapped to the specified Linux OS user in the ident map file (pg_ident.conf).
  • Password authentication using a SQL user name and password.

Parameters

Parameters

Parameter

Description

Type

Required

Position

Accept Pipeline Input

PeerAuthenticationUser

Specifies the name of the Linux OS user for PostgreSQL peer authentication.

PostgreSQL will authenticate the client as the PostgreSQL role mapped to the specified Linux OS user in the ident map file (pg_ident.conf).

String

True

Named

False

SQLCredentials

Specifies SQL credentials for PostgreSQL password authentication. The cmdlet will use these credentials to authenticate to the PostgreSQL database.

Accepts the PSCredential object. To create this object, run the Get-Credential cmdlet.

PSCredential

True

Named

False

UseLinuxUserForPeerAuthentication

Defines that the cmdlet will use the current Linux OS user for PostgreSQL authentication. PostgreSQL will authenticate the client as the PostgreSQL role with the same name as the current Linux OS user.

This works for peer authentication and also for password authentication if the password of the Linux OS user is the same as the password of the PostgreSQL role.

SwitchParameter

True

Named

False

<CommonParameters>

This cmdlet supports Microsoft PowerShell common parameters. For more information on common parameters, see the About Common Parameters section of Microsoft Docs.

Output Object

The cmdlet returns the VEPSQLInstanceCredentials object that contains PostgreSQL authentication credentials.

Examples

New-VEPSQLInstanceCredentialsExample 1. Creating Credentials for Current Linux User Peer Authentication

This command creates a PostgreSQL credentials object using the current Linux OS user for peer authentication. Save the result to the $creds variable to use it with other cmdlets.

$creds = New-VEPSQLInstanceCredentials -UseLinuxUserForPeerAuthentication

New-VEPSQLInstanceCredentialsExample 2. Creating Credentials for Specified Linux User Peer Authentication

This command creates a PostgreSQL credentials object using a specified Linux OS user for peer authentication. Save the result to the $creds variable to use it with other cmdlets.

$creds = New-VEPSQLInstanceCredentials -PeerAuthenticationUser "wells"

New-VEPSQLInstanceCredentialsExample 3. Creating Credentials with SQL User Name and Password

This example shows how to create a PostgreSQL credentials object using SQL user name and password for password authentication.

$sqlcred = Get-Credential

$creds = New-VEPSQLInstanceCredentials -SQLCredentials $sqlcred

Perform the following steps:

  1. Run the Get-Credential cmdlet to create a credential object. Enter the PostgreSQL credentials that will be used for authentication. Save the result to the $sqlcred variable.
  2. Run the New-VEPSQLInstanceCredentials cmdlet. Set the $sqlcred variable as the SQLCredentials parameter value. Save the result to the $creds variable to use it with other cmdlets.

Get-Credential

Page updated 2026-08-18

Page content applies to build 13.1.1.18