Single Server
Represents a server. Uses Azure REST API version 2017-12-01.
Example Usage
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 singleServer = new AzureNative.DBforPostgreSQL.SingleServer("singleServer", new()
{
Location = "brazilsouth",
Properties = new AzureNative.DBforPostgreSQL.Inputs.ServerPropertiesForRestoreArgs
{
CreateMode = "PointInTimeRestore",
RestorePointInTime = "2017-12-14T00:00:37.467Z",
SourceServerId = "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/SourceResourceGroup/providers/Microsoft.DBforPostgreSQL/servers/sourceserver",
},
ResourceGroupName = "TargetResourceGroup",
ServerName = "targetserver",
Sku = new AzureNative.DBforPostgreSQL.Inputs.SingleServerSkuArgs
{
Capacity = 2,
Family = "Gen5",
Name = "B_Gen5_2",
Tier = AzureNative.DBforPostgreSQL.SingleServerSkuTier.Basic,
},
Tags =
{
{ "ElasticServer", "1" },
},
});
});
package main
import (
dbforpostgresql "github.com/pulumi/pulumi-azure-native-sdk/dbforpostgresql/v2"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := dbforpostgresql.NewSingleServer(ctx, "singleServer", &dbforpostgresql.SingleServerArgs{
Location: pulumi.String("brazilsouth"),
Properties: &dbforpostgresql.ServerPropertiesForRestoreArgs{
CreateMode: pulumi.String("PointInTimeRestore"),
RestorePointInTime: pulumi.String("2017-12-14T00:00:37.467Z"),
SourceServerId: pulumi.String("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/SourceResourceGroup/providers/Microsoft.DBforPostgreSQL/servers/sourceserver"),
},
ResourceGroupName: pulumi.String("TargetResourceGroup"),
ServerName: pulumi.String("targetserver"),
Sku: &dbforpostgresql.SingleServerSkuArgs{
Capacity: pulumi.Int(2),
Family: pulumi.String("Gen5"),
Name: pulumi.String("B_Gen5_2"),
Tier: pulumi.String(dbforpostgresql.SingleServerSkuTierBasic),
},
Tags: pulumi.StringMap{
"ElasticServer": pulumi.String("1"),
},
})
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.SingleServer;
import com.pulumi.azurenative.dbforpostgresql.SingleServerArgs;
import com.pulumi.azurenative.dbforpostgresql.inputs.SingleServerSkuArgs;
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 singleServer = new SingleServer("singleServer", SingleServerArgs.builder()
.location("brazilsouth")
.properties(ServerPropertiesForDefaultCreateArgs.builder()
.createMode("PointInTimeRestore")
.restorePointInTime("2017-12-14T00:00:37.467Z")
.sourceServerId("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/SourceResourceGroup/providers/Microsoft.DBforPostgreSQL/servers/sourceserver")
.build())
.resourceGroupName("TargetResourceGroup")
.serverName("targetserver")
.sku(SingleServerSkuArgs.builder()
.capacity(2)
.family("Gen5")
.name("B_Gen5_2")
.tier("Basic")
.build())
.tags(Map.of("ElasticServer", "1"))
.build());
}
}
Create a new server
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AzureNative = Pulumi.AzureNative;
return await Deployment.RunAsync(() =>
{
var singleServer = new AzureNative.DBforPostgreSQL.SingleServer("singleServer", new()
{
Location = "westus",
Properties = new AzureNative.DBforPostgreSQL.Inputs.ServerPropertiesForDefaultCreateArgs
{
AdministratorLogin = "cloudsa",
AdministratorLoginPassword = "<administratorLoginPassword>",
CreateMode = "Default",
MinimalTlsVersion = AzureNative.DBforPostgreSQL.MinimalTlsVersionEnum.TLS1_2,
SslEnforcement = AzureNative.DBforPostgreSQL.SslEnforcementEnum.Enabled,
StorageProfile = new AzureNative.DBforPostgreSQL.Inputs.StorageProfileArgs
{
BackupRetentionDays = 7,
GeoRedundantBackup = AzureNative.DBforPostgreSQL.GeoRedundantBackup.Disabled,
StorageMB = 128000,
},
},
ResourceGroupName = "TestGroup",
ServerName = "pgtestsvc4",
Sku = new AzureNative.DBforPostgreSQL.Inputs.SingleServerSkuArgs
{
Capacity = 2,
Family = "Gen5",
Name = "B_Gen5_2",
Tier = AzureNative.DBforPostgreSQL.SingleServerSkuTier.Basic,
},
Tags =
{
{ "ElasticServer", "1" },
},
});
});
package main
import (
dbforpostgresql "github.com/pulumi/pulumi-azure-native-sdk/dbforpostgresql/v2"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := dbforpostgresql.NewSingleServer(ctx, "singleServer", &dbforpostgresql.SingleServerArgs{
Location: pulumi.String("westus"),
Properties: &dbforpostgresql.ServerPropertiesForDefaultCreateArgs{
AdministratorLogin: pulumi.String("cloudsa"),
AdministratorLoginPassword: pulumi.String("<administratorLoginPassword>"),
CreateMode: pulumi.String("Default"),
MinimalTlsVersion: pulumi.String(dbforpostgresql.MinimalTlsVersionEnum_TLS1_2),
SslEnforcement: dbforpostgresql.SslEnforcementEnumEnabled,
StorageProfile: &dbforpostgresql.StorageProfileArgs{
BackupRetentionDays: pulumi.Int(7),
GeoRedundantBackup: pulumi.String(dbforpostgresql.GeoRedundantBackupDisabled),
StorageMB: pulumi.Int(128000),
},
},
ResourceGroupName: pulumi.String("TestGroup"),
ServerName: pulumi.String("pgtestsvc4"),
Sku: &dbforpostgresql.SingleServerSkuArgs{
Capacity: pulumi.Int(2),
Family: pulumi.String("Gen5"),
Name: pulumi.String("B_Gen5_2"),
Tier: pulumi.String(dbforpostgresql.SingleServerSkuTierBasic),
},
Tags: pulumi.StringMap{
"ElasticServer": pulumi.String("1"),
},
})
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.SingleServer;
import com.pulumi.azurenative.dbforpostgresql.SingleServerArgs;
import com.pulumi.azurenative.dbforpostgresql.inputs.SingleServerSkuArgs;
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 singleServer = new SingleServer("singleServer", SingleServerArgs.builder()
.location("westus")
.properties(ServerPropertiesForDefaultCreateArgs.builder()
.administratorLogin("cloudsa")
.administratorLoginPassword("<administratorLoginPassword>")
.createMode("Default")
.minimalTlsVersion("TLS1_2")
.sslEnforcement("Enabled")
.storageProfile(StorageProfileArgs.builder()
.backupRetentionDays(7)
.geoRedundantBackup("Disabled")
.storageMB(128000)
.build())
.build())
.resourceGroupName("TestGroup")
.serverName("pgtestsvc4")
.sku(SingleServerSkuArgs.builder()
.capacity(2)
.family("Gen5")
.name("B_Gen5_2")
.tier("Basic")
.build())
.tags(Map.of("ElasticServer", "1"))
.build());
}
}
Create a replica server
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AzureNative = Pulumi.AzureNative;
return await Deployment.RunAsync(() =>
{
var singleServer = new AzureNative.DBforPostgreSQL.SingleServer("singleServer", new()
{
Location = "westcentralus",
Properties = new AzureNative.DBforPostgreSQL.Inputs.ServerPropertiesForReplicaArgs
{
CreateMode = "Replica",
SourceServerId = "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup_WestCentralUS/providers/Microsoft.DBforPostgreSQL/servers/testserver-master",
},
ResourceGroupName = "TestGroup_WestCentralUS",
ServerName = "testserver-replica1",
Sku = new AzureNative.DBforPostgreSQL.Inputs.SingleServerSkuArgs
{
Capacity = 2,
Family = "Gen5",
Name = "GP_Gen5_2",
Tier = AzureNative.DBforPostgreSQL.SingleServerSkuTier.GeneralPurpose,
},
});
});
package main
import (
dbforpostgresql "github.com/pulumi/pulumi-azure-native-sdk/dbforpostgresql/v2"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := dbforpostgresql.NewSingleServer(ctx, "singleServer", &dbforpostgresql.SingleServerArgs{
Location: pulumi.String("westcentralus"),
Properties: &dbforpostgresql.ServerPropertiesForReplicaArgs{
CreateMode: pulumi.String("Replica"),
SourceServerId: pulumi.String("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup_WestCentralUS/providers/Microsoft.DBforPostgreSQL/servers/testserver-master"),
},
ResourceGroupName: pulumi.String("TestGroup_WestCentralUS"),
ServerName: pulumi.String("testserver-replica1"),
Sku: &dbforpostgresql.SingleServerSkuArgs{
Capacity: pulumi.Int(2),
Family: pulumi.String("Gen5"),
Name: pulumi.String("GP_Gen5_2"),
Tier: pulumi.String(dbforpostgresql.SingleServerSkuTierGeneralPurpose),
},
})
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.SingleServer;
import com.pulumi.azurenative.dbforpostgresql.SingleServerArgs;
import com.pulumi.azurenative.dbforpostgresql.inputs.SingleServerSkuArgs;
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 singleServer = new SingleServer("singleServer", SingleServerArgs.builder()
.location("westcentralus")
.properties(ServerPropertiesForReplicaArgs.builder()
.createMode("Replica")
.sourceServerId("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup_WestCentralUS/providers/Microsoft.DBforPostgreSQL/servers/testserver-master")
.build())
.resourceGroupName("TestGroup_WestCentralUS")
.serverName("testserver-replica1")
.sku(SingleServerSkuArgs.builder()
.capacity(2)
.family("Gen5")
.name("GP_Gen5_2")
.tier("GeneralPurpose")
.build())
.build());
}
}
Create a server as a geo restore
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AzureNative = Pulumi.AzureNative;
return await Deployment.RunAsync(() =>
{
var singleServer = new AzureNative.DBforPostgreSQL.SingleServer("singleServer", new()
{
Location = "westus",
Properties = new AzureNative.DBforPostgreSQL.Inputs.ServerPropertiesForGeoRestoreArgs
{
CreateMode = "GeoRestore",
SourceServerId = "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/SourceResourceGroup/providers/Microsoft.DBforPostgreSQL/servers/sourceserver",
},
ResourceGroupName = "TargetResourceGroup",
ServerName = "targetserver",
Sku = new AzureNative.DBforPostgreSQL.Inputs.SingleServerSkuArgs
{
Capacity = 2,
Family = "Gen5",
Name = "GP_Gen5_2",
Tier = AzureNative.DBforPostgreSQL.SingleServerSkuTier.GeneralPurpose,
},
Tags =
{
{ "ElasticServer", "1" },
},
});
});
package main
import (
dbforpostgresql "github.com/pulumi/pulumi-azure-native-sdk/dbforpostgresql/v2"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := dbforpostgresql.NewSingleServer(ctx, "singleServer", &dbforpostgresql.SingleServerArgs{
Location: pulumi.String("westus"),
Properties: &dbforpostgresql.ServerPropertiesForGeoRestoreArgs{
CreateMode: pulumi.String("GeoRestore"),
SourceServerId: pulumi.String("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/SourceResourceGroup/providers/Microsoft.DBforPostgreSQL/servers/sourceserver"),
},
ResourceGroupName: pulumi.String("TargetResourceGroup"),
ServerName: pulumi.String("targetserver"),
Sku: &dbforpostgresql.SingleServerSkuArgs{
Capacity: pulumi.Int(2),
Family: pulumi.String("Gen5"),
Name: pulumi.String("GP_Gen5_2"),
Tier: pulumi.String(dbforpostgresql.SingleServerSkuTierGeneralPurpose),
},
Tags: pulumi.StringMap{
"ElasticServer": pulumi.String("1"),
},
})
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.SingleServer;
import com.pulumi.azurenative.dbforpostgresql.SingleServerArgs;
import com.pulumi.azurenative.dbforpostgresql.inputs.SingleServerSkuArgs;
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 singleServer = new SingleServer("singleServer", SingleServerArgs.builder()
.location("westus")
.properties(ServerPropertiesForGeoRestoreArgs.builder()
.createMode("GeoRestore")
.sourceServerId("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/SourceResourceGroup/providers/Microsoft.DBforPostgreSQL/servers/sourceserver")
.build())
.resourceGroupName("TargetResourceGroup")
.serverName("targetserver")
.sku(SingleServerSkuArgs.builder()
.capacity(2)
.family("Gen5")
.name("GP_Gen5_2")
.tier("GeneralPurpose")
.build())
.tags(Map.of("ElasticServer", "1"))
.build());
}
}
Import
An existing resource can be imported using its type token, name, and identifier, e.g.
$ pulumi import azure-native:dbforpostgresql:SingleServer targetserver /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}
Properties
The administrator's login name of a server. Can only be specified when the server is being created (and is required for creation).
The Azure API version of the resource.
Status showing whether the server data encryption is enabled with customer-managed keys.
Earliest restore point creation time (ISO8601 format)
The fully qualified domain name of a server.
The Azure Active Directory identity of the server.
Status showing whether the server enabled infrastructure encryption.
The master server id of a replica server.
Enforce a minimal Tls version for the server.
List of private endpoint connections on a server
Whether or not public network access is allowed for this server. Value is optional but if passed in, must be 'Enabled' or 'Disabled'
The maximum number of replicas that a master server can have.
The replication role of the server.
The SKU (pricing tier) of the server.
Enable ssl enforcement or not when connect to server.
Storage profile of a server.
A state of a server that is visible to user.