1. Packages
  2. Azure Classic
  3. API Docs
  4. postgresql
  5. Configuration

We recommend using Azure Native.

Azure v6.22.0 published on Tuesday, Apr 1, 2025 by Pulumi

azure.postgresql.Configuration

Explore with Pulumi AI

Sets a PostgreSQL Configuration value on a PostgreSQL Server.

Disclaimers

Note: Since this resource is provisioned by default, the Azure Provider will not check for the presence of an existing resource prior to attempting to create it.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";

const example = new azure.core.ResourceGroup("example", {
    name: "api-rg-pro",
    location: "West Europe",
});
const exampleServer = new azure.postgresql.Server("example", {
    name: "postgresql-server-1",
    location: example.location,
    resourceGroupName: example.name,
    skuName: "B_Gen5_2",
    storageMb: 5120,
    backupRetentionDays: 7,
    geoRedundantBackupEnabled: false,
    autoGrowEnabled: true,
    administratorLogin: "psqladmin",
    administratorLoginPassword: "H@Sh1CoR3!",
    version: "9.5",
    sslEnforcementEnabled: true,
});
const exampleConfiguration = new azure.postgresql.Configuration("example", {
    name: "backslash_quote",
    resourceGroupName: example.name,
    serverName: exampleServer.name,
    value: "on",
});
Copy
import pulumi
import pulumi_azure as azure

example = azure.core.ResourceGroup("example",
    name="api-rg-pro",
    location="West Europe")
example_server = azure.postgresql.Server("example",
    name="postgresql-server-1",
    location=example.location,
    resource_group_name=example.name,
    sku_name="B_Gen5_2",
    storage_mb=5120,
    backup_retention_days=7,
    geo_redundant_backup_enabled=False,
    auto_grow_enabled=True,
    administrator_login="psqladmin",
    administrator_login_password="H@Sh1CoR3!",
    version="9.5",
    ssl_enforcement_enabled=True)
example_configuration = azure.postgresql.Configuration("example",
    name="backslash_quote",
    resource_group_name=example.name,
    server_name=example_server.name,
    value="on")
Copy
package main

import (
	"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/core"
	"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/postgresql"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		example, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
			Name:     pulumi.String("api-rg-pro"),
			Location: pulumi.String("West Europe"),
		})
		if err != nil {
			return err
		}
		exampleServer, err := postgresql.NewServer(ctx, "example", &postgresql.ServerArgs{
			Name:                       pulumi.String("postgresql-server-1"),
			Location:                   example.Location,
			ResourceGroupName:          example.Name,
			SkuName:                    pulumi.String("B_Gen5_2"),
			StorageMb:                  pulumi.Int(5120),
			BackupRetentionDays:        pulumi.Int(7),
			GeoRedundantBackupEnabled:  pulumi.Bool(false),
			AutoGrowEnabled:            pulumi.Bool(true),
			AdministratorLogin:         pulumi.String("psqladmin"),
			AdministratorLoginPassword: pulumi.String("H@Sh1CoR3!"),
			Version:                    pulumi.String("9.5"),
			SslEnforcementEnabled:      pulumi.Bool(true),
		})
		if err != nil {
			return err
		}
		_, err = postgresql.NewConfiguration(ctx, "example", &postgresql.ConfigurationArgs{
			Name:              pulumi.String("backslash_quote"),
			ResourceGroupName: example.Name,
			ServerName:        exampleServer.Name,
			Value:             pulumi.String("on"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Azure = Pulumi.Azure;

return await Deployment.RunAsync(() => 
{
    var example = new Azure.Core.ResourceGroup("example", new()
    {
        Name = "api-rg-pro",
        Location = "West Europe",
    });

    var exampleServer = new Azure.PostgreSql.Server("example", new()
    {
        Name = "postgresql-server-1",
        Location = example.Location,
        ResourceGroupName = example.Name,
        SkuName = "B_Gen5_2",
        StorageMb = 5120,
        BackupRetentionDays = 7,
        GeoRedundantBackupEnabled = false,
        AutoGrowEnabled = true,
        AdministratorLogin = "psqladmin",
        AdministratorLoginPassword = "H@Sh1CoR3!",
        Version = "9.5",
        SslEnforcementEnabled = true,
    });

    var exampleConfiguration = new Azure.PostgreSql.Configuration("example", new()
    {
        Name = "backslash_quote",
        ResourceGroupName = example.Name,
        ServerName = exampleServer.Name,
        Value = "on",
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azure.core.ResourceGroup;
import com.pulumi.azure.core.ResourceGroupArgs;
import com.pulumi.azure.postgresql.Server;
import com.pulumi.azure.postgresql.ServerArgs;
import com.pulumi.azure.postgresql.Configuration;
import com.pulumi.azure.postgresql.ConfigurationArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var example = new ResourceGroup("example", ResourceGroupArgs.builder()
            .name("api-rg-pro")
            .location("West Europe")
            .build());

        var exampleServer = new Server("exampleServer", ServerArgs.builder()
            .name("postgresql-server-1")
            .location(example.location())
            .resourceGroupName(example.name())
            .skuName("B_Gen5_2")
            .storageMb(5120)
            .backupRetentionDays(7)
            .geoRedundantBackupEnabled(false)
            .autoGrowEnabled(true)
            .administratorLogin("psqladmin")
            .administratorLoginPassword("H@Sh1CoR3!")
            .version("9.5")
            .sslEnforcementEnabled(true)
            .build());

        var exampleConfiguration = new Configuration("exampleConfiguration", ConfigurationArgs.builder()
            .name("backslash_quote")
            .resourceGroupName(example.name())
            .serverName(exampleServer.name())
            .value("on")
            .build());

    }
}
Copy
resources:
  example:
    type: azure:core:ResourceGroup
    properties:
      name: api-rg-pro
      location: West Europe
  exampleServer:
    type: azure:postgresql:Server
    name: example
    properties:
      name: postgresql-server-1
      location: ${example.location}
      resourceGroupName: ${example.name}
      skuName: B_Gen5_2
      storageMb: 5120
      backupRetentionDays: 7
      geoRedundantBackupEnabled: false
      autoGrowEnabled: true
      administratorLogin: psqladmin
      administratorLoginPassword: H@Sh1CoR3!
      version: '9.5'
      sslEnforcementEnabled: true
  exampleConfiguration:
    type: azure:postgresql:Configuration
    name: example
    properties:
      name: backslash_quote
      resourceGroupName: ${example.name}
      serverName: ${exampleServer.name}
      value: on
Copy

Create Configuration Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new Configuration(name: string, args: ConfigurationArgs, opts?: CustomResourceOptions);
@overload
def Configuration(resource_name: str,
                  args: ConfigurationArgs,
                  opts: Optional[ResourceOptions] = None)

@overload
def Configuration(resource_name: str,
                  opts: Optional[ResourceOptions] = None,
                  name: Optional[str] = None,
                  resource_group_name: Optional[str] = None,
                  server_name: Optional[str] = None,
                  value: Optional[str] = None)
func NewConfiguration(ctx *Context, name string, args ConfigurationArgs, opts ...ResourceOption) (*Configuration, error)
public Configuration(string name, ConfigurationArgs args, CustomResourceOptions? opts = null)
public Configuration(String name, ConfigurationArgs args)
public Configuration(String name, ConfigurationArgs args, CustomResourceOptions options)
type: azure:postgresql:Configuration
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. ConfigurationArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. ConfigurationArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. ConfigurationArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. ConfigurationArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. ConfigurationArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Constructor example

The following reference example uses placeholder values for all input properties.

var exampleconfigurationResourceResourceFromPostgresqlconfiguration = new Azure.PostgreSql.Configuration("exampleconfigurationResourceResourceFromPostgresqlconfiguration", new()
{
    Name = "string",
    ResourceGroupName = "string",
    ServerName = "string",
    Value = "string",
});
Copy
example, err := postgresql.NewConfiguration(ctx, "exampleconfigurationResourceResourceFromPostgresqlconfiguration", &postgresql.ConfigurationArgs{
	Name:              pulumi.String("string"),
	ResourceGroupName: pulumi.String("string"),
	ServerName:        pulumi.String("string"),
	Value:             pulumi.String("string"),
})
Copy
var exampleconfigurationResourceResourceFromPostgresqlconfiguration = new Configuration("exampleconfigurationResourceResourceFromPostgresqlconfiguration", ConfigurationArgs.builder()
    .name("string")
    .resourceGroupName("string")
    .serverName("string")
    .value("string")
    .build());
Copy
exampleconfiguration_resource_resource_from_postgresqlconfiguration = azure.postgresql.Configuration("exampleconfigurationResourceResourceFromPostgresqlconfiguration",
    name="string",
    resource_group_name="string",
    server_name="string",
    value="string")
Copy
const exampleconfigurationResourceResourceFromPostgresqlconfiguration = new azure.postgresql.Configuration("exampleconfigurationResourceResourceFromPostgresqlconfiguration", {
    name: "string",
    resourceGroupName: "string",
    serverName: "string",
    value: "string",
});
Copy
type: azure:postgresql:Configuration
properties:
    name: string
    resourceGroupName: string
    serverName: string
    value: string
Copy

Configuration Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The Configuration resource accepts the following input properties:

Name
This property is required.
Changes to this property will trigger replacement.
string
Specifies the name of the PostgreSQL Configuration, which needs to be a valid PostgreSQL configuration name. Changing this forces a new resource to be created.
ResourceGroupName
This property is required.
Changes to this property will trigger replacement.
string
The name of the resource group in which the PostgreSQL Server exists. Changing this forces a new resource to be created.
ServerName
This property is required.
Changes to this property will trigger replacement.
string
Specifies the name of the PostgreSQL Server. Changing this forces a new resource to be created.
Value
This property is required.
Changes to this property will trigger replacement.
string
Specifies the value of the PostgreSQL Configuration. See the PostgreSQL documentation for valid values. Changing this forces a new resource to be created.
Name
This property is required.
Changes to this property will trigger replacement.
string
Specifies the name of the PostgreSQL Configuration, which needs to be a valid PostgreSQL configuration name. Changing this forces a new resource to be created.
ResourceGroupName
This property is required.
Changes to this property will trigger replacement.
string
The name of the resource group in which the PostgreSQL Server exists. Changing this forces a new resource to be created.
ServerName
This property is required.
Changes to this property will trigger replacement.
string
Specifies the name of the PostgreSQL Server. Changing this forces a new resource to be created.
Value
This property is required.
Changes to this property will trigger replacement.
string
Specifies the value of the PostgreSQL Configuration. See the PostgreSQL documentation for valid values. Changing this forces a new resource to be created.
name
This property is required.
Changes to this property will trigger replacement.
String
Specifies the name of the PostgreSQL Configuration, which needs to be a valid PostgreSQL configuration name. Changing this forces a new resource to be created.
resourceGroupName
This property is required.
Changes to this property will trigger replacement.
String
The name of the resource group in which the PostgreSQL Server exists. Changing this forces a new resource to be created.
serverName
This property is required.
Changes to this property will trigger replacement.
String
Specifies the name of the PostgreSQL Server. Changing this forces a new resource to be created.
value
This property is required.
Changes to this property will trigger replacement.
String
Specifies the value of the PostgreSQL Configuration. See the PostgreSQL documentation for valid values. Changing this forces a new resource to be created.
name
This property is required.
Changes to this property will trigger replacement.
string
Specifies the name of the PostgreSQL Configuration, which needs to be a valid PostgreSQL configuration name. Changing this forces a new resource to be created.
resourceGroupName
This property is required.
Changes to this property will trigger replacement.
string
The name of the resource group in which the PostgreSQL Server exists. Changing this forces a new resource to be created.
serverName
This property is required.
Changes to this property will trigger replacement.
string
Specifies the name of the PostgreSQL Server. Changing this forces a new resource to be created.
value
This property is required.
Changes to this property will trigger replacement.
string
Specifies the value of the PostgreSQL Configuration. See the PostgreSQL documentation for valid values. Changing this forces a new resource to be created.
name
This property is required.
Changes to this property will trigger replacement.
str
Specifies the name of the PostgreSQL Configuration, which needs to be a valid PostgreSQL configuration name. Changing this forces a new resource to be created.
resource_group_name
This property is required.
Changes to this property will trigger replacement.
str
The name of the resource group in which the PostgreSQL Server exists. Changing this forces a new resource to be created.
server_name
This property is required.
Changes to this property will trigger replacement.
str
Specifies the name of the PostgreSQL Server. Changing this forces a new resource to be created.
value
This property is required.
Changes to this property will trigger replacement.
str
Specifies the value of the PostgreSQL Configuration. See the PostgreSQL documentation for valid values. Changing this forces a new resource to be created.
name
This property is required.
Changes to this property will trigger replacement.
String
Specifies the name of the PostgreSQL Configuration, which needs to be a valid PostgreSQL configuration name. Changing this forces a new resource to be created.
resourceGroupName
This property is required.
Changes to this property will trigger replacement.
String
The name of the resource group in which the PostgreSQL Server exists. Changing this forces a new resource to be created.
serverName
This property is required.
Changes to this property will trigger replacement.
String
Specifies the name of the PostgreSQL Server. Changing this forces a new resource to be created.
value
This property is required.
Changes to this property will trigger replacement.
String
Specifies the value of the PostgreSQL Configuration. See the PostgreSQL documentation for valid values. Changing this forces a new resource to be created.

Outputs

All input properties are implicitly available as output properties. Additionally, the Configuration resource produces the following output properties:

Id string
The provider-assigned unique ID for this managed resource.
Id string
The provider-assigned unique ID for this managed resource.
id String
The provider-assigned unique ID for this managed resource.
id string
The provider-assigned unique ID for this managed resource.
id str
The provider-assigned unique ID for this managed resource.
id String
The provider-assigned unique ID for this managed resource.

Look up Existing Configuration Resource

Get an existing Configuration resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: ConfigurationState, opts?: CustomResourceOptions): Configuration
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        name: Optional[str] = None,
        resource_group_name: Optional[str] = None,
        server_name: Optional[str] = None,
        value: Optional[str] = None) -> Configuration
func GetConfiguration(ctx *Context, name string, id IDInput, state *ConfigurationState, opts ...ResourceOption) (*Configuration, error)
public static Configuration Get(string name, Input<string> id, ConfigurationState? state, CustomResourceOptions? opts = null)
public static Configuration get(String name, Output<String> id, ConfigurationState state, CustomResourceOptions options)
resources:  _:    type: azure:postgresql:Configuration    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
Name Changes to this property will trigger replacement. string
Specifies the name of the PostgreSQL Configuration, which needs to be a valid PostgreSQL configuration name. Changing this forces a new resource to be created.
ResourceGroupName Changes to this property will trigger replacement. string
The name of the resource group in which the PostgreSQL Server exists. Changing this forces a new resource to be created.
ServerName Changes to this property will trigger replacement. string
Specifies the name of the PostgreSQL Server. Changing this forces a new resource to be created.
Value Changes to this property will trigger replacement. string
Specifies the value of the PostgreSQL Configuration. See the PostgreSQL documentation for valid values. Changing this forces a new resource to be created.
Name Changes to this property will trigger replacement. string
Specifies the name of the PostgreSQL Configuration, which needs to be a valid PostgreSQL configuration name. Changing this forces a new resource to be created.
ResourceGroupName Changes to this property will trigger replacement. string
The name of the resource group in which the PostgreSQL Server exists. Changing this forces a new resource to be created.
ServerName Changes to this property will trigger replacement. string
Specifies the name of the PostgreSQL Server. Changing this forces a new resource to be created.
Value Changes to this property will trigger replacement. string
Specifies the value of the PostgreSQL Configuration. See the PostgreSQL documentation for valid values. Changing this forces a new resource to be created.
name Changes to this property will trigger replacement. String
Specifies the name of the PostgreSQL Configuration, which needs to be a valid PostgreSQL configuration name. Changing this forces a new resource to be created.
resourceGroupName Changes to this property will trigger replacement. String
The name of the resource group in which the PostgreSQL Server exists. Changing this forces a new resource to be created.
serverName Changes to this property will trigger replacement. String
Specifies the name of the PostgreSQL Server. Changing this forces a new resource to be created.
value Changes to this property will trigger replacement. String
Specifies the value of the PostgreSQL Configuration. See the PostgreSQL documentation for valid values. Changing this forces a new resource to be created.
name Changes to this property will trigger replacement. string
Specifies the name of the PostgreSQL Configuration, which needs to be a valid PostgreSQL configuration name. Changing this forces a new resource to be created.
resourceGroupName Changes to this property will trigger replacement. string
The name of the resource group in which the PostgreSQL Server exists. Changing this forces a new resource to be created.
serverName Changes to this property will trigger replacement. string
Specifies the name of the PostgreSQL Server. Changing this forces a new resource to be created.
value Changes to this property will trigger replacement. string
Specifies the value of the PostgreSQL Configuration. See the PostgreSQL documentation for valid values. Changing this forces a new resource to be created.
name Changes to this property will trigger replacement. str
Specifies the name of the PostgreSQL Configuration, which needs to be a valid PostgreSQL configuration name. Changing this forces a new resource to be created.
resource_group_name Changes to this property will trigger replacement. str
The name of the resource group in which the PostgreSQL Server exists. Changing this forces a new resource to be created.
server_name Changes to this property will trigger replacement. str
Specifies the name of the PostgreSQL Server. Changing this forces a new resource to be created.
value Changes to this property will trigger replacement. str
Specifies the value of the PostgreSQL Configuration. See the PostgreSQL documentation for valid values. Changing this forces a new resource to be created.
name Changes to this property will trigger replacement. String
Specifies the name of the PostgreSQL Configuration, which needs to be a valid PostgreSQL configuration name. Changing this forces a new resource to be created.
resourceGroupName Changes to this property will trigger replacement. String
The name of the resource group in which the PostgreSQL Server exists. Changing this forces a new resource to be created.
serverName Changes to this property will trigger replacement. String
Specifies the name of the PostgreSQL Server. Changing this forces a new resource to be created.
value Changes to this property will trigger replacement. String
Specifies the value of the PostgreSQL Configuration. See the PostgreSQL documentation for valid values. Changing this forces a new resource to be created.

Import

PostgreSQL Configurations can be imported using the resource id, e.g.

$ pulumi import azure:postgresql/configuration:Configuration backslash_quote /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.DBforPostgreSQL/servers/server1/configurations/backslash_quote
Copy

To learn more about importing existing cloud resources, see Importing resources.

Package Details

Repository
Azure Classic pulumi/pulumi-azure
License
Apache-2.0
Notes
This Pulumi package is based on the azurerm Terraform Provider.