Server

class Server : KotlinCustomResource

Represents a server. Uses Azure REST API version 2024-08-01. In version 2.x of the Azure Native provider, it used API version 2022-12-01. Other available API versions: 2022-12-01, 2023-03-01-preview, 2023-06-01-preview, 2023-12-01-preview, 2024-03-01-preview, 2024-11-01-preview, 2025-01-01-preview. These can be accessed by generating a local SDK package using the CLI command pulumi package add azure-native dbforpostgresql [ApiVersion]. See the ../../../version-guide/#accessing-any-api-version-via-local-packages for details.

Example Usage

Create a database as a geo-restore in geo-paired location

using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AzureNative = Pulumi.AzureNative;
return await Deployment.RunAsync(() =>
{
var server = new AzureNative.DBforPostgreSQL.Server("server", new()
{
CreateMode = AzureNative.DBforPostgreSQL.CreateMode.GeoRestore,
DataEncryption = new AzureNative.DBforPostgreSQL.Inputs.DataEncryptionArgs
{
GeoBackupKeyURI = "https://test-geo-kv.vault.azure.net/keys/test-key1/66f57315bab34b0189daa113fbc78787",
GeoBackupUserAssignedIdentityId = "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-geo-usermanagedidentity",
PrimaryKeyURI = "https://test-kv.vault.azure.net/keys/test-key1/77f57315bab34b0189daa113fbc78787",
PrimaryUserAssignedIdentityId = "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-usermanagedidentity",
Type = AzureNative.DBforPostgreSQL.ArmServerKeyType.AzureKeyVault,
},
Identity = new AzureNative.DBforPostgreSQL.Inputs.UserAssignedIdentityArgs
{
Type = AzureNative.DBforPostgreSQL.IdentityType.UserAssigned,
UserAssignedIdentities =
{
{ "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-geo-usermanagedidentity", null },
{ "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-usermanagedidentity", null },
},
},
Location = "eastus",
PointInTimeUTC = "2021-06-27T00:04:59.4078005+00:00",
ResourceGroupName = "testrg",
ServerName = "pgtestsvc5geo",
SourceServerResourceId = "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforPostgreSQL/flexibleServers/sourcepgservername",
});
});
package main
import (
dbforpostgresql "github.com/pulumi/pulumi-azure-native-sdk/dbforpostgresql/v3"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := dbforpostgresql.NewServer(ctx, "server", &dbforpostgresql.ServerArgs{
CreateMode: pulumi.String(dbforpostgresql.CreateModeGeoRestore),
DataEncryption: &dbforpostgresql.DataEncryptionArgs{
GeoBackupKeyURI: pulumi.String("https://test-geo-kv.vault.azure.net/keys/test-key1/66f57315bab34b0189daa113fbc78787"),
GeoBackupUserAssignedIdentityId: pulumi.String("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-geo-usermanagedidentity"),
PrimaryKeyURI: pulumi.String("https://test-kv.vault.azure.net/keys/test-key1/77f57315bab34b0189daa113fbc78787"),
PrimaryUserAssignedIdentityId: pulumi.String("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-usermanagedidentity"),
Type: pulumi.String(dbforpostgresql.ArmServerKeyTypeAzureKeyVault),
},
Identity: &dbforpostgresql.UserAssignedIdentityArgs{
Type: pulumi.String(dbforpostgresql.IdentityTypeUserAssigned),
UserAssignedIdentities: dbforpostgresql.UserIdentityMap{
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-geo-usermanagedidentity": &dbforpostgresql.UserIdentityArgs{},
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-usermanagedidentity": &dbforpostgresql.UserIdentityArgs{},
},
},
Location: pulumi.String("eastus"),
PointInTimeUTC: pulumi.String("2021-06-27T00:04:59.4078005+00:00"),
ResourceGroupName: pulumi.String("testrg"),
ServerName: pulumi.String("pgtestsvc5geo"),
SourceServerResourceId: pulumi.String("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforPostgreSQL/flexibleServers/sourcepgservername"),
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azurenative.dbforpostgresql.Server;
import com.pulumi.azurenative.dbforpostgresql.ServerArgs;
import com.pulumi.azurenative.dbforpostgresql.inputs.DataEncryptionArgs;
import com.pulumi.azurenative.dbforpostgresql.inputs.UserAssignedIdentityArgs;
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 server = new Server("server", ServerArgs.builder()
.createMode("GeoRestore")
.dataEncryption(DataEncryptionArgs.builder()
.geoBackupKeyURI("https://test-geo-kv.vault.azure.net/keys/test-key1/66f57315bab34b0189daa113fbc78787")
.geoBackupUserAssignedIdentityId("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-geo-usermanagedidentity")
.primaryKeyURI("https://test-kv.vault.azure.net/keys/test-key1/77f57315bab34b0189daa113fbc78787")
.primaryUserAssignedIdentityId("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-usermanagedidentity")
.type("AzureKeyVault")
.build())
.identity(UserAssignedIdentityArgs.builder()
.type("UserAssigned")
.userAssignedIdentities(Map.ofEntries(
Map.entry("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-geo-usermanagedidentity", UserIdentityArgs.builder()
.build()),
Map.entry("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-usermanagedidentity", UserIdentityArgs.builder()
.build())
))
.build())
.location("eastus")
.pointInTimeUTC("2021-06-27T00:04:59.4078005+00:00")
.resourceGroupName("testrg")
.serverName("pgtestsvc5geo")
.sourceServerResourceId("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforPostgreSQL/flexibleServers/sourcepgservername")
.build());
}
}

Create a database as a point in time restore

using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AzureNative = Pulumi.AzureNative;
return await Deployment.RunAsync(() =>
{
var server = new AzureNative.DBforPostgreSQL.Server("server", new()
{
CreateMode = AzureNative.DBforPostgreSQL.CreateMode.PointInTimeRestore,
Location = "westus",
PointInTimeUTC = "2021-06-27T00:04:59.4078005+00:00",
ResourceGroupName = "testrg",
ServerName = "pgtestsvc5",
SourceServerResourceId = "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforPostgreSQL/flexibleServers/sourcepgservername",
});
});
package main
import (
dbforpostgresql "github.com/pulumi/pulumi-azure-native-sdk/dbforpostgresql/v3"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := dbforpostgresql.NewServer(ctx, "server", &dbforpostgresql.ServerArgs{
CreateMode: pulumi.String(dbforpostgresql.CreateModePointInTimeRestore),
Location: pulumi.String("westus"),
PointInTimeUTC: pulumi.String("2021-06-27T00:04:59.4078005+00:00"),
ResourceGroupName: pulumi.String("testrg"),
ServerName: pulumi.String("pgtestsvc5"),
SourceServerResourceId: pulumi.String("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforPostgreSQL/flexibleServers/sourcepgservername"),
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azurenative.dbforpostgresql.Server;
import com.pulumi.azurenative.dbforpostgresql.ServerArgs;
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 server = new Server("server", ServerArgs.builder()
.createMode("PointInTimeRestore")
.location("westus")
.pointInTimeUTC("2021-06-27T00:04:59.4078005+00:00")
.resourceGroupName("testrg")
.serverName("pgtestsvc5")
.sourceServerResourceId("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforPostgreSQL/flexibleServers/sourcepgservername")
.build());
}
}

Create a new server

using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AzureNative = Pulumi.AzureNative;
return await Deployment.RunAsync(() =>
{
var server = new AzureNative.DBforPostgreSQL.Server("server", new()
{
AdministratorLogin = "cloudsa",
AdministratorLoginPassword = "password",
AvailabilityZone = "1",
Backup = new AzureNative.DBforPostgreSQL.Inputs.BackupArgs
{
BackupRetentionDays = 7,
GeoRedundantBackup = AzureNative.DBforPostgreSQL.GeoRedundantBackupEnum.Disabled,
},
CreateMode = AzureNative.DBforPostgreSQL.CreateMode.Create,
HighAvailability = new AzureNative.DBforPostgreSQL.Inputs.HighAvailabilityArgs
{
Mode = AzureNative.DBforPostgreSQL.HighAvailabilityMode.ZoneRedundant,
},
Location = "westus",
Network = new AzureNative.DBforPostgreSQL.Inputs.NetworkArgs
{
DelegatedSubnetResourceId = "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/test-vnet-subnet",
PrivateDnsZoneArmResourceId = "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourcegroups/testrg/providers/Microsoft.Network/privateDnsZones/test-private-dns-zone.postgres.database.azure.com",
},
ResourceGroupName = "testrg",
ServerName = "pgtestsvc4",
Sku = new AzureNative.DBforPostgreSQL.Inputs.SkuArgs
{
Name = "Standard_D4s_v3",
Tier = AzureNative.DBforPostgreSQL.SkuTier.GeneralPurpose,
},
Storage = new AzureNative.DBforPostgreSQL.Inputs.StorageArgs
{
AutoGrow = AzureNative.DBforPostgreSQL.StorageAutoGrow.Disabled,
StorageSizeGB = 512,
Tier = AzureNative.DBforPostgreSQL.AzureManagedDiskPerformanceTiers.P20,
},
Tags =
{
{ "ElasticServer", "1" },
},
Version = AzureNative.DBforPostgreSQL.ServerVersion.ServerVersion_12,
});
});
package main
import (
dbforpostgresql "github.com/pulumi/pulumi-azure-native-sdk/dbforpostgresql/v3"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := dbforpostgresql.NewServer(ctx, "server", &dbforpostgresql.ServerArgs{
AdministratorLogin: pulumi.String("cloudsa"),
AdministratorLoginPassword: pulumi.String("password"),
AvailabilityZone: pulumi.String("1"),
Backup: &dbforpostgresql.BackupTypeArgs{
BackupRetentionDays: pulumi.Int(7),
GeoRedundantBackup: pulumi.String(dbforpostgresql.GeoRedundantBackupEnumDisabled),
},
CreateMode: pulumi.String(dbforpostgresql.CreateModeCreate),
HighAvailability: &dbforpostgresql.HighAvailabilityArgs{
Mode: pulumi.String(dbforpostgresql.HighAvailabilityModeZoneRedundant),
},
Location: pulumi.String("westus"),
Network: &dbforpostgresql.NetworkArgs{
DelegatedSubnetResourceId: pulumi.String("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/test-vnet-subnet"),
PrivateDnsZoneArmResourceId: pulumi.String("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourcegroups/testrg/providers/Microsoft.Network/privateDnsZones/test-private-dns-zone.postgres.database.azure.com"),
},
ResourceGroupName: pulumi.String("testrg"),
ServerName: pulumi.String("pgtestsvc4"),
Sku: &dbforpostgresql.SkuArgs{
Name: pulumi.String("Standard_D4s_v3"),
Tier: pulumi.String(dbforpostgresql.SkuTierGeneralPurpose),
},
Storage: &dbforpostgresql.StorageArgs{
AutoGrow: pulumi.String(dbforpostgresql.StorageAutoGrowDisabled),
StorageSizeGB: pulumi.Int(512),
Tier: pulumi.String(dbforpostgresql.AzureManagedDiskPerformanceTiersP20),
},
Tags: pulumi.StringMap{
"ElasticServer": pulumi.String("1"),
},
Version: pulumi.String(dbforpostgresql.ServerVersion_12),
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azurenative.dbforpostgresql.Server;
import com.pulumi.azurenative.dbforpostgresql.ServerArgs;
import com.pulumi.azurenative.dbforpostgresql.inputs.BackupArgs;
import com.pulumi.azurenative.dbforpostgresql.inputs.HighAvailabilityArgs;
import com.pulumi.azurenative.dbforpostgresql.inputs.NetworkArgs;
import com.pulumi.azurenative.dbforpostgresql.inputs.SkuArgs;
import com.pulumi.azurenative.dbforpostgresql.inputs.StorageArgs;
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 server = new Server("server", ServerArgs.builder()
.administratorLogin("cloudsa")
.administratorLoginPassword("password")
.availabilityZone("1")
.backup(BackupArgs.builder()
.backupRetentionDays(7)
.geoRedundantBackup("Disabled")
.build())
.createMode("Create")
.highAvailability(HighAvailabilityArgs.builder()
.mode("ZoneRedundant")
.build())
.location("westus")
.network(NetworkArgs.builder()
.delegatedSubnetResourceId("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/test-vnet-subnet")
.privateDnsZoneArmResourceId("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourcegroups/testrg/providers/Microsoft.Network/privateDnsZones/test-private-dns-zone.postgres.database.azure.com")
.build())
.resourceGroupName("testrg")
.serverName("pgtestsvc4")
.sku(SkuArgs.builder()
.name("Standard_D4s_v3")
.tier("GeneralPurpose")
.build())
.storage(StorageArgs.builder()
.autoGrow("Disabled")
.storageSizeGB(512)
.tier("P20")
.build())
.tags(Map.of("ElasticServer", "1"))
.version("12")
.build());
}
}

Create a new server with active directory authentication enabled

using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AzureNative = Pulumi.AzureNative;
return await Deployment.RunAsync(() =>
{
var server = new AzureNative.DBforPostgreSQL.Server("server", new()
{
AdministratorLogin = "cloudsa",
AdministratorLoginPassword = "password",
AuthConfig = new AzureNative.DBforPostgreSQL.Inputs.AuthConfigArgs
{
ActiveDirectoryAuth = AzureNative.DBforPostgreSQL.ActiveDirectoryAuthEnum.Enabled,
PasswordAuth = AzureNative.DBforPostgreSQL.PasswordAuthEnum.Enabled,
TenantId = "tttttt-tttt-tttt-tttt-tttttttttttt",
},
AvailabilityZone = "1",
Backup = new AzureNative.DBforPostgreSQL.Inputs.BackupArgs
{
BackupRetentionDays = 7,
GeoRedundantBackup = AzureNative.DBforPostgreSQL.GeoRedundantBackupEnum.Disabled,
},
CreateMode = AzureNative.DBforPostgreSQL.CreateMode.Create,
DataEncryption = new AzureNative.DBforPostgreSQL.Inputs.DataEncryptionArgs
{
Type = AzureNative.DBforPostgreSQL.ArmServerKeyType.SystemManaged,
},
HighAvailability = new AzureNative.DBforPostgreSQL.Inputs.HighAvailabilityArgs
{
Mode = AzureNative.DBforPostgreSQL.HighAvailabilityMode.ZoneRedundant,
},
Location = "westus",
Network = new AzureNative.DBforPostgreSQL.Inputs.NetworkArgs
{
DelegatedSubnetResourceId = "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/test-vnet-subnet",
PrivateDnsZoneArmResourceId = "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourcegroups/testrg/providers/Microsoft.Network/privateDnsZones/test-private-dns-zone.postgres.database.azure.com",
},
ResourceGroupName = "testrg",
ServerName = "pgtestsvc4",
Sku = new AzureNative.DBforPostgreSQL.Inputs.SkuArgs
{
Name = "Standard_D4s_v3",
Tier = AzureNative.DBforPostgreSQL.SkuTier.GeneralPurpose,
},
Storage = new AzureNative.DBforPostgreSQL.Inputs.StorageArgs
{
AutoGrow = AzureNative.DBforPostgreSQL.StorageAutoGrow.Disabled,
StorageSizeGB = 512,
Tier = AzureNative.DBforPostgreSQL.AzureManagedDiskPerformanceTiers.P20,
},
Tags =
{
{ "ElasticServer", "1" },
},
Version = AzureNative.DBforPostgreSQL.ServerVersion.ServerVersion_12,
});
});
package main
import (
dbforpostgresql "github.com/pulumi/pulumi-azure-native-sdk/dbforpostgresql/v3"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := dbforpostgresql.NewServer(ctx, "server", &dbforpostgresql.ServerArgs{
AdministratorLogin: pulumi.String("cloudsa"),
AdministratorLoginPassword: pulumi.String("password"),
AuthConfig: &dbforpostgresql.AuthConfigArgs{
ActiveDirectoryAuth: pulumi.String(dbforpostgresql.ActiveDirectoryAuthEnumEnabled),
PasswordAuth: pulumi.String(dbforpostgresql.PasswordAuthEnumEnabled),
TenantId: pulumi.String("tttttt-tttt-tttt-tttt-tttttttttttt"),
},
AvailabilityZone: pulumi.String("1"),
Backup: &dbforpostgresql.BackupTypeArgs{
BackupRetentionDays: pulumi.Int(7),
GeoRedundantBackup: pulumi.String(dbforpostgresql.GeoRedundantBackupEnumDisabled),
},
CreateMode: pulumi.String(dbforpostgresql.CreateModeCreate),
DataEncryption: &dbforpostgresql.DataEncryptionArgs{
Type: pulumi.String(dbforpostgresql.ArmServerKeyTypeSystemManaged),
},
HighAvailability: &dbforpostgresql.HighAvailabilityArgs{
Mode: pulumi.String(dbforpostgresql.HighAvailabilityModeZoneRedundant),
},
Location: pulumi.String("westus"),
Network: &dbforpostgresql.NetworkArgs{
DelegatedSubnetResourceId: pulumi.String("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/test-vnet-subnet"),
PrivateDnsZoneArmResourceId: pulumi.String("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourcegroups/testrg/providers/Microsoft.Network/privateDnsZones/test-private-dns-zone.postgres.database.azure.com"),
},
ResourceGroupName: pulumi.String("testrg"),
ServerName: pulumi.String("pgtestsvc4"),
Sku: &dbforpostgresql.SkuArgs{
Name: pulumi.String("Standard_D4s_v3"),
Tier: pulumi.String(dbforpostgresql.SkuTierGeneralPurpose),
},
Storage: &dbforpostgresql.StorageArgs{
AutoGrow: pulumi.String(dbforpostgresql.StorageAutoGrowDisabled),
StorageSizeGB: pulumi.Int(512),
Tier: pulumi.String(dbforpostgresql.AzureManagedDiskPerformanceTiersP20),
},
Tags: pulumi.StringMap{
"ElasticServer": pulumi.String("1"),
},
Version: pulumi.String(dbforpostgresql.ServerVersion_12),
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azurenative.dbforpostgresql.Server;
import com.pulumi.azurenative.dbforpostgresql.ServerArgs;
import com.pulumi.azurenative.dbforpostgresql.inputs.AuthConfigArgs;
import com.pulumi.azurenative.dbforpostgresql.inputs.BackupArgs;
import com.pulumi.azurenative.dbforpostgresql.inputs.DataEncryptionArgs;
import com.pulumi.azurenative.dbforpostgresql.inputs.HighAvailabilityArgs;
import com.pulumi.azurenative.dbforpostgresql.inputs.NetworkArgs;
import com.pulumi.azurenative.dbforpostgresql.inputs.SkuArgs;
import com.pulumi.azurenative.dbforpostgresql.inputs.StorageArgs;
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 server = new Server("server", ServerArgs.builder()
.administratorLogin("cloudsa")
.administratorLoginPassword("password")
.authConfig(AuthConfigArgs.builder()
.activeDirectoryAuth("Enabled")
.passwordAuth("Enabled")
.tenantId("tttttt-tttt-tttt-tttt-tttttttttttt")
.build())
.availabilityZone("1")
.backup(BackupArgs.builder()
.backupRetentionDays(7)
.geoRedundantBackup("Disabled")
.build())
.createMode("Create")
.dataEncryption(DataEncryptionArgs.builder()
.type("SystemManaged")
.build())
.highAvailability(HighAvailabilityArgs.builder()
.mode("ZoneRedundant")
.build())
.location("westus")
.network(NetworkArgs.builder()
.delegatedSubnetResourceId("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/test-vnet-subnet")
.privateDnsZoneArmResourceId("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourcegroups/testrg/providers/Microsoft.Network/privateDnsZones/test-private-dns-zone.postgres.database.azure.com")
.build())
.resourceGroupName("testrg")
.serverName("pgtestsvc4")
.sku(SkuArgs.builder()
.name("Standard_D4s_v3")
.tier("GeneralPurpose")
.build())
.storage(StorageArgs.builder()
.autoGrow("Disabled")
.storageSizeGB(512)
.tier("P20")
.build())
.tags(Map.of("ElasticServer", "1"))
.version("12")
.build());
}
}

ServerCreateReplica

using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AzureNative = Pulumi.AzureNative;
return await Deployment.RunAsync(() =>
{
var server = new AzureNative.DBforPostgreSQL.Server("server", new()
{
CreateMode = AzureNative.DBforPostgreSQL.CreateMode.Replica,
DataEncryption = new AzureNative.DBforPostgreSQL.Inputs.DataEncryptionArgs
{
GeoBackupKeyURI = "",
GeoBackupUserAssignedIdentityId = "",
PrimaryKeyURI = "https://test-kv.vault.azure.net/keys/test-key1/77f57315bab34b0189daa113fbc78787",
PrimaryUserAssignedIdentityId = "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-usermanagedidentity",
Type = AzureNative.DBforPostgreSQL.ArmServerKeyType.AzureKeyVault,
},
Identity = new AzureNative.DBforPostgreSQL.Inputs.UserAssignedIdentityArgs
{
Type = AzureNative.DBforPostgreSQL.IdentityType.UserAssigned,
UserAssignedIdentities =
{
{ "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-usermanagedidentity", null },
},
},
Location = "westus",
PointInTimeUTC = "2021-06-27T00:04:59.4078005+00:00",
ResourceGroupName = "testrg",
ServerName = "pgtestsvc5rep",
SourceServerResourceId = "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforPostgreSQL/flexibleServers/sourcepgservername",
});
});
package main
import (
dbforpostgresql "github.com/pulumi/pulumi-azure-native-sdk/dbforpostgresql/v3"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := dbforpostgresql.NewServer(ctx, "server", &dbforpostgresql.ServerArgs{
CreateMode: pulumi.String(dbforpostgresql.CreateModeReplica),
DataEncryption: &dbforpostgresql.DataEncryptionArgs{
GeoBackupKeyURI: pulumi.String(""),
GeoBackupUserAssignedIdentityId: pulumi.String(""),
PrimaryKeyURI: pulumi.String("https://test-kv.vault.azure.net/keys/test-key1/77f57315bab34b0189daa113fbc78787"),
PrimaryUserAssignedIdentityId: pulumi.String("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-usermanagedidentity"),
Type: pulumi.String(dbforpostgresql.ArmServerKeyTypeAzureKeyVault),
},
Identity: &dbforpostgresql.UserAssignedIdentityArgs{
Type: pulumi.String(dbforpostgresql.IdentityTypeUserAssigned),
UserAssignedIdentities: dbforpostgresql.UserIdentityMap{
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-usermanagedidentity": &dbforpostgresql.UserIdentityArgs{},
},
},
Location: pulumi.String("westus"),
PointInTimeUTC: pulumi.String("2021-06-27T00:04:59.4078005+00:00"),
ResourceGroupName: pulumi.String("testrg"),
ServerName: pulumi.String("pgtestsvc5rep"),
SourceServerResourceId: pulumi.String("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforPostgreSQL/flexibleServers/sourcepgservername"),
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azurenative.dbforpostgresql.Server;
import com.pulumi.azurenative.dbforpostgresql.ServerArgs;
import com.pulumi.azurenative.dbforpostgresql.inputs.DataEncryptionArgs;
import com.pulumi.azurenative.dbforpostgresql.inputs.UserAssignedIdentityArgs;
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 server = new Server("server", ServerArgs.builder()
.createMode("Replica")
.dataEncryption(DataEncryptionArgs.builder()
.geoBackupKeyURI("")
.geoBackupUserAssignedIdentityId("")
.primaryKeyURI("https://test-kv.vault.azure.net/keys/test-key1/77f57315bab34b0189daa113fbc78787")
.primaryUserAssignedIdentityId("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-usermanagedidentity")
.type("AzureKeyVault")
.build())
.identity(UserAssignedIdentityArgs.builder()
.type("UserAssigned")
.userAssignedIdentities(Map.of("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-usermanagedidentity", UserIdentityArgs.builder()
.build()))
.build())
.location("westus")
.pointInTimeUTC("2021-06-27T00:04:59.4078005+00:00")
.resourceGroupName("testrg")
.serverName("pgtestsvc5rep")
.sourceServerResourceId("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforPostgreSQL/flexibleServers/sourcepgservername")
.build());
}
}

ServerCreateReviveDropped

using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AzureNative = Pulumi.AzureNative;
return await Deployment.RunAsync(() =>
{
var server = new AzureNative.DBforPostgreSQL.Server("server", new()
{
CreateMode = AzureNative.DBforPostgreSQL.CreateMode.ReviveDropped,
Location = "westus",
PointInTimeUTC = "2023-04-27T00:04:59.4078005+00:00",
ResourceGroupName = "testrg",
ServerName = "pgtestsvc5-rev",
SourceServerResourceId = "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforPostgreSQL/flexibleServers/pgtestsvc5",
});
});
package main
import (
dbforpostgresql "github.com/pulumi/pulumi-azure-native-sdk/dbforpostgresql/v3"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := dbforpostgresql.NewServer(ctx, "server", &dbforpostgresql.ServerArgs{
CreateMode: pulumi.String(dbforpostgresql.CreateModeReviveDropped),
Location: pulumi.String("westus"),
PointInTimeUTC: pulumi.String("2023-04-27T00:04:59.4078005+00:00"),
ResourceGroupName: pulumi.String("testrg"),
ServerName: pulumi.String("pgtestsvc5-rev"),
SourceServerResourceId: pulumi.String("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforPostgreSQL/flexibleServers/pgtestsvc5"),
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azurenative.dbforpostgresql.Server;
import com.pulumi.azurenative.dbforpostgresql.ServerArgs;
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 server = new Server("server", ServerArgs.builder()
.createMode("ReviveDropped")
.location("westus")
.pointInTimeUTC("2023-04-27T00:04:59.4078005+00:00")
.resourceGroupName("testrg")
.serverName("pgtestsvc5-rev")
.sourceServerResourceId("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforPostgreSQL/flexibleServers/pgtestsvc5")
.build());
}
}

ServerCreateWithDataEncryptionEnabled

using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AzureNative = Pulumi.AzureNative;
return await Deployment.RunAsync(() =>
{
var server = new AzureNative.DBforPostgreSQL.Server("server", new()
{
AdministratorLogin = "cloudsa",
AdministratorLoginPassword = "password",
AvailabilityZone = "1",
Backup = new AzureNative.DBforPostgreSQL.Inputs.BackupArgs
{
BackupRetentionDays = 7,
GeoRedundantBackup = AzureNative.DBforPostgreSQL.GeoRedundantBackupEnum.Disabled,
},
CreateMode = AzureNative.DBforPostgreSQL.CreateMode.Create,
DataEncryption = new AzureNative.DBforPostgreSQL.Inputs.DataEncryptionArgs
{
GeoBackupKeyURI = "",
GeoBackupUserAssignedIdentityId = "",
PrimaryKeyURI = "https://test-kv.vault.azure.net/keys/test-key1/77f57315bab34b0189daa113fbc78787",
PrimaryUserAssignedIdentityId = "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-usermanagedidentity",
Type = AzureNative.DBforPostgreSQL.ArmServerKeyType.AzureKeyVault,
},
HighAvailability = new AzureNative.DBforPostgreSQL.Inputs.HighAvailabilityArgs
{
Mode = AzureNative.DBforPostgreSQL.HighAvailabilityMode.ZoneRedundant,
},
Identity = new AzureNative.DBforPostgreSQL.Inputs.UserAssignedIdentityArgs
{
Type = AzureNative.DBforPostgreSQL.IdentityType.UserAssigned,
UserAssignedIdentities =
{
{ "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-usermanagedidentity", null },
},
},
Location = "westus",
Network = new AzureNative.DBforPostgreSQL.Inputs.NetworkArgs
{
DelegatedSubnetResourceId = "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/test-vnet-subnet",
PrivateDnsZoneArmResourceId = "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourcegroups/testrg/providers/Microsoft.Network/privateDnsZones/test-private-dns-zone.postgres.database.azure.com",
},
ResourceGroupName = "testrg",
ServerName = "pgtestsvc4",
Sku = new AzureNative.DBforPostgreSQL.Inputs.SkuArgs
{
Name = "Standard_D4s_v3",
Tier = AzureNative.DBforPostgreSQL.SkuTier.GeneralPurpose,
},
Storage = new AzureNative.DBforPostgreSQL.Inputs.StorageArgs
{
AutoGrow = AzureNative.DBforPostgreSQL.StorageAutoGrow.Disabled,
StorageSizeGB = 512,
},
Tags =
{
{ "ElasticServer", "1" },
},
Version = AzureNative.DBforPostgreSQL.ServerVersion.ServerVersion_12,
});
});
package main
import (
dbforpostgresql "github.com/pulumi/pulumi-azure-native-sdk/dbforpostgresql/v3"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := dbforpostgresql.NewServer(ctx, "server", &dbforpostgresql.ServerArgs{
AdministratorLogin: pulumi.String("cloudsa"),
AdministratorLoginPassword: pulumi.String("password"),
AvailabilityZone: pulumi.String("1"),
Backup: &dbforpostgresql.BackupTypeArgs{
BackupRetentionDays: pulumi.Int(7),
GeoRedundantBackup: pulumi.String(dbforpostgresql.GeoRedundantBackupEnumDisabled),
},
CreateMode: pulumi.String(dbforpostgresql.CreateModeCreate),
DataEncryption: &dbforpostgresql.DataEncryptionArgs{
GeoBackupKeyURI: pulumi.String(""),
GeoBackupUserAssignedIdentityId: pulumi.String(""),
PrimaryKeyURI: pulumi.String("https://test-kv.vault.azure.net/keys/test-key1/77f57315bab34b0189daa113fbc78787"),
PrimaryUserAssignedIdentityId: pulumi.String("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-usermanagedidentity"),
Type: pulumi.String(dbforpostgresql.ArmServerKeyTypeAzureKeyVault),
},
HighAvailability: &dbforpostgresql.HighAvailabilityArgs{
Mode: pulumi.String(dbforpostgresql.HighAvailabilityModeZoneRedundant),
},
Identity: &dbforpostgresql.UserAssignedIdentityArgs{
Type: pulumi.String(dbforpostgresql.IdentityTypeUserAssigned),
UserAssignedIdentities: dbforpostgresql.UserIdentityMap{
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-usermanagedidentity": &dbforpostgresql.UserIdentityArgs{},
},
},
Location: pulumi.String("westus"),
Network: &dbforpostgresql.NetworkArgs{
DelegatedSubnetResourceId: pulumi.String("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/test-vnet-subnet"),
PrivateDnsZoneArmResourceId: pulumi.String("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourcegroups/testrg/providers/Microsoft.Network/privateDnsZones/test-private-dns-zone.postgres.database.azure.com"),
},
ResourceGroupName: pulumi.String("testrg"),
ServerName: pulumi.String("pgtestsvc4"),
Sku: &dbforpostgresql.SkuArgs{
Name: pulumi.String("Standard_D4s_v3"),
Tier: pulumi.String(dbforpostgresql.SkuTierGeneralPurpose),
},
Storage: &dbforpostgresql.StorageArgs{
AutoGrow: pulumi.String(dbforpostgresql.StorageAutoGrowDisabled),
StorageSizeGB: pulumi.Int(512),
},
Tags: pulumi.StringMap{
"ElasticServer": pulumi.String("1"),
},
Version: pulumi.String(dbforpostgresql.ServerVersion_12),
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azurenative.dbforpostgresql.Server;
import com.pulumi.azurenative.dbforpostgresql.ServerArgs;
import com.pulumi.azurenative.dbforpostgresql.inputs.BackupArgs;
import com.pulumi.azurenative.dbforpostgresql.inputs.DataEncryptionArgs;
import com.pulumi.azurenative.dbforpostgresql.inputs.HighAvailabilityArgs;
import com.pulumi.azurenative.dbforpostgresql.inputs.UserAssignedIdentityArgs;
import com.pulumi.azurenative.dbforpostgresql.inputs.NetworkArgs;
import com.pulumi.azurenative.dbforpostgresql.inputs.SkuArgs;
import com.pulumi.azurenative.dbforpostgresql.inputs.StorageArgs;
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 server = new Server("server", ServerArgs.builder()
.administratorLogin("cloudsa")
.administratorLoginPassword("password")
.availabilityZone("1")
.backup(BackupArgs.builder()
.backupRetentionDays(7)
.geoRedundantBackup("Disabled")
.build())
.createMode("Create")
.dataEncryption(DataEncryptionArgs.builder()
.geoBackupKeyURI("")
.geoBackupUserAssignedIdentityId("")
.primaryKeyURI("https://test-kv.vault.azure.net/keys/test-key1/77f57315bab34b0189daa113fbc78787")
.primaryUserAssignedIdentityId("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-usermanagedidentity")
.type("AzureKeyVault")
.build())
.highAvailability(HighAvailabilityArgs.builder()
.mode("ZoneRedundant")
.build())
.identity(UserAssignedIdentityArgs.builder()
.type("UserAssigned")
.userAssignedIdentities(Map.of("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-usermanagedidentity", UserIdentityArgs.builder()
.build()))
.build())
.location("westus")
.network(NetworkArgs.builder()
.delegatedSubnetResourceId("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/test-vnet-subnet")
.privateDnsZoneArmResourceId("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourcegroups/testrg/providers/Microsoft.Network/privateDnsZones/test-private-dns-zone.postgres.database.azure.com")
.build())
.resourceGroupName("testrg")
.serverName("pgtestsvc4")
.sku(SkuArgs.builder()
.name("Standard_D4s_v3")
.tier("GeneralPurpose")
.build())
.storage(StorageArgs.builder()
.autoGrow("Disabled")
.storageSizeGB(512)
.build())
.tags(Map.of("ElasticServer", "1"))
.version("12")
.build());
}
}

Import

An existing resource can be imported using its type token, name, and identifier, e.g.

$ pulumi import azure-native:dbforpostgresql:Server pgtestsvc4 /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}

Properties

Link copied to clipboard

The administrator's login name of a server. Can only be specified when the server is being created (and is required for creation).

Link copied to clipboard

AuthConfig properties of a server.

Link copied to clipboard
val availabilityZone: Output<String>?

availability zone information of the server.

Link copied to clipboard
val azureApiVersion: Output<String>

The Azure API version of the resource.

Link copied to clipboard
val backup: Output<BackupResponse>?

Backup properties of a server.

Link copied to clipboard

Data encryption properties of a server.

Link copied to clipboard

The fully qualified domain name of a server.

Link copied to clipboard

High availability properties of a server.

Link copied to clipboard
val id: Output<String>
Link copied to clipboard

Describes the identity of the application.

Link copied to clipboard
val location: Output<String>

The geo-location where the resource lives

Link copied to clipboard

Maintenance window properties of a server.

Link copied to clipboard
val minorVersion: Output<String>

The minor version of the server.

Link copied to clipboard
val name: Output<String>

The name of the resource

Link copied to clipboard
val network: Output<NetworkResponse>?

Network properties of a server. This Network property is required to be passed only in case you want the server to be Private access server.

Link copied to clipboard

List of private endpoint connections associated with the specified resource.

Link copied to clipboard
val pulumiChildResources: Set<KotlinResource>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val replica: Output<ReplicaResponse>?

Replica properties of a server. These Replica properties are required to be passed only in case you want to Promote a server.

Link copied to clipboard
val replicaCapacity: Output<Int>

Replicas allowed for a server.

Link copied to clipboard
val replicationRole: Output<String>?

Replication role of the server

Link copied to clipboard
val sku: Output<SkuResponse>?

The SKU (pricing tier) of the server.

Link copied to clipboard

The source server resource ID to restore from. It's required when 'createMode' is 'PointInTimeRestore' or 'GeoRestore' or 'Replica' or 'ReviveDropped'. This property is returned only for Replica server

Link copied to clipboard
val state: Output<String>

A state of a server that is visible to user.

Link copied to clipboard
val storage: Output<StorageResponse>?

Storage properties of a server.

Link copied to clipboard

Azure Resource Manager metadata containing createdBy and modifiedBy information.

Link copied to clipboard
val tags: Output<Map<String, String>>?

Resource tags.

Link copied to clipboard
val type: Output<String>

The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"

Link copied to clipboard
val urn: Output<String>
Link copied to clipboard
val version: Output<String>?

PostgreSQL Server version.