Server
Represents a server. 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 server = new AzureNative.DBforPostgreSQL.Server("server", 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.SkuArgs
{
Capacity = 2,
Family = "Gen5",
Name = "B_Gen5_2",
Tier = "Basic",
},
Tags =
{
{ "ElasticServer", "1" },
},
});
});
package main
import (
dbforpostgresql "github.com/pulumi/pulumi-azure-native-sdk/dbforpostgresql"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := dbforpostgresql.NewServer(ctx, "server", &dbforpostgresql.ServerArgs{
Location: pulumi.String("brazilsouth"),
Properties: dbforpostgresql.ServerPropertiesForRestore{
CreateMode: "PointInTimeRestore",
RestorePointInTime: "2017-12-14T00:00:37.467Z",
SourceServerId: "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/SourceResourceGroup/providers/Microsoft.DBforPostgreSQL/servers/sourceserver",
},
ResourceGroupName: pulumi.String("TargetResourceGroup"),
ServerName: pulumi.String("targetserver"),
Sku: &dbforpostgresql.SkuArgs{
Capacity: pulumi.Int(2),
Family: pulumi.String("Gen5"),
Name: pulumi.String("B_Gen5_2"),
Tier: pulumi.String("Basic"),
},
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.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()
.location("brazilsouth")
.properties(Map.ofEntries(
Map.entry("createMode", "PointInTimeRestore"),
Map.entry("restorePointInTime", "2017-12-14T00:00:37.467Z"),
Map.entry("sourceServerId", "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/SourceResourceGroup/providers/Microsoft.DBforPostgreSQL/servers/sourceserver")
))
.resourceGroupName("TargetResourceGroup")
.serverName("targetserver")
.sku(Map.ofEntries(
Map.entry("capacity", 2),
Map.entry("family", "Gen5"),
Map.entry("name", "B_Gen5_2"),
Map.entry("tier", "Basic")
))
.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 server = new AzureNative.DBforPostgreSQL.Server("server", new()
{
Location = "westus",
Properties = new AzureNative.DBforPostgreSQL.Inputs.ServerPropertiesForDefaultCreateArgs
{
AdministratorLogin = "cloudsa",
AdministratorLoginPassword = "<administratorLoginPassword>",
CreateMode = "Default",
MinimalTlsVersion = "TLS1_2",
SslEnforcement = AzureNative.DBforPostgreSQL.SslEnforcementEnum.Enabled,
StorageProfile = new AzureNative.DBforPostgreSQL.Inputs.StorageProfileArgs
{
BackupRetentionDays = 7,
GeoRedundantBackup = "Disabled",
StorageMB = 128000,
},
},
ResourceGroupName = "TestGroup",
ServerName = "pgtestsvc4",
Sku = new AzureNative.DBforPostgreSQL.Inputs.SkuArgs
{
Capacity = 2,
Family = "Gen5",
Name = "B_Gen5_2",
Tier = "Basic",
},
Tags =
{
{ "ElasticServer", "1" },
},
});
});
package main
import (
dbforpostgresql "github.com/pulumi/pulumi-azure-native-sdk/dbforpostgresql"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := dbforpostgresql.NewServer(ctx, "server", &dbforpostgresql.ServerArgs{
Location: pulumi.String("westus"),
Properties: dbforpostgresql.ServerPropertiesForDefaultCreate{
AdministratorLogin: "cloudsa",
AdministratorLoginPassword: "<administratorLoginPassword>",
CreateMode: "Default",
MinimalTlsVersion: "TLS1_2",
SslEnforcement: dbforpostgresql.SslEnforcementEnumEnabled,
StorageProfile: dbforpostgresql.StorageProfile{
BackupRetentionDays: 7,
GeoRedundantBackup: "Disabled",
StorageMB: 128000,
},
},
ResourceGroupName: pulumi.String("TestGroup"),
ServerName: pulumi.String("pgtestsvc4"),
Sku: &dbforpostgresql.SkuArgs{
Capacity: pulumi.Int(2),
Family: pulumi.String("Gen5"),
Name: pulumi.String("B_Gen5_2"),
Tier: pulumi.String("Basic"),
},
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.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()
.location("westus")
.properties(Map.ofEntries(
Map.entry("administratorLogin", "cloudsa"),
Map.entry("administratorLoginPassword", "<administratorLoginPassword>"),
Map.entry("createMode", "Default"),
Map.entry("minimalTlsVersion", "TLS1_2"),
Map.entry("sslEnforcement", "Enabled"),
Map.entry("storageProfile", Map.ofEntries(
Map.entry("backupRetentionDays", 7),
Map.entry("geoRedundantBackup", "Disabled"),
Map.entry("storageMB", 128000)
))
))
.resourceGroupName("TestGroup")
.serverName("pgtestsvc4")
.sku(Map.ofEntries(
Map.entry("capacity", 2),
Map.entry("family", "Gen5"),
Map.entry("name", "B_Gen5_2"),
Map.entry("tier", "Basic")
))
.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 server = new AzureNative.DBforPostgreSQL.Server("server", 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.SkuArgs
{
Capacity = 2,
Family = "Gen5",
Name = "GP_Gen5_2",
Tier = "GeneralPurpose",
},
});
});
package main
import (
dbforpostgresql "github.com/pulumi/pulumi-azure-native-sdk/dbforpostgresql"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := dbforpostgresql.NewServer(ctx, "server", &dbforpostgresql.ServerArgs{
Location: pulumi.String("westcentralus"),
Properties: dbforpostgresql.ServerPropertiesForReplica{
CreateMode: "Replica",
SourceServerId: "/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.SkuArgs{
Capacity: pulumi.Int(2),
Family: pulumi.String("Gen5"),
Name: pulumi.String("GP_Gen5_2"),
Tier: pulumi.String("GeneralPurpose"),
},
})
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()
.location("westcentralus")
.properties(Map.ofEntries(
Map.entry("createMode", "Replica"),
Map.entry("sourceServerId", "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup_WestCentralUS/providers/Microsoft.DBforPostgreSQL/servers/testserver-master")
))
.resourceGroupName("TestGroup_WestCentralUS")
.serverName("testserver-replica1")
.sku(Map.ofEntries(
Map.entry("capacity", 2),
Map.entry("family", "Gen5"),
Map.entry("name", "GP_Gen5_2"),
Map.entry("tier", "GeneralPurpose")
))
.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 server = new AzureNative.DBforPostgreSQL.Server("server", 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.SkuArgs
{
Capacity = 2,
Family = "Gen5",
Name = "GP_Gen5_2",
Tier = "GeneralPurpose",
},
Tags =
{
{ "ElasticServer", "1" },
},
});
});
package main
import (
dbforpostgresql "github.com/pulumi/pulumi-azure-native-sdk/dbforpostgresql"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := dbforpostgresql.NewServer(ctx, "server", &dbforpostgresql.ServerArgs{
Location: pulumi.String("westus"),
Properties: dbforpostgresql.ServerPropertiesForGeoRestore{
CreateMode: "GeoRestore",
SourceServerId: "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/SourceResourceGroup/providers/Microsoft.DBforPostgreSQL/servers/sourceserver",
},
ResourceGroupName: pulumi.String("TargetResourceGroup"),
ServerName: pulumi.String("targetserver"),
Sku: &dbforpostgresql.SkuArgs{
Capacity: pulumi.Int(2),
Family: pulumi.String("Gen5"),
Name: pulumi.String("GP_Gen5_2"),
Tier: pulumi.String("GeneralPurpose"),
},
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.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()
.location("westus")
.properties(Map.ofEntries(
Map.entry("createMode", "GeoRestore"),
Map.entry("sourceServerId", "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/SourceResourceGroup/providers/Microsoft.DBforPostgreSQL/servers/sourceserver")
))
.resourceGroupName("TargetResourceGroup")
.serverName("targetserver")
.sku(Map.ofEntries(
Map.entry("capacity", 2),
Map.entry("family", "Gen5"),
Map.entry("name", "GP_Gen5_2"),
Map.entry("tier", "GeneralPurpose")
))
.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:Server targetserver /subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforPostgreSQL/servers/targetserver
Properties
The administrator's login name of a server. Can only be specified when the server is being created (and is required for creation).
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.