azure-native.sql.ManagedDatabase

Explore with Pulumi AI

A managed database resource. API Version: 2020-11-01-preview.

Example Usage

Creates a new managed database by restoring from an external backup

using System.Collections.Generic;
using Pulumi;
using AzureNative = Pulumi.AzureNative;

return await Deployment.RunAsync(() => 
{
    var managedDatabase = new AzureNative.Sql.ManagedDatabase("managedDatabase", new()
    {
        AutoCompleteRestore = true,
        Collation = "SQL_Latin1_General_CP1_CI_AS",
        CreateMode = "RestoreExternalBackup",
        DatabaseName = "managedDatabase",
        LastBackupName = "last_backup_name",
        Location = "southeastasia",
        ManagedInstanceName = "managedInstance",
        ResourceGroupName = "Default-SQL-SouthEastAsia",
        StorageContainerSasToken = "sv=2015-12-11&sr=c&sp=rl&sig=1234",
        StorageContainerUri = "https://myaccountname.blob.core.windows.net/backups",
    });

});
package main

import (
	sql "github.com/pulumi/pulumi-azure-native/sdk/go/azure/sql"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := sql.NewManagedDatabase(ctx, "managedDatabase", &sql.ManagedDatabaseArgs{
			AutoCompleteRestore:      pulumi.Bool(true),
			Collation:                pulumi.String("SQL_Latin1_General_CP1_CI_AS"),
			CreateMode:               pulumi.String("RestoreExternalBackup"),
			DatabaseName:             pulumi.String("managedDatabase"),
			LastBackupName:           pulumi.String("last_backup_name"),
			Location:                 pulumi.String("southeastasia"),
			ManagedInstanceName:      pulumi.String("managedInstance"),
			ResourceGroupName:        pulumi.String("Default-SQL-SouthEastAsia"),
			StorageContainerSasToken: pulumi.String("sv=2015-12-11&sr=c&sp=rl&sig=1234"),
			StorageContainerUri:      pulumi.String("https://myaccountname.blob.core.windows.net/backups"),
		})
		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.sql.ManagedDatabase;
import com.pulumi.azurenative.sql.ManagedDatabaseArgs;
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 managedDatabase = new ManagedDatabase("managedDatabase", ManagedDatabaseArgs.builder()        
            .autoCompleteRestore(true)
            .collation("SQL_Latin1_General_CP1_CI_AS")
            .createMode("RestoreExternalBackup")
            .databaseName("managedDatabase")
            .lastBackupName("last_backup_name")
            .location("southeastasia")
            .managedInstanceName("managedInstance")
            .resourceGroupName("Default-SQL-SouthEastAsia")
            .storageContainerSasToken("sv=2015-12-11&sr=c&sp=rl&sig=1234")
            .storageContainerUri("https://myaccountname.blob.core.windows.net/backups")
            .build());

    }
}
import pulumi
import pulumi_azure_native as azure_native

managed_database = azure_native.sql.ManagedDatabase("managedDatabase",
    auto_complete_restore=True,
    collation="SQL_Latin1_General_CP1_CI_AS",
    create_mode="RestoreExternalBackup",
    database_name="managedDatabase",
    last_backup_name="last_backup_name",
    location="southeastasia",
    managed_instance_name="managedInstance",
    resource_group_name="Default-SQL-SouthEastAsia",
    storage_container_sas_token="sv=2015-12-11&sr=c&sp=rl&sig=1234",
    storage_container_uri="https://myaccountname.blob.core.windows.net/backups")
import * as pulumi from "@pulumi/pulumi";
import * as azure_native from "@pulumi/azure-native";

const managedDatabase = new azure_native.sql.ManagedDatabase("managedDatabase", {
    autoCompleteRestore: true,
    collation: "SQL_Latin1_General_CP1_CI_AS",
    createMode: "RestoreExternalBackup",
    databaseName: "managedDatabase",
    lastBackupName: "last_backup_name",
    location: "southeastasia",
    managedInstanceName: "managedInstance",
    resourceGroupName: "Default-SQL-SouthEastAsia",
    storageContainerSasToken: "sv=2015-12-11&sr=c&sp=rl&sig=1234",
    storageContainerUri: "https://myaccountname.blob.core.windows.net/backups",
});
resources:
  managedDatabase:
    type: azure-native:sql:ManagedDatabase
    properties:
      autoCompleteRestore: true
      collation: SQL_Latin1_General_CP1_CI_AS
      createMode: RestoreExternalBackup
      databaseName: managedDatabase
      lastBackupName: last_backup_name
      location: southeastasia
      managedInstanceName: managedInstance
      resourceGroupName: Default-SQL-SouthEastAsia
      storageContainerSasToken: sv=2015-12-11&sr=c&sp=rl&sig=1234
      storageContainerUri: https://myaccountname.blob.core.windows.net/backups

Creates a new managed database from restoring a geo-replicated backup

using System.Collections.Generic;
using Pulumi;
using AzureNative = Pulumi.AzureNative;

return await Deployment.RunAsync(() => 
{
    var managedDatabase = new AzureNative.Sql.ManagedDatabase("managedDatabase", new()
    {
        CreateMode = "Recovery",
        DatabaseName = "testdb_recovered",
        Location = "southeastasia",
        ManagedInstanceName = "server1",
        RecoverableDatabaseId = "/subscriptions/11111111-2222-3333-4444-555555555555/resourceGroups/Default-SQL-WestEurope/providers/Microsoft.Sql/managedInstances/testsvr/recoverableDatabases/testdb",
        ResourceGroupName = "Default-SQL-SouthEastAsia",
    });

});
package main

import (
	sql "github.com/pulumi/pulumi-azure-native/sdk/go/azure/sql"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := sql.NewManagedDatabase(ctx, "managedDatabase", &sql.ManagedDatabaseArgs{
			CreateMode:            pulumi.String("Recovery"),
			DatabaseName:          pulumi.String("testdb_recovered"),
			Location:              pulumi.String("southeastasia"),
			ManagedInstanceName:   pulumi.String("server1"),
			RecoverableDatabaseId: pulumi.String("/subscriptions/11111111-2222-3333-4444-555555555555/resourceGroups/Default-SQL-WestEurope/providers/Microsoft.Sql/managedInstances/testsvr/recoverableDatabases/testdb"),
			ResourceGroupName:     pulumi.String("Default-SQL-SouthEastAsia"),
		})
		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.sql.ManagedDatabase;
import com.pulumi.azurenative.sql.ManagedDatabaseArgs;
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 managedDatabase = new ManagedDatabase("managedDatabase", ManagedDatabaseArgs.builder()        
            .createMode("Recovery")
            .databaseName("testdb_recovered")
            .location("southeastasia")
            .managedInstanceName("server1")
            .recoverableDatabaseId("/subscriptions/11111111-2222-3333-4444-555555555555/resourceGroups/Default-SQL-WestEurope/providers/Microsoft.Sql/managedInstances/testsvr/recoverableDatabases/testdb")
            .resourceGroupName("Default-SQL-SouthEastAsia")
            .build());

    }
}
import pulumi
import pulumi_azure_native as azure_native

managed_database = azure_native.sql.ManagedDatabase("managedDatabase",
    create_mode="Recovery",
    database_name="testdb_recovered",
    location="southeastasia",
    managed_instance_name="server1",
    recoverable_database_id="/subscriptions/11111111-2222-3333-4444-555555555555/resourceGroups/Default-SQL-WestEurope/providers/Microsoft.Sql/managedInstances/testsvr/recoverableDatabases/testdb",
    resource_group_name="Default-SQL-SouthEastAsia")
import * as pulumi from "@pulumi/pulumi";
import * as azure_native from "@pulumi/azure-native";

const managedDatabase = new azure_native.sql.ManagedDatabase("managedDatabase", {
    createMode: "Recovery",
    databaseName: "testdb_recovered",
    location: "southeastasia",
    managedInstanceName: "server1",
    recoverableDatabaseId: "/subscriptions/11111111-2222-3333-4444-555555555555/resourceGroups/Default-SQL-WestEurope/providers/Microsoft.Sql/managedInstances/testsvr/recoverableDatabases/testdb",
    resourceGroupName: "Default-SQL-SouthEastAsia",
});
resources:
  managedDatabase:
    type: azure-native:sql:ManagedDatabase
    properties:
      createMode: Recovery
      databaseName: testdb_recovered
      location: southeastasia
      managedInstanceName: server1
      recoverableDatabaseId: /subscriptions/11111111-2222-3333-4444-555555555555/resourceGroups/Default-SQL-WestEurope/providers/Microsoft.Sql/managedInstances/testsvr/recoverableDatabases/testdb
      resourceGroupName: Default-SQL-SouthEastAsia

Creates a new managed database from restoring a long term retention backup

using System.Collections.Generic;
using Pulumi;
using AzureNative = Pulumi.AzureNative;

return await Deployment.RunAsync(() => 
{
    var managedDatabase = new AzureNative.Sql.ManagedDatabase("managedDatabase", new()
    {
        Collation = "SQL_Latin1_General_CP1_CI_AS",
        CreateMode = "RestoreExternalBackup",
        DatabaseName = "managedDatabase",
        Location = "southeastasia",
        ManagedInstanceName = "managedInstance",
        ResourceGroupName = "Default-SQL-SouthEastAsia",
        StorageContainerSasToken = "sv=2015-12-11&sr=c&sp=rl&sig=1234",
        StorageContainerUri = "https://myaccountname.blob.core.windows.net/backups",
    });

});
package main

import (
	sql "github.com/pulumi/pulumi-azure-native/sdk/go/azure/sql"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := sql.NewManagedDatabase(ctx, "managedDatabase", &sql.ManagedDatabaseArgs{
			Collation:                pulumi.String("SQL_Latin1_General_CP1_CI_AS"),
			CreateMode:               pulumi.String("RestoreExternalBackup"),
			DatabaseName:             pulumi.String("managedDatabase"),
			Location:                 pulumi.String("southeastasia"),
			ManagedInstanceName:      pulumi.String("managedInstance"),
			ResourceGroupName:        pulumi.String("Default-SQL-SouthEastAsia"),
			StorageContainerSasToken: pulumi.String("sv=2015-12-11&sr=c&sp=rl&sig=1234"),
			StorageContainerUri:      pulumi.String("https://myaccountname.blob.core.windows.net/backups"),
		})
		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.sql.ManagedDatabase;
import com.pulumi.azurenative.sql.ManagedDatabaseArgs;
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 managedDatabase = new ManagedDatabase("managedDatabase", ManagedDatabaseArgs.builder()        
            .collation("SQL_Latin1_General_CP1_CI_AS")
            .createMode("RestoreExternalBackup")
            .databaseName("managedDatabase")
            .location("southeastasia")
            .managedInstanceName("managedInstance")
            .resourceGroupName("Default-SQL-SouthEastAsia")
            .storageContainerSasToken("sv=2015-12-11&sr=c&sp=rl&sig=1234")
            .storageContainerUri("https://myaccountname.blob.core.windows.net/backups")
            .build());

    }
}
import pulumi
import pulumi_azure_native as azure_native

managed_database = azure_native.sql.ManagedDatabase("managedDatabase",
    collation="SQL_Latin1_General_CP1_CI_AS",
    create_mode="RestoreExternalBackup",
    database_name="managedDatabase",
    location="southeastasia",
    managed_instance_name="managedInstance",
    resource_group_name="Default-SQL-SouthEastAsia",
    storage_container_sas_token="sv=2015-12-11&sr=c&sp=rl&sig=1234",
    storage_container_uri="https://myaccountname.blob.core.windows.net/backups")
import * as pulumi from "@pulumi/pulumi";
import * as azure_native from "@pulumi/azure-native";

const managedDatabase = new azure_native.sql.ManagedDatabase("managedDatabase", {
    collation: "SQL_Latin1_General_CP1_CI_AS",
    createMode: "RestoreExternalBackup",
    databaseName: "managedDatabase",
    location: "southeastasia",
    managedInstanceName: "managedInstance",
    resourceGroupName: "Default-SQL-SouthEastAsia",
    storageContainerSasToken: "sv=2015-12-11&sr=c&sp=rl&sig=1234",
    storageContainerUri: "https://myaccountname.blob.core.windows.net/backups",
});
resources:
  managedDatabase:
    type: azure-native:sql:ManagedDatabase
    properties:
      collation: SQL_Latin1_General_CP1_CI_AS
      createMode: RestoreExternalBackup
      databaseName: managedDatabase
      location: southeastasia
      managedInstanceName: managedInstance
      resourceGroupName: Default-SQL-SouthEastAsia
      storageContainerSasToken: sv=2015-12-11&sr=c&sp=rl&sig=1234
      storageContainerUri: https://myaccountname.blob.core.windows.net/backups

Creates a new managed database using point in time restore

using System.Collections.Generic;
using Pulumi;
using AzureNative = Pulumi.AzureNative;

return await Deployment.RunAsync(() => 
{
    var managedDatabase = new AzureNative.Sql.ManagedDatabase("managedDatabase", new()
    {
        CreateMode = "PointInTimeRestore",
        DatabaseName = "managedDatabase",
        Location = "southeastasia",
        ManagedInstanceName = "managedInstance",
        ResourceGroupName = "Default-SQL-SouthEastAsia",
        RestorePointInTime = "2017-07-14T05:35:31.503Z",
        SourceDatabaseId = "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/managedInstances/testsvr/databases/testdb",
    });

});
package main

import (
	sql "github.com/pulumi/pulumi-azure-native/sdk/go/azure/sql"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := sql.NewManagedDatabase(ctx, "managedDatabase", &sql.ManagedDatabaseArgs{
			CreateMode:          pulumi.String("PointInTimeRestore"),
			DatabaseName:        pulumi.String("managedDatabase"),
			Location:            pulumi.String("southeastasia"),
			ManagedInstanceName: pulumi.String("managedInstance"),
			ResourceGroupName:   pulumi.String("Default-SQL-SouthEastAsia"),
			RestorePointInTime:  pulumi.String("2017-07-14T05:35:31.503Z"),
			SourceDatabaseId:    pulumi.String("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/managedInstances/testsvr/databases/testdb"),
		})
		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.sql.ManagedDatabase;
import com.pulumi.azurenative.sql.ManagedDatabaseArgs;
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 managedDatabase = new ManagedDatabase("managedDatabase", ManagedDatabaseArgs.builder()        
            .createMode("PointInTimeRestore")
            .databaseName("managedDatabase")
            .location("southeastasia")
            .managedInstanceName("managedInstance")
            .resourceGroupName("Default-SQL-SouthEastAsia")
            .restorePointInTime("2017-07-14T05:35:31.503Z")
            .sourceDatabaseId("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/managedInstances/testsvr/databases/testdb")
            .build());

    }
}
import pulumi
import pulumi_azure_native as azure_native

managed_database = azure_native.sql.ManagedDatabase("managedDatabase",
    create_mode="PointInTimeRestore",
    database_name="managedDatabase",
    location="southeastasia",
    managed_instance_name="managedInstance",
    resource_group_name="Default-SQL-SouthEastAsia",
    restore_point_in_time="2017-07-14T05:35:31.503Z",
    source_database_id="/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/managedInstances/testsvr/databases/testdb")
import * as pulumi from "@pulumi/pulumi";
import * as azure_native from "@pulumi/azure-native";

const managedDatabase = new azure_native.sql.ManagedDatabase("managedDatabase", {
    createMode: "PointInTimeRestore",
    databaseName: "managedDatabase",
    location: "southeastasia",
    managedInstanceName: "managedInstance",
    resourceGroupName: "Default-SQL-SouthEastAsia",
    restorePointInTime: "2017-07-14T05:35:31.503Z",
    sourceDatabaseId: "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/managedInstances/testsvr/databases/testdb",
});
resources:
  managedDatabase:
    type: azure-native:sql:ManagedDatabase
    properties:
      createMode: PointInTimeRestore
      databaseName: managedDatabase
      location: southeastasia
      managedInstanceName: managedInstance
      resourceGroupName: Default-SQL-SouthEastAsia
      restorePointInTime: 2017-07-14T05:35:31.503Z
      sourceDatabaseId: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/managedInstances/testsvr/databases/testdb

Creates a new managed database with maximal properties

using System.Collections.Generic;
using Pulumi;
using AzureNative = Pulumi.AzureNative;

return await Deployment.RunAsync(() => 
{
    var managedDatabase = new AzureNative.Sql.ManagedDatabase("managedDatabase", new()
    {
        DatabaseName = "managedDatabase",
        Location = "southeastasia",
        ManagedInstanceName = "managedInstance",
        ResourceGroupName = "Default-SQL-SouthEastAsia",
        Tags = 
        {
            { "tagKey1", "TagValue1" },
        },
    });

});
package main

import (
	sql "github.com/pulumi/pulumi-azure-native/sdk/go/azure/sql"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := sql.NewManagedDatabase(ctx, "managedDatabase", &sql.ManagedDatabaseArgs{
			DatabaseName:        pulumi.String("managedDatabase"),
			Location:            pulumi.String("southeastasia"),
			ManagedInstanceName: pulumi.String("managedInstance"),
			ResourceGroupName:   pulumi.String("Default-SQL-SouthEastAsia"),
			Tags: pulumi.StringMap{
				"tagKey1": pulumi.String("TagValue1"),
			},
		})
		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.sql.ManagedDatabase;
import com.pulumi.azurenative.sql.ManagedDatabaseArgs;
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 managedDatabase = new ManagedDatabase("managedDatabase", ManagedDatabaseArgs.builder()        
            .databaseName("managedDatabase")
            .location("southeastasia")
            .managedInstanceName("managedInstance")
            .resourceGroupName("Default-SQL-SouthEastAsia")
            .tags(Map.of("tagKey1", "TagValue1"))
            .build());

    }
}
import pulumi
import pulumi_azure_native as azure_native

managed_database = azure_native.sql.ManagedDatabase("managedDatabase",
    database_name="managedDatabase",
    location="southeastasia",
    managed_instance_name="managedInstance",
    resource_group_name="Default-SQL-SouthEastAsia",
    tags={
        "tagKey1": "TagValue1",
    })
import * as pulumi from "@pulumi/pulumi";
import * as azure_native from "@pulumi/azure-native";

const managedDatabase = new azure_native.sql.ManagedDatabase("managedDatabase", {
    databaseName: "managedDatabase",
    location: "southeastasia",
    managedInstanceName: "managedInstance",
    resourceGroupName: "Default-SQL-SouthEastAsia",
    tags: {
        tagKey1: "TagValue1",
    },
});
resources:
  managedDatabase:
    type: azure-native:sql:ManagedDatabase
    properties:
      databaseName: managedDatabase
      location: southeastasia
      managedInstanceName: managedInstance
      resourceGroupName: Default-SQL-SouthEastAsia
      tags:
        tagKey1: TagValue1

Creates a new managed database with minimal properties

using System.Collections.Generic;
using Pulumi;
using AzureNative = Pulumi.AzureNative;

return await Deployment.RunAsync(() => 
{
    var managedDatabase = new AzureNative.Sql.ManagedDatabase("managedDatabase", new()
    {
        DatabaseName = "managedDatabase",
        Location = "southeastasia",
        ManagedInstanceName = "managedInstance",
        ResourceGroupName = "Default-SQL-SouthEastAsia",
    });

});
package main

import (
	sql "github.com/pulumi/pulumi-azure-native/sdk/go/azure/sql"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := sql.NewManagedDatabase(ctx, "managedDatabase", &sql.ManagedDatabaseArgs{
			DatabaseName:        pulumi.String("managedDatabase"),
			Location:            pulumi.String("southeastasia"),
			ManagedInstanceName: pulumi.String("managedInstance"),
			ResourceGroupName:   pulumi.String("Default-SQL-SouthEastAsia"),
		})
		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.sql.ManagedDatabase;
import com.pulumi.azurenative.sql.ManagedDatabaseArgs;
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 managedDatabase = new ManagedDatabase("managedDatabase", ManagedDatabaseArgs.builder()        
            .databaseName("managedDatabase")
            .location("southeastasia")
            .managedInstanceName("managedInstance")
            .resourceGroupName("Default-SQL-SouthEastAsia")
            .build());

    }
}
import pulumi
import pulumi_azure_native as azure_native

managed_database = azure_native.sql.ManagedDatabase("managedDatabase",
    database_name="managedDatabase",
    location="southeastasia",
    managed_instance_name="managedInstance",
    resource_group_name="Default-SQL-SouthEastAsia")
import * as pulumi from "@pulumi/pulumi";
import * as azure_native from "@pulumi/azure-native";

const managedDatabase = new azure_native.sql.ManagedDatabase("managedDatabase", {
    databaseName: "managedDatabase",
    location: "southeastasia",
    managedInstanceName: "managedInstance",
    resourceGroupName: "Default-SQL-SouthEastAsia",
});
resources:
  managedDatabase:
    type: azure-native:sql:ManagedDatabase
    properties:
      databaseName: managedDatabase
      location: southeastasia
      managedInstanceName: managedInstance
      resourceGroupName: Default-SQL-SouthEastAsia

Create ManagedDatabase Resource

new ManagedDatabase(name: string, args: ManagedDatabaseArgs, opts?: CustomResourceOptions);
@overload
def ManagedDatabase(resource_name: str,
                    opts: Optional[ResourceOptions] = None,
                    auto_complete_restore: Optional[bool] = None,
                    catalog_collation: Optional[Union[str, CatalogCollationType]] = None,
                    collation: Optional[str] = None,
                    create_mode: Optional[Union[str, ManagedDatabaseCreateMode]] = None,
                    database_name: Optional[str] = None,
                    last_backup_name: Optional[str] = None,
                    location: Optional[str] = None,
                    long_term_retention_backup_resource_id: Optional[str] = None,
                    managed_instance_name: Optional[str] = None,
                    recoverable_database_id: Optional[str] = None,
                    resource_group_name: Optional[str] = None,
                    restorable_dropped_database_id: Optional[str] = None,
                    restore_point_in_time: Optional[str] = None,
                    source_database_id: Optional[str] = None,
                    storage_container_sas_token: Optional[str] = None,
                    storage_container_uri: Optional[str] = None,
                    tags: Optional[Mapping[str, str]] = None)
@overload
def ManagedDatabase(resource_name: str,
                    args: ManagedDatabaseArgs,
                    opts: Optional[ResourceOptions] = None)
func NewManagedDatabase(ctx *Context, name string, args ManagedDatabaseArgs, opts ...ResourceOption) (*ManagedDatabase, error)
public ManagedDatabase(string name, ManagedDatabaseArgs args, CustomResourceOptions? opts = null)
public ManagedDatabase(String name, ManagedDatabaseArgs args)
public ManagedDatabase(String name, ManagedDatabaseArgs args, CustomResourceOptions options)
type: azure-native:sql:ManagedDatabase
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

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

ManagedDatabase Resource Properties

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

Inputs

The ManagedDatabase resource accepts the following input properties:

ManagedInstanceName string

The name of the managed instance.

ResourceGroupName string

The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.

AutoCompleteRestore bool

Whether to auto complete restore of this managed database.

CatalogCollation string | Pulumi.AzureNative.Sql.CatalogCollationType

Collation of the metadata catalog.

Collation string

Collation of the managed database.

CreateMode string | Pulumi.AzureNative.Sql.ManagedDatabaseCreateMode

Managed database create mode. PointInTimeRestore: Create a database by restoring a point in time backup of an existing database. SourceDatabaseName, SourceManagedInstanceName and PointInTime must be specified. RestoreExternalBackup: Create a database by restoring from external backup files. Collation, StorageContainerUri and StorageContainerSasToken must be specified. Recovery: Creates a database by restoring a geo-replicated backup. RecoverableDatabaseId must be specified as the recoverable database resource ID to restore. RestoreLongTermRetentionBackup: Create a database by restoring from a long term retention backup (longTermRetentionBackupResourceId required).

DatabaseName string

The name of the database.

LastBackupName string

Last backup file name for restore of this managed database.

Location string

Resource location.

LongTermRetentionBackupResourceId string

The name of the Long Term Retention backup to be used for restore of this managed database.

RecoverableDatabaseId string

The resource identifier of the recoverable database associated with create operation of this database.

RestorableDroppedDatabaseId string

The restorable dropped database resource id to restore when creating this database.

RestorePointInTime string

Conditional. If createMode is PointInTimeRestore, this value is required. Specifies the point in time (ISO8601 format) of the source database that will be restored to create the new database.

SourceDatabaseId string

The resource identifier of the source database associated with create operation of this database.

StorageContainerSasToken string

Conditional. If createMode is RestoreExternalBackup, this value is required. Specifies the storage container sas token.

StorageContainerUri string

Conditional. If createMode is RestoreExternalBackup, this value is required. Specifies the uri of the storage container where backups for this restore are stored.

Tags Dictionary<string, string>

Resource tags.

ManagedInstanceName string

The name of the managed instance.

ResourceGroupName string

The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.

AutoCompleteRestore bool

Whether to auto complete restore of this managed database.

CatalogCollation string | CatalogCollationType

Collation of the metadata catalog.

Collation string

Collation of the managed database.

CreateMode string | ManagedDatabaseCreateMode

Managed database create mode. PointInTimeRestore: Create a database by restoring a point in time backup of an existing database. SourceDatabaseName, SourceManagedInstanceName and PointInTime must be specified. RestoreExternalBackup: Create a database by restoring from external backup files. Collation, StorageContainerUri and StorageContainerSasToken must be specified. Recovery: Creates a database by restoring a geo-replicated backup. RecoverableDatabaseId must be specified as the recoverable database resource ID to restore. RestoreLongTermRetentionBackup: Create a database by restoring from a long term retention backup (longTermRetentionBackupResourceId required).

DatabaseName string

The name of the database.

LastBackupName string

Last backup file name for restore of this managed database.

Location string

Resource location.

LongTermRetentionBackupResourceId string

The name of the Long Term Retention backup to be used for restore of this managed database.

RecoverableDatabaseId string

The resource identifier of the recoverable database associated with create operation of this database.

RestorableDroppedDatabaseId string

The restorable dropped database resource id to restore when creating this database.

RestorePointInTime string

Conditional. If createMode is PointInTimeRestore, this value is required. Specifies the point in time (ISO8601 format) of the source database that will be restored to create the new database.

SourceDatabaseId string

The resource identifier of the source database associated with create operation of this database.

StorageContainerSasToken string

Conditional. If createMode is RestoreExternalBackup, this value is required. Specifies the storage container sas token.

StorageContainerUri string

Conditional. If createMode is RestoreExternalBackup, this value is required. Specifies the uri of the storage container where backups for this restore are stored.

Tags map[string]string

Resource tags.

managedInstanceName String

The name of the managed instance.

resourceGroupName String

The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.

autoCompleteRestore Boolean

Whether to auto complete restore of this managed database.

catalogCollation String | CatalogCollationType

Collation of the metadata catalog.

collation String

Collation of the managed database.

createMode String | ManagedDatabaseCreateMode

Managed database create mode. PointInTimeRestore: Create a database by restoring a point in time backup of an existing database. SourceDatabaseName, SourceManagedInstanceName and PointInTime must be specified. RestoreExternalBackup: Create a database by restoring from external backup files. Collation, StorageContainerUri and StorageContainerSasToken must be specified. Recovery: Creates a database by restoring a geo-replicated backup. RecoverableDatabaseId must be specified as the recoverable database resource ID to restore. RestoreLongTermRetentionBackup: Create a database by restoring from a long term retention backup (longTermRetentionBackupResourceId required).

databaseName String

The name of the database.

lastBackupName String

Last backup file name for restore of this managed database.

location String

Resource location.

longTermRetentionBackupResourceId String

The name of the Long Term Retention backup to be used for restore of this managed database.

recoverableDatabaseId String

The resource identifier of the recoverable database associated with create operation of this database.

restorableDroppedDatabaseId String

The restorable dropped database resource id to restore when creating this database.

restorePointInTime String

Conditional. If createMode is PointInTimeRestore, this value is required. Specifies the point in time (ISO8601 format) of the source database that will be restored to create the new database.

sourceDatabaseId String

The resource identifier of the source database associated with create operation of this database.

storageContainerSasToken String

Conditional. If createMode is RestoreExternalBackup, this value is required. Specifies the storage container sas token.

storageContainerUri String

Conditional. If createMode is RestoreExternalBackup, this value is required. Specifies the uri of the storage container where backups for this restore are stored.

tags Map<String,String>

Resource tags.

managedInstanceName string

The name of the managed instance.

resourceGroupName string

The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.

autoCompleteRestore boolean

Whether to auto complete restore of this managed database.

catalogCollation string | CatalogCollationType

Collation of the metadata catalog.

collation string

Collation of the managed database.

createMode string | ManagedDatabaseCreateMode

Managed database create mode. PointInTimeRestore: Create a database by restoring a point in time backup of an existing database. SourceDatabaseName, SourceManagedInstanceName and PointInTime must be specified. RestoreExternalBackup: Create a database by restoring from external backup files. Collation, StorageContainerUri and StorageContainerSasToken must be specified. Recovery: Creates a database by restoring a geo-replicated backup. RecoverableDatabaseId must be specified as the recoverable database resource ID to restore. RestoreLongTermRetentionBackup: Create a database by restoring from a long term retention backup (longTermRetentionBackupResourceId required).

databaseName string

The name of the database.

lastBackupName string

Last backup file name for restore of this managed database.

location string

Resource location.

longTermRetentionBackupResourceId string

The name of the Long Term Retention backup to be used for restore of this managed database.

recoverableDatabaseId string

The resource identifier of the recoverable database associated with create operation of this database.

restorableDroppedDatabaseId string

The restorable dropped database resource id to restore when creating this database.

restorePointInTime string

Conditional. If createMode is PointInTimeRestore, this value is required. Specifies the point in time (ISO8601 format) of the source database that will be restored to create the new database.

sourceDatabaseId string

The resource identifier of the source database associated with create operation of this database.

storageContainerSasToken string

Conditional. If createMode is RestoreExternalBackup, this value is required. Specifies the storage container sas token.

storageContainerUri string

Conditional. If createMode is RestoreExternalBackup, this value is required. Specifies the uri of the storage container where backups for this restore are stored.

tags {[key: string]: string}

Resource tags.

managed_instance_name str

The name of the managed instance.

resource_group_name str

The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.

auto_complete_restore bool

Whether to auto complete restore of this managed database.

catalog_collation str | CatalogCollationType

Collation of the metadata catalog.

collation str

Collation of the managed database.

create_mode str | ManagedDatabaseCreateMode

Managed database create mode. PointInTimeRestore: Create a database by restoring a point in time backup of an existing database. SourceDatabaseName, SourceManagedInstanceName and PointInTime must be specified. RestoreExternalBackup: Create a database by restoring from external backup files. Collation, StorageContainerUri and StorageContainerSasToken must be specified. Recovery: Creates a database by restoring a geo-replicated backup. RecoverableDatabaseId must be specified as the recoverable database resource ID to restore. RestoreLongTermRetentionBackup: Create a database by restoring from a long term retention backup (longTermRetentionBackupResourceId required).

database_name str

The name of the database.

last_backup_name str

Last backup file name for restore of this managed database.

location str

Resource location.

long_term_retention_backup_resource_id str

The name of the Long Term Retention backup to be used for restore of this managed database.

recoverable_database_id str

The resource identifier of the recoverable database associated with create operation of this database.

restorable_dropped_database_id str

The restorable dropped database resource id to restore when creating this database.

restore_point_in_time str

Conditional. If createMode is PointInTimeRestore, this value is required. Specifies the point in time (ISO8601 format) of the source database that will be restored to create the new database.

source_database_id str

The resource identifier of the source database associated with create operation of this database.

storage_container_sas_token str

Conditional. If createMode is RestoreExternalBackup, this value is required. Specifies the storage container sas token.

storage_container_uri str

Conditional. If createMode is RestoreExternalBackup, this value is required. Specifies the uri of the storage container where backups for this restore are stored.

tags Mapping[str, str]

Resource tags.

managedInstanceName String

The name of the managed instance.

resourceGroupName String

The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.

autoCompleteRestore Boolean

Whether to auto complete restore of this managed database.

catalogCollation String | "DATABASE_DEFAULT" | "SQL_Latin1_General_CP1_CI_AS"

Collation of the metadata catalog.

collation String

Collation of the managed database.

createMode String | "Default" | "RestoreExternalBackup" | "PointInTimeRestore" | "Recovery" | "RestoreLongTermRetentionBackup"

Managed database create mode. PointInTimeRestore: Create a database by restoring a point in time backup of an existing database. SourceDatabaseName, SourceManagedInstanceName and PointInTime must be specified. RestoreExternalBackup: Create a database by restoring from external backup files. Collation, StorageContainerUri and StorageContainerSasToken must be specified. Recovery: Creates a database by restoring a geo-replicated backup. RecoverableDatabaseId must be specified as the recoverable database resource ID to restore. RestoreLongTermRetentionBackup: Create a database by restoring from a long term retention backup (longTermRetentionBackupResourceId required).

databaseName String

The name of the database.

lastBackupName String

Last backup file name for restore of this managed database.

location String

Resource location.

longTermRetentionBackupResourceId String

The name of the Long Term Retention backup to be used for restore of this managed database.

recoverableDatabaseId String

The resource identifier of the recoverable database associated with create operation of this database.

restorableDroppedDatabaseId String

The restorable dropped database resource id to restore when creating this database.

restorePointInTime String

Conditional. If createMode is PointInTimeRestore, this value is required. Specifies the point in time (ISO8601 format) of the source database that will be restored to create the new database.

sourceDatabaseId String

The resource identifier of the source database associated with create operation of this database.

storageContainerSasToken String

Conditional. If createMode is RestoreExternalBackup, this value is required. Specifies the storage container sas token.

storageContainerUri String

Conditional. If createMode is RestoreExternalBackup, this value is required. Specifies the uri of the storage container where backups for this restore are stored.

tags Map<String>

Resource tags.

Outputs

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

CreationDate string

Creation date of the database.

DefaultSecondaryLocation string

Geo paired region.

EarliestRestorePoint string

Earliest restore point in time for point in time restore.

FailoverGroupId string

Instance Failover Group resource identifier that this managed database belongs to.

Id string

The provider-assigned unique ID for this managed resource.

Name string

Resource name.

Status string

Status of the database.

Type string

Resource type.

CreationDate string

Creation date of the database.

DefaultSecondaryLocation string

Geo paired region.

EarliestRestorePoint string

Earliest restore point in time for point in time restore.

FailoverGroupId string

Instance Failover Group resource identifier that this managed database belongs to.

Id string

The provider-assigned unique ID for this managed resource.

Name string

Resource name.

Status string

Status of the database.

Type string

Resource type.

creationDate String

Creation date of the database.

defaultSecondaryLocation String

Geo paired region.

earliestRestorePoint String

Earliest restore point in time for point in time restore.

failoverGroupId String

Instance Failover Group resource identifier that this managed database belongs to.

id String

The provider-assigned unique ID for this managed resource.

name String

Resource name.

status String

Status of the database.

type String

Resource type.

creationDate string

Creation date of the database.

defaultSecondaryLocation string

Geo paired region.

earliestRestorePoint string

Earliest restore point in time for point in time restore.

failoverGroupId string

Instance Failover Group resource identifier that this managed database belongs to.

id string

The provider-assigned unique ID for this managed resource.

name string

Resource name.

status string

Status of the database.

type string

Resource type.

creation_date str

Creation date of the database.

default_secondary_location str

Geo paired region.

earliest_restore_point str

Earliest restore point in time for point in time restore.

failover_group_id str

Instance Failover Group resource identifier that this managed database belongs to.

id str

The provider-assigned unique ID for this managed resource.

name str

Resource name.

status str

Status of the database.

type str

Resource type.

creationDate String

Creation date of the database.

defaultSecondaryLocation String

Geo paired region.

earliestRestorePoint String

Earliest restore point in time for point in time restore.

failoverGroupId String

Instance Failover Group resource identifier that this managed database belongs to.

id String

The provider-assigned unique ID for this managed resource.

name String

Resource name.

status String

Status of the database.

type String

Resource type.

Supporting Types

CatalogCollationType

DATABASE_DEFAULT
DATABASE_DEFAULT
SQL_Latin1_General_CP1_CI_AS
SQL_Latin1_General_CP1_CI_AS
CatalogCollationType_DATABASE_DEFAULT
DATABASE_DEFAULT
CatalogCollationType_SQL_Latin1_General_CP1_CI_AS
SQL_Latin1_General_CP1_CI_AS
DATABASE_DEFAULT
DATABASE_DEFAULT
SQL_Latin1_General_CP1_CI_AS
SQL_Latin1_General_CP1_CI_AS
DATABASE_DEFAULT
DATABASE_DEFAULT
SQL_Latin1_General_CP1_CI_AS
SQL_Latin1_General_CP1_CI_AS
DATABAS_E_DEFAULT
DATABASE_DEFAULT
SQ_L_LATIN1_GENERAL_CP1_C_I_AS
SQL_Latin1_General_CP1_CI_AS
"DATABASE_DEFAULT"
DATABASE_DEFAULT
"SQL_Latin1_General_CP1_CI_AS"
SQL_Latin1_General_CP1_CI_AS

ManagedDatabaseCreateMode

Default
Default
RestoreExternalBackup
RestoreExternalBackup
PointInTimeRestore
PointInTimeRestore
Recovery
Recovery
RestoreLongTermRetentionBackup
RestoreLongTermRetentionBackup
ManagedDatabaseCreateModeDefault
Default
ManagedDatabaseCreateModeRestoreExternalBackup
RestoreExternalBackup
ManagedDatabaseCreateModePointInTimeRestore
PointInTimeRestore
ManagedDatabaseCreateModeRecovery
Recovery
ManagedDatabaseCreateModeRestoreLongTermRetentionBackup
RestoreLongTermRetentionBackup
Default
Default
RestoreExternalBackup
RestoreExternalBackup
PointInTimeRestore
PointInTimeRestore
Recovery
Recovery
RestoreLongTermRetentionBackup
RestoreLongTermRetentionBackup
Default
Default
RestoreExternalBackup
RestoreExternalBackup
PointInTimeRestore
PointInTimeRestore
Recovery
Recovery
RestoreLongTermRetentionBackup
RestoreLongTermRetentionBackup
DEFAULT
Default
RESTORE_EXTERNAL_BACKUP
RestoreExternalBackup
POINT_IN_TIME_RESTORE
PointInTimeRestore
RECOVERY
Recovery
RESTORE_LONG_TERM_RETENTION_BACKUP
RestoreLongTermRetentionBackup
"Default"
Default
"RestoreExternalBackup"
RestoreExternalBackup
"PointInTimeRestore"
PointInTimeRestore
"Recovery"
Recovery
"RestoreLongTermRetentionBackup"
RestoreLongTermRetentionBackup

Import

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

$ pulumi import azure-native:sql:ManagedDatabase testdb1 /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/managedInstances/testsvr/databases/testdb1 

Package Details

Repository
Azure Native pulumi/pulumi-azure-native
License
Apache-2.0