Server
Represents a server. Uses Azure REST API version 2024-02-01-preview. In version 2.x of the Azure Native provider, it used API version 2022-01-01. Other available API versions: 2022-01-01, 2022-09-30-preview, 2023-06-01-preview, 2023-06-30, 2023-10-01-preview, 2023-12-01-preview, 2023-12-30, 2024-06-01-preview, 2024-10-01-preview. These can be accessed by generating a local SDK package using the CLI command pulumi package add azure-native dbformysql [ApiVersion]
. See the ../../../version-guide/#accessing-any-api-version-via-local-packages for details.
Example Usage
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.DBforMySQL.Server("server", new()
{
AdministratorLogin = "cloudsa",
AdministratorLoginPassword = "your_password",
AvailabilityZone = "1",
Backup = new AzureNative.DBforMySQL.Inputs.BackupArgs
{
BackupIntervalHours = 24,
BackupRetentionDays = 7,
GeoRedundantBackup = AzureNative.DBforMySQL.EnableStatusEnum.Disabled,
},
CreateMode = AzureNative.DBforMySQL.CreateMode.Default,
HighAvailability = new AzureNative.DBforMySQL.Inputs.HighAvailabilityArgs
{
Mode = AzureNative.DBforMySQL.HighAvailabilityMode.ZoneRedundant,
StandbyAvailabilityZone = "3",
},
Location = "southeastasia",
ResourceGroupName = "testrg",
ServerName = "mysqltestserver",
Sku = new AzureNative.DBforMySQL.Inputs.MySQLServerSkuArgs
{
Name = "Standard_D2ds_v4",
Tier = AzureNative.DBforMySQL.ServerSkuTier.GeneralPurpose,
},
Storage = new AzureNative.DBforMySQL.Inputs.StorageArgs
{
AutoGrow = AzureNative.DBforMySQL.EnableStatusEnum.Disabled,
Iops = 600,
StorageRedundancy = AzureNative.DBforMySQL.StorageRedundancyEnum.LocalRedundancy,
StorageSizeGB = 100,
},
Tags =
{
{ "num", "1" },
},
Version = AzureNative.DBforMySQL.ServerVersion.ServerVersion_5_7,
});
});
package main
import (
dbformysql "github.com/pulumi/pulumi-azure-native-sdk/dbformysql/v2"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := dbformysql.NewServer(ctx, "server", &dbformysql.ServerArgs{
AdministratorLogin: pulumi.String("cloudsa"),
AdministratorLoginPassword: pulumi.String("your_password"),
AvailabilityZone: pulumi.String("1"),
Backup: &dbformysql.BackupArgs{
BackupIntervalHours: pulumi.Int(24),
BackupRetentionDays: pulumi.Int(7),
GeoRedundantBackup: pulumi.String(dbformysql.EnableStatusEnumDisabled),
},
CreateMode: pulumi.String(dbformysql.CreateModeDefault),
HighAvailability: &dbformysql.HighAvailabilityArgs{
Mode: pulumi.String(dbformysql.HighAvailabilityModeZoneRedundant),
StandbyAvailabilityZone: pulumi.String("3"),
},
Location: pulumi.String("southeastasia"),
ResourceGroupName: pulumi.String("testrg"),
ServerName: pulumi.String("mysqltestserver"),
Sku: &dbformysql.MySQLServerSkuArgs{
Name: pulumi.String("Standard_D2ds_v4"),
Tier: pulumi.String(dbformysql.ServerSkuTierGeneralPurpose),
},
Storage: &dbformysql.StorageArgs{
AutoGrow: pulumi.String(dbformysql.EnableStatusEnumDisabled),
Iops: pulumi.Int(600),
StorageRedundancy: pulumi.String(dbformysql.StorageRedundancyEnumLocalRedundancy),
StorageSizeGB: pulumi.Int(100),
},
Tags: pulumi.StringMap{
"num": pulumi.String("1"),
},
Version: pulumi.String(dbformysql.ServerVersion_5_7),
})
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.dbformysql.Server;
import com.pulumi.azurenative.dbformysql.ServerArgs;
import com.pulumi.azurenative.dbformysql.inputs.BackupArgs;
import com.pulumi.azurenative.dbformysql.inputs.HighAvailabilityArgs;
import com.pulumi.azurenative.dbformysql.inputs.MySQLServerSkuArgs;
import com.pulumi.azurenative.dbformysql.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("your_password")
.availabilityZone("1")
.backup(BackupArgs.builder()
.backupIntervalHours(24)
.backupRetentionDays(7)
.geoRedundantBackup("Disabled")
.build())
.createMode("Default")
.highAvailability(HighAvailabilityArgs.builder()
.mode("ZoneRedundant")
.standbyAvailabilityZone("3")
.build())
.location("southeastasia")
.resourceGroupName("testrg")
.serverName("mysqltestserver")
.sku(MySQLServerSkuArgs.builder()
.name("Standard_D2ds_v4")
.tier("GeneralPurpose")
.build())
.storage(StorageArgs.builder()
.autoGrow("Disabled")
.iops(600)
.storageRedundancy("LocalRedundancy")
.storageSizeGB(100)
.build())
.tags(Map.of("num", "1"))
.version("5.7")
.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.DBforMySQL.Server("server", new()
{
CreateMode = AzureNative.DBforMySQL.CreateMode.Replica,
Location = "SoutheastAsia",
ResourceGroupName = "testgr",
ServerName = "replica-server",
SourceServerResourceId = "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testgr/providers/Microsoft.DBforMySQL/flexibleServers/source-server",
});
});
package main
import (
dbformysql "github.com/pulumi/pulumi-azure-native-sdk/dbformysql/v2"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := dbformysql.NewServer(ctx, "server", &dbformysql.ServerArgs{
CreateMode: pulumi.String(dbformysql.CreateModeReplica),
Location: pulumi.String("SoutheastAsia"),
ResourceGroupName: pulumi.String("testgr"),
ServerName: pulumi.String("replica-server"),
SourceServerResourceId: pulumi.String("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testgr/providers/Microsoft.DBforMySQL/flexibleServers/source-server"),
})
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.dbformysql.Server;
import com.pulumi.azurenative.dbformysql.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("Replica")
.location("SoutheastAsia")
.resourceGroupName("testgr")
.serverName("replica-server")
.sourceServerResourceId("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testgr/providers/Microsoft.DBforMySQL/flexibleServers/source-server")
.build());
}
}
Create a server 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.DBforMySQL.Server("server", new()
{
CreateMode = AzureNative.DBforMySQL.CreateMode.PointInTimeRestore,
Location = "SoutheastAsia",
ResourceGroupName = "TargetResourceGroup",
RestorePointInTime = "2021-06-24T00:00:37.467Z",
ServerName = "targetserver",
Sku = new AzureNative.DBforMySQL.Inputs.MySQLServerSkuArgs
{
Name = "Standard_D14_v2",
Tier = AzureNative.DBforMySQL.ServerSkuTier.GeneralPurpose,
},
SourceServerResourceId = "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/SourceResourceGroup/providers/Microsoft.DBforMySQL/flexibleServers/sourceserver",
Tags =
{
{ "num", "1" },
},
});
});
package main
import (
dbformysql "github.com/pulumi/pulumi-azure-native-sdk/dbformysql/v2"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := dbformysql.NewServer(ctx, "server", &dbformysql.ServerArgs{
CreateMode: pulumi.String(dbformysql.CreateModePointInTimeRestore),
Location: pulumi.String("SoutheastAsia"),
ResourceGroupName: pulumi.String("TargetResourceGroup"),
RestorePointInTime: pulumi.String("2021-06-24T00:00:37.467Z"),
ServerName: pulumi.String("targetserver"),
Sku: &dbformysql.MySQLServerSkuArgs{
Name: pulumi.String("Standard_D14_v2"),
Tier: pulumi.String(dbformysql.ServerSkuTierGeneralPurpose),
},
SourceServerResourceId: pulumi.String("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/SourceResourceGroup/providers/Microsoft.DBforMySQL/flexibleServers/sourceserver"),
Tags: pulumi.StringMap{
"num": 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.dbformysql.Server;
import com.pulumi.azurenative.dbformysql.ServerArgs;
import com.pulumi.azurenative.dbformysql.inputs.MySQLServerSkuArgs;
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("SoutheastAsia")
.resourceGroupName("TargetResourceGroup")
.restorePointInTime("2021-06-24T00:00:37.467Z")
.serverName("targetserver")
.sku(MySQLServerSkuArgs.builder()
.name("Standard_D14_v2")
.tier("GeneralPurpose")
.build())
.sourceServerResourceId("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/SourceResourceGroup/providers/Microsoft.DBforMySQL/flexibleServers/sourceserver")
.tags(Map.of("num", "1"))
.build());
}
}
Import
An existing resource can be imported using its type token, name, and identifier, e.g.
$ pulumi import azure-native:dbformysql:Server mysqltestserver /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/flexibleServers/{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).
availability Zone information of the server.
The Azure API version of the resource.
Backup related properties of a server.
The Data Encryption for CMK.
The fully qualified domain name of a server.
High availability related properties of a server.
The cmk identity for the server.
Source properties for import from storage.
Maintenance window of a server.
Network related properties of a server.
PrivateEndpointConnections related properties of a server.
The maximum number of replicas that a primary server can have.
The replication role.
The SKU (pricing tier) of the server.
The source MySQL server id.
Storage related properties of a server.
Azure Resource Manager metadata containing createdBy and modifiedBy information.