1. Packages
  2. Azure Classic
  3. API Docs
  4. mssql
  5. ManagedDatabase

We recommend using Azure Native.

Viewing docs for Azure v4.42.0 (Older version)
published on Monday, Mar 9, 2026 by Pulumi
azure logo

We recommend using Azure Native.

Viewing docs for Azure v4.42.0 (Older version)
published on Monday, Mar 9, 2026 by Pulumi

    Manages an Azure SQL Azure Managed Database for a SQL Managed Instance.

    Example Usage

    using Pulumi;
    using Azure = Pulumi.Azure;
    
    class MyStack : Stack
    {
        public MyStack()
        {
            var example = new Azure.MSSql.ManagedDatabase("example", new Azure.MSSql.ManagedDatabaseArgs
            {
                ManagedInstanceId = azurerm_mssql_managed_instance.Example.Id,
            });
        }
    
    }
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-azure/sdk/v4/go/azure/mssql"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := mssql.NewManagedDatabase(ctx, "example", &mssql.ManagedDatabaseArgs{
    			ManagedInstanceId: pulumi.Any(azurerm_mssql_managed_instance.Example.Id),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    

    Example coming soon!

    import * as pulumi from "@pulumi/pulumi";
    import * as azure from "@pulumi/azure";
    
    const example = new azure.mssql.ManagedDatabase("example", {managedInstanceId: azurerm_mssql_managed_instance.example.id});
    
    import pulumi
    import pulumi_azure as azure
    
    example = azure.mssql.ManagedDatabase("example", managed_instance_id=azurerm_mssql_managed_instance["example"]["id"])
    

    Example coming soon!

    Create ManagedDatabase Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new ManagedDatabase(name: string, args: ManagedDatabaseArgs, opts?: CustomResourceOptions);
    @overload
    def ManagedDatabase(resource_name: str,
                        args: ManagedDatabaseArgs,
                        opts: Optional[ResourceOptions] = None)
    
    @overload
    def ManagedDatabase(resource_name: str,
                        opts: Optional[ResourceOptions] = None,
                        managed_instance_id: Optional[str] = None,
                        name: Optional[str] = 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:mssql:ManagedDatabase
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    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.

    Constructor example

    The following reference example uses placeholder values for all input properties.

    var managedDatabaseResource = new Azure.MSSql.ManagedDatabase("managedDatabaseResource", new()
    {
        ManagedInstanceId = "string",
        Name = "string",
    });
    
    example, err := mssql.NewManagedDatabase(ctx, "managedDatabaseResource", &mssql.ManagedDatabaseArgs{
    	ManagedInstanceId: pulumi.String("string"),
    	Name:              pulumi.String("string"),
    })
    
    var managedDatabaseResource = new com.pulumi.azure.mssql.ManagedDatabase("managedDatabaseResource", com.pulumi.azure.mssql.ManagedDatabaseArgs.builder()
        .managedInstanceId("string")
        .name("string")
        .build());
    
    managed_database_resource = azure.mssql.ManagedDatabase("managedDatabaseResource",
        managed_instance_id="string",
        name="string")
    
    const managedDatabaseResource = new azure.mssql.ManagedDatabase("managedDatabaseResource", {
        managedInstanceId: "string",
        name: "string",
    });
    
    type: azure:mssql:ManagedDatabase
    properties:
        managedInstanceId: string
        name: string
    

    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

    In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

    The ManagedDatabase resource accepts the following input properties:

    ManagedInstanceId string
    The ID of the Azure SQL Managed Instance on which to create this Managed Database. Changing this forces a new resource to be created.
    Name string
    The name of the Managed Database to create. Changing this forces a new resource to be created.
    ManagedInstanceId string
    The ID of the Azure SQL Managed Instance on which to create this Managed Database. Changing this forces a new resource to be created.
    Name string
    The name of the Managed Database to create. Changing this forces a new resource to be created.
    managedInstanceId String
    The ID of the Azure SQL Managed Instance on which to create this Managed Database. Changing this forces a new resource to be created.
    name String
    The name of the Managed Database to create. Changing this forces a new resource to be created.
    managedInstanceId string
    The ID of the Azure SQL Managed Instance on which to create this Managed Database. Changing this forces a new resource to be created.
    name string
    The name of the Managed Database to create. Changing this forces a new resource to be created.
    managed_instance_id str
    The ID of the Azure SQL Managed Instance on which to create this Managed Database. Changing this forces a new resource to be created.
    name str
    The name of the Managed Database to create. Changing this forces a new resource to be created.
    managedInstanceId String
    The ID of the Azure SQL Managed Instance on which to create this Managed Database. Changing this forces a new resource to be created.
    name String
    The name of the Managed Database to create. Changing this forces a new resource to be created.

    Outputs

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

    Id string
    The provider-assigned unique ID for this managed resource.
    Id string
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.
    id string
    The provider-assigned unique ID for this managed resource.
    id str
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.

    Look up Existing ManagedDatabase Resource

    Get an existing ManagedDatabase resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

    public static get(name: string, id: Input<ID>, state?: ManagedDatabaseState, opts?: CustomResourceOptions): ManagedDatabase
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            managed_instance_id: Optional[str] = None,
            name: Optional[str] = None) -> ManagedDatabase
    func GetManagedDatabase(ctx *Context, name string, id IDInput, state *ManagedDatabaseState, opts ...ResourceOption) (*ManagedDatabase, error)
    public static ManagedDatabase Get(string name, Input<string> id, ManagedDatabaseState? state, CustomResourceOptions? opts = null)
    public static ManagedDatabase get(String name, Output<String> id, ManagedDatabaseState state, CustomResourceOptions options)
    resources:  _:    type: azure:mssql:ManagedDatabase    get:      id: ${id}
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    resource_name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    The following state arguments are supported:
    ManagedInstanceId string
    The ID of the Azure SQL Managed Instance on which to create this Managed Database. Changing this forces a new resource to be created.
    Name string
    The name of the Managed Database to create. Changing this forces a new resource to be created.
    ManagedInstanceId string
    The ID of the Azure SQL Managed Instance on which to create this Managed Database. Changing this forces a new resource to be created.
    Name string
    The name of the Managed Database to create. Changing this forces a new resource to be created.
    managedInstanceId String
    The ID of the Azure SQL Managed Instance on which to create this Managed Database. Changing this forces a new resource to be created.
    name String
    The name of the Managed Database to create. Changing this forces a new resource to be created.
    managedInstanceId string
    The ID of the Azure SQL Managed Instance on which to create this Managed Database. Changing this forces a new resource to be created.
    name string
    The name of the Managed Database to create. Changing this forces a new resource to be created.
    managed_instance_id str
    The ID of the Azure SQL Managed Instance on which to create this Managed Database. Changing this forces a new resource to be created.
    name str
    The name of the Managed Database to create. Changing this forces a new resource to be created.
    managedInstanceId String
    The ID of the Azure SQL Managed Instance on which to create this Managed Database. Changing this forces a new resource to be created.
    name String
    The name of the Managed Database to create. Changing this forces a new resource to be created.

    Import

    SQL Managed Databases can be imported using the resource id, e.g.

     $ pulumi import azure:mssql/managedDatabase:ManagedDatabase example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myresourcegroup/providers/Microsoft.Sql/managedInstances/myserver/databases/mydatabase
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    Azure Classic pulumi/pulumi-azure
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the azurerm Terraform Provider.
    azure logo

    We recommend using Azure Native.

    Viewing docs for Azure v4.42.0 (Older version)
    published on Monday, Mar 9, 2026 by Pulumi
      Try Pulumi Cloud free. Your team will thank you.