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

We recommend using Azure Native.

Azure Classic v5.72.0 published on Monday, Apr 15, 2024 by Pulumi

azure.sql.ManagedDatabase

Explore with Pulumi AI

azure logo

We recommend using Azure Native.

Azure Classic v5.72.0 published on Monday, Apr 15, 2024 by Pulumi

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as azure from "@pulumi/azure";
    
    const example = new azure.core.ResourceGroup("example", {
        name: "rg-example",
        location: "West Europe",
    });
    const exampleVirtualNetwork = new azure.network.VirtualNetwork("example", {
        name: "test-network",
        addressSpaces: ["10.0.0.0/16"],
        location: example.location,
        resourceGroupName: example.name,
    });
    const exampleSubnet = new azure.network.Subnet("example", {
        name: "acctsub",
        resourceGroupName: example.name,
        virtualNetworkName: exampleVirtualNetwork.name,
        addressPrefixes: ["10.0.2.0/24"],
    });
    const exampleManagedInstance = new azure.sql.ManagedInstance("example", {
        name: "example",
        resourceGroupName: example.name,
        location: example.location,
        administratorLogin: "mradministrator",
        administratorLoginPassword: "thisIsDog11",
        licenseType: "BasePrice",
        subnetId: exampleSubnet.id,
        skuName: "GP_Gen5",
        vcores: 4,
        storageSizeInGb: 32,
    });
    const exampleManagedDatabase = new azure.sql.ManagedDatabase("example", {
        sqlManagedInstanceId: exampleManagedInstance.id,
        name: "exampledatabase",
        location: example.location,
    });
    
    import pulumi
    import pulumi_azure as azure
    
    example = azure.core.ResourceGroup("example",
        name="rg-example",
        location="West Europe")
    example_virtual_network = azure.network.VirtualNetwork("example",
        name="test-network",
        address_spaces=["10.0.0.0/16"],
        location=example.location,
        resource_group_name=example.name)
    example_subnet = azure.network.Subnet("example",
        name="acctsub",
        resource_group_name=example.name,
        virtual_network_name=example_virtual_network.name,
        address_prefixes=["10.0.2.0/24"])
    example_managed_instance = azure.sql.ManagedInstance("example",
        name="example",
        resource_group_name=example.name,
        location=example.location,
        administrator_login="mradministrator",
        administrator_login_password="thisIsDog11",
        license_type="BasePrice",
        subnet_id=example_subnet.id,
        sku_name="GP_Gen5",
        vcores=4,
        storage_size_in_gb=32)
    example_managed_database = azure.sql.ManagedDatabase("example",
        sql_managed_instance_id=example_managed_instance.id,
        name="exampledatabase",
        location=example.location)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
    	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/network"
    	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/sql"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		example, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
    			Name:     pulumi.String("rg-example"),
    			Location: pulumi.String("West Europe"),
    		})
    		if err != nil {
    			return err
    		}
    		exampleVirtualNetwork, err := network.NewVirtualNetwork(ctx, "example", &network.VirtualNetworkArgs{
    			Name: pulumi.String("test-network"),
    			AddressSpaces: pulumi.StringArray{
    				pulumi.String("10.0.0.0/16"),
    			},
    			Location:          example.Location,
    			ResourceGroupName: example.Name,
    		})
    		if err != nil {
    			return err
    		}
    		exampleSubnet, err := network.NewSubnet(ctx, "example", &network.SubnetArgs{
    			Name:               pulumi.String("acctsub"),
    			ResourceGroupName:  example.Name,
    			VirtualNetworkName: exampleVirtualNetwork.Name,
    			AddressPrefixes: pulumi.StringArray{
    				pulumi.String("10.0.2.0/24"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		exampleManagedInstance, err := sql.NewManagedInstance(ctx, "example", &sql.ManagedInstanceArgs{
    			Name:                       pulumi.String("example"),
    			ResourceGroupName:          example.Name,
    			Location:                   example.Location,
    			AdministratorLogin:         pulumi.String("mradministrator"),
    			AdministratorLoginPassword: pulumi.String("thisIsDog11"),
    			LicenseType:                pulumi.String("BasePrice"),
    			SubnetId:                   exampleSubnet.ID(),
    			SkuName:                    pulumi.String("GP_Gen5"),
    			Vcores:                     pulumi.Int(4),
    			StorageSizeInGb:            pulumi.Int(32),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = sql.NewManagedDatabase(ctx, "example", &sql.ManagedDatabaseArgs{
    			SqlManagedInstanceId: exampleManagedInstance.ID(),
    			Name:                 pulumi.String("exampledatabase"),
    			Location:             example.Location,
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Azure = Pulumi.Azure;
    
    return await Deployment.RunAsync(() => 
    {
        var example = new Azure.Core.ResourceGroup("example", new()
        {
            Name = "rg-example",
            Location = "West Europe",
        });
    
        var exampleVirtualNetwork = new Azure.Network.VirtualNetwork("example", new()
        {
            Name = "test-network",
            AddressSpaces = new[]
            {
                "10.0.0.0/16",
            },
            Location = example.Location,
            ResourceGroupName = example.Name,
        });
    
        var exampleSubnet = new Azure.Network.Subnet("example", new()
        {
            Name = "acctsub",
            ResourceGroupName = example.Name,
            VirtualNetworkName = exampleVirtualNetwork.Name,
            AddressPrefixes = new[]
            {
                "10.0.2.0/24",
            },
        });
    
        var exampleManagedInstance = new Azure.Sql.ManagedInstance("example", new()
        {
            Name = "example",
            ResourceGroupName = example.Name,
            Location = example.Location,
            AdministratorLogin = "mradministrator",
            AdministratorLoginPassword = "thisIsDog11",
            LicenseType = "BasePrice",
            SubnetId = exampleSubnet.Id,
            SkuName = "GP_Gen5",
            Vcores = 4,
            StorageSizeInGb = 32,
        });
    
        var exampleManagedDatabase = new Azure.Sql.ManagedDatabase("example", new()
        {
            SqlManagedInstanceId = exampleManagedInstance.Id,
            Name = "exampledatabase",
            Location = example.Location,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.azure.core.ResourceGroup;
    import com.pulumi.azure.core.ResourceGroupArgs;
    import com.pulumi.azure.network.VirtualNetwork;
    import com.pulumi.azure.network.VirtualNetworkArgs;
    import com.pulumi.azure.network.Subnet;
    import com.pulumi.azure.network.SubnetArgs;
    import com.pulumi.azure.sql.ManagedInstance;
    import com.pulumi.azure.sql.ManagedInstanceArgs;
    import com.pulumi.azure.sql.ManagedDatabase;
    import com.pulumi.azure.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 example = new ResourceGroup("example", ResourceGroupArgs.builder()        
                .name("rg-example")
                .location("West Europe")
                .build());
    
            var exampleVirtualNetwork = new VirtualNetwork("exampleVirtualNetwork", VirtualNetworkArgs.builder()        
                .name("test-network")
                .addressSpaces("10.0.0.0/16")
                .location(example.location())
                .resourceGroupName(example.name())
                .build());
    
            var exampleSubnet = new Subnet("exampleSubnet", SubnetArgs.builder()        
                .name("acctsub")
                .resourceGroupName(example.name())
                .virtualNetworkName(exampleVirtualNetwork.name())
                .addressPrefixes("10.0.2.0/24")
                .build());
    
            var exampleManagedInstance = new ManagedInstance("exampleManagedInstance", ManagedInstanceArgs.builder()        
                .name("example")
                .resourceGroupName(example.name())
                .location(example.location())
                .administratorLogin("mradministrator")
                .administratorLoginPassword("thisIsDog11")
                .licenseType("BasePrice")
                .subnetId(exampleSubnet.id())
                .skuName("GP_Gen5")
                .vcores(4)
                .storageSizeInGb(32)
                .build());
    
            var exampleManagedDatabase = new ManagedDatabase("exampleManagedDatabase", ManagedDatabaseArgs.builder()        
                .sqlManagedInstanceId(exampleManagedInstance.id())
                .name("exampledatabase")
                .location(example.location())
                .build());
    
        }
    }
    
    resources:
      example:
        type: azure:core:ResourceGroup
        properties:
          name: rg-example
          location: West Europe
      exampleVirtualNetwork:
        type: azure:network:VirtualNetwork
        name: example
        properties:
          name: test-network
          addressSpaces:
            - 10.0.0.0/16
          location: ${example.location}
          resourceGroupName: ${example.name}
      exampleSubnet:
        type: azure:network:Subnet
        name: example
        properties:
          name: acctsub
          resourceGroupName: ${example.name}
          virtualNetworkName: ${exampleVirtualNetwork.name}
          addressPrefixes:
            - 10.0.2.0/24
      exampleManagedInstance:
        type: azure:sql:ManagedInstance
        name: example
        properties:
          name: example
          resourceGroupName: ${example.name}
          location: ${example.location}
          administratorLogin: mradministrator
          administratorLoginPassword: thisIsDog11
          licenseType: BasePrice
          subnetId: ${exampleSubnet.id}
          skuName: GP_Gen5
          vcores: 4
          storageSizeInGb: 32
      exampleManagedDatabase:
        type: azure:sql:ManagedDatabase
        name: example
        properties:
          sqlManagedInstanceId: ${exampleManagedInstance.id}
          name: exampledatabase
          location: ${example.location}
    

    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,
                        sql_managed_instance_id: Optional[str] = None,
                        location: 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:sql: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.

    Example

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

    var azureManagedDatabaseResource = new Azure.Sql.ManagedDatabase("azureManagedDatabaseResource", new()
    {
        SqlManagedInstanceId = "string",
        Location = "string",
        Name = "string",
    });
    
    example, err := sql.NewManagedDatabase(ctx, "azureManagedDatabaseResource", &sql.ManagedDatabaseArgs{
    	SqlManagedInstanceId: pulumi.String("string"),
    	Location:             pulumi.String("string"),
    	Name:                 pulumi.String("string"),
    })
    
    var azureManagedDatabaseResource = new ManagedDatabase("azureManagedDatabaseResource", ManagedDatabaseArgs.builder()        
        .sqlManagedInstanceId("string")
        .location("string")
        .name("string")
        .build());
    
    azure_managed_database_resource = azure.sql.ManagedDatabase("azureManagedDatabaseResource",
        sql_managed_instance_id="string",
        location="string",
        name="string")
    
    const azureManagedDatabaseResource = new azure.sql.ManagedDatabase("azureManagedDatabaseResource", {
        sqlManagedInstanceId: "string",
        location: "string",
        name: "string",
    });
    
    type: azure:sql:ManagedDatabase
    properties:
        location: string
        name: string
        sqlManagedInstanceId: 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

    The ManagedDatabase resource accepts the following input properties:

    SqlManagedInstanceId string
    The SQL Managed Instance ID that this Managed Database will be associated with. Changing this forces a new resource to be created.
    Location string
    Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.
    Name string
    The name of the SQL Managed Database. Changing this forces a new resource to be created.
    SqlManagedInstanceId string
    The SQL Managed Instance ID that this Managed Database will be associated with. Changing this forces a new resource to be created.
    Location string
    Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.
    Name string
    The name of the SQL Managed Database. Changing this forces a new resource to be created.
    sqlManagedInstanceId String
    The SQL Managed Instance ID that this Managed Database will be associated with. Changing this forces a new resource to be created.
    location String
    Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.
    name String
    The name of the SQL Managed Database. Changing this forces a new resource to be created.
    sqlManagedInstanceId string
    The SQL Managed Instance ID that this Managed Database will be associated with. Changing this forces a new resource to be created.
    location string
    Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.
    name string
    The name of the SQL Managed Database. Changing this forces a new resource to be created.
    sql_managed_instance_id str
    The SQL Managed Instance ID that this Managed Database will be associated with. Changing this forces a new resource to be created.
    location str
    Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.
    name str
    The name of the SQL Managed Database. Changing this forces a new resource to be created.
    sqlManagedInstanceId String
    The SQL Managed Instance ID that this Managed Database will be associated with. Changing this forces a new resource to be created.
    location String
    Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.
    name String
    The name of the SQL Managed Database. 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,
            location: Optional[str] = None,
            name: Optional[str] = None,
            sql_managed_instance_id: 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)
    Resource lookup is not supported in YAML
    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:
    Location string
    Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.
    Name string
    The name of the SQL Managed Database. Changing this forces a new resource to be created.
    SqlManagedInstanceId string
    The SQL Managed Instance ID that this Managed Database will be associated with. Changing this forces a new resource to be created.
    Location string
    Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.
    Name string
    The name of the SQL Managed Database. Changing this forces a new resource to be created.
    SqlManagedInstanceId string
    The SQL Managed Instance ID that this Managed Database will be associated with. Changing this forces a new resource to be created.
    location String
    Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.
    name String
    The name of the SQL Managed Database. Changing this forces a new resource to be created.
    sqlManagedInstanceId String
    The SQL Managed Instance ID that this Managed Database will be associated with. Changing this forces a new resource to be created.
    location string
    Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.
    name string
    The name of the SQL Managed Database. Changing this forces a new resource to be created.
    sqlManagedInstanceId string
    The SQL Managed Instance ID that this Managed Database will be associated with. Changing this forces a new resource to be created.
    location str
    Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.
    name str
    The name of the SQL Managed Database. Changing this forces a new resource to be created.
    sql_managed_instance_id str
    The SQL Managed Instance ID that this Managed Database will be associated with. Changing this forces a new resource to be created.
    location String
    Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.
    name String
    The name of the SQL Managed Database. Changing this forces a new resource to be created.
    sqlManagedInstanceId String
    The SQL Managed Instance ID that this Managed Database will be associated with. 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:sql/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.

    Azure Classic v5.72.0 published on Monday, Apr 15, 2024 by Pulumi