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

We recommend using Azure Native.

Azure v6.22.0 published on Tuesday, Apr 1, 2025 by Pulumi

azure.mssql.ServerDnsAlias

Explore with Pulumi AI

Manages a MS SQL Server DNS Alias.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";

const example = new azure.core.ResourceGroup("example", {
    name: "example-resources",
    location: "West Europe",
});
const exampleServer = new azure.mssql.Server("example", {
    name: "example-sqlserver",
    resourceGroupName: example.name,
    location: example.location,
    version: "12.0",
    administratorLogin: "missadministrator",
    administratorLoginPassword: "AdminPassword123!",
});
const exampleServerDnsAlias = new azure.mssql.ServerDnsAlias("example", {
    name: "example-dns-alias",
    mssqlServerId: exampleServer.id,
});
Copy
import pulumi
import pulumi_azure as azure

example = azure.core.ResourceGroup("example",
    name="example-resources",
    location="West Europe")
example_server = azure.mssql.Server("example",
    name="example-sqlserver",
    resource_group_name=example.name,
    location=example.location,
    version="12.0",
    administrator_login="missadministrator",
    administrator_login_password="AdminPassword123!")
example_server_dns_alias = azure.mssql.ServerDnsAlias("example",
    name="example-dns-alias",
    mssql_server_id=example_server.id)
Copy
package main

import (
	"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/core"
	"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/mssql"
	"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("example-resources"),
			Location: pulumi.String("West Europe"),
		})
		if err != nil {
			return err
		}
		exampleServer, err := mssql.NewServer(ctx, "example", &mssql.ServerArgs{
			Name:                       pulumi.String("example-sqlserver"),
			ResourceGroupName:          example.Name,
			Location:                   example.Location,
			Version:                    pulumi.String("12.0"),
			AdministratorLogin:         pulumi.String("missadministrator"),
			AdministratorLoginPassword: pulumi.String("AdminPassword123!"),
		})
		if err != nil {
			return err
		}
		_, err = mssql.NewServerDnsAlias(ctx, "example", &mssql.ServerDnsAliasArgs{
			Name:          pulumi.String("example-dns-alias"),
			MssqlServerId: exampleServer.ID(),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
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 = "example-resources",
        Location = "West Europe",
    });

    var exampleServer = new Azure.MSSql.Server("example", new()
    {
        Name = "example-sqlserver",
        ResourceGroupName = example.Name,
        Location = example.Location,
        Version = "12.0",
        AdministratorLogin = "missadministrator",
        AdministratorLoginPassword = "AdminPassword123!",
    });

    var exampleServerDnsAlias = new Azure.MSSql.ServerDnsAlias("example", new()
    {
        Name = "example-dns-alias",
        MssqlServerId = exampleServer.Id,
    });

});
Copy
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.mssql.Server;
import com.pulumi.azure.mssql.ServerArgs;
import com.pulumi.azure.mssql.ServerDnsAlias;
import com.pulumi.azure.mssql.ServerDnsAliasArgs;
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("example-resources")
            .location("West Europe")
            .build());

        var exampleServer = new Server("exampleServer", ServerArgs.builder()
            .name("example-sqlserver")
            .resourceGroupName(example.name())
            .location(example.location())
            .version("12.0")
            .administratorLogin("missadministrator")
            .administratorLoginPassword("AdminPassword123!")
            .build());

        var exampleServerDnsAlias = new ServerDnsAlias("exampleServerDnsAlias", ServerDnsAliasArgs.builder()
            .name("example-dns-alias")
            .mssqlServerId(exampleServer.id())
            .build());

    }
}
Copy
resources:
  example:
    type: azure:core:ResourceGroup
    properties:
      name: example-resources
      location: West Europe
  exampleServer:
    type: azure:mssql:Server
    name: example
    properties:
      name: example-sqlserver
      resourceGroupName: ${example.name}
      location: ${example.location}
      version: '12.0'
      administratorLogin: missadministrator
      administratorLoginPassword: AdminPassword123!
  exampleServerDnsAlias:
    type: azure:mssql:ServerDnsAlias
    name: example
    properties:
      name: example-dns-alias
      mssqlServerId: ${exampleServer.id}
Copy

Create ServerDnsAlias Resource

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

Constructor syntax

new ServerDnsAlias(name: string, args: ServerDnsAliasArgs, opts?: CustomResourceOptions);
@overload
def ServerDnsAlias(resource_name: str,
                   args: ServerDnsAliasArgs,
                   opts: Optional[ResourceOptions] = None)

@overload
def ServerDnsAlias(resource_name: str,
                   opts: Optional[ResourceOptions] = None,
                   mssql_server_id: Optional[str] = None,
                   name: Optional[str] = None)
func NewServerDnsAlias(ctx *Context, name string, args ServerDnsAliasArgs, opts ...ResourceOption) (*ServerDnsAlias, error)
public ServerDnsAlias(string name, ServerDnsAliasArgs args, CustomResourceOptions? opts = null)
public ServerDnsAlias(String name, ServerDnsAliasArgs args)
public ServerDnsAlias(String name, ServerDnsAliasArgs args, CustomResourceOptions options)
type: azure:mssql:ServerDnsAlias
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. ServerDnsAliasArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. ServerDnsAliasArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. ServerDnsAliasArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. ServerDnsAliasArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. ServerDnsAliasArgs
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 serverDnsAliasResource = new Azure.MSSql.ServerDnsAlias("serverDnsAliasResource", new()
{
    MssqlServerId = "string",
    Name = "string",
});
Copy
example, err := mssql.NewServerDnsAlias(ctx, "serverDnsAliasResource", &mssql.ServerDnsAliasArgs{
	MssqlServerId: pulumi.String("string"),
	Name:          pulumi.String("string"),
})
Copy
var serverDnsAliasResource = new ServerDnsAlias("serverDnsAliasResource", ServerDnsAliasArgs.builder()
    .mssqlServerId("string")
    .name("string")
    .build());
Copy
server_dns_alias_resource = azure.mssql.ServerDnsAlias("serverDnsAliasResource",
    mssql_server_id="string",
    name="string")
Copy
const serverDnsAliasResource = new azure.mssql.ServerDnsAlias("serverDnsAliasResource", {
    mssqlServerId: "string",
    name: "string",
});
Copy
type: azure:mssql:ServerDnsAlias
properties:
    mssqlServerId: string
    name: string
Copy

ServerDnsAlias 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 ServerDnsAlias resource accepts the following input properties:

MssqlServerId
This property is required.
Changes to this property will trigger replacement.
string
The ID of the mssql server. Changing this forces a new MSSQL Server DNS Alias to be created.
Name Changes to this property will trigger replacement. string
The name which should be used for this MSSQL Server DNS Alias. Changing this forces a new MSSQL Server DNS Alias to be created.
MssqlServerId
This property is required.
Changes to this property will trigger replacement.
string
The ID of the mssql server. Changing this forces a new MSSQL Server DNS Alias to be created.
Name Changes to this property will trigger replacement. string
The name which should be used for this MSSQL Server DNS Alias. Changing this forces a new MSSQL Server DNS Alias to be created.
mssqlServerId
This property is required.
Changes to this property will trigger replacement.
String
The ID of the mssql server. Changing this forces a new MSSQL Server DNS Alias to be created.
name Changes to this property will trigger replacement. String
The name which should be used for this MSSQL Server DNS Alias. Changing this forces a new MSSQL Server DNS Alias to be created.
mssqlServerId
This property is required.
Changes to this property will trigger replacement.
string
The ID of the mssql server. Changing this forces a new MSSQL Server DNS Alias to be created.
name Changes to this property will trigger replacement. string
The name which should be used for this MSSQL Server DNS Alias. Changing this forces a new MSSQL Server DNS Alias to be created.
mssql_server_id
This property is required.
Changes to this property will trigger replacement.
str
The ID of the mssql server. Changing this forces a new MSSQL Server DNS Alias to be created.
name Changes to this property will trigger replacement. str
The name which should be used for this MSSQL Server DNS Alias. Changing this forces a new MSSQL Server DNS Alias to be created.
mssqlServerId
This property is required.
Changes to this property will trigger replacement.
String
The ID of the mssql server. Changing this forces a new MSSQL Server DNS Alias to be created.
name Changes to this property will trigger replacement. String
The name which should be used for this MSSQL Server DNS Alias. Changing this forces a new MSSQL Server DNS Alias to be created.

Outputs

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

DnsRecord string
The fully qualified DNS record for alias.
Id string
The provider-assigned unique ID for this managed resource.
DnsRecord string
The fully qualified DNS record for alias.
Id string
The provider-assigned unique ID for this managed resource.
dnsRecord String
The fully qualified DNS record for alias.
id String
The provider-assigned unique ID for this managed resource.
dnsRecord string
The fully qualified DNS record for alias.
id string
The provider-assigned unique ID for this managed resource.
dns_record str
The fully qualified DNS record for alias.
id str
The provider-assigned unique ID for this managed resource.
dnsRecord String
The fully qualified DNS record for alias.
id String
The provider-assigned unique ID for this managed resource.

Look up Existing ServerDnsAlias Resource

Get an existing ServerDnsAlias 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?: ServerDnsAliasState, opts?: CustomResourceOptions): ServerDnsAlias
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        dns_record: Optional[str] = None,
        mssql_server_id: Optional[str] = None,
        name: Optional[str] = None) -> ServerDnsAlias
func GetServerDnsAlias(ctx *Context, name string, id IDInput, state *ServerDnsAliasState, opts ...ResourceOption) (*ServerDnsAlias, error)
public static ServerDnsAlias Get(string name, Input<string> id, ServerDnsAliasState? state, CustomResourceOptions? opts = null)
public static ServerDnsAlias get(String name, Output<String> id, ServerDnsAliasState state, CustomResourceOptions options)
resources:  _:    type: azure:mssql:ServerDnsAlias    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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:
DnsRecord string
The fully qualified DNS record for alias.
MssqlServerId Changes to this property will trigger replacement. string
The ID of the mssql server. Changing this forces a new MSSQL Server DNS Alias to be created.
Name Changes to this property will trigger replacement. string
The name which should be used for this MSSQL Server DNS Alias. Changing this forces a new MSSQL Server DNS Alias to be created.
DnsRecord string
The fully qualified DNS record for alias.
MssqlServerId Changes to this property will trigger replacement. string
The ID of the mssql server. Changing this forces a new MSSQL Server DNS Alias to be created.
Name Changes to this property will trigger replacement. string
The name which should be used for this MSSQL Server DNS Alias. Changing this forces a new MSSQL Server DNS Alias to be created.
dnsRecord String
The fully qualified DNS record for alias.
mssqlServerId Changes to this property will trigger replacement. String
The ID of the mssql server. Changing this forces a new MSSQL Server DNS Alias to be created.
name Changes to this property will trigger replacement. String
The name which should be used for this MSSQL Server DNS Alias. Changing this forces a new MSSQL Server DNS Alias to be created.
dnsRecord string
The fully qualified DNS record for alias.
mssqlServerId Changes to this property will trigger replacement. string
The ID of the mssql server. Changing this forces a new MSSQL Server DNS Alias to be created.
name Changes to this property will trigger replacement. string
The name which should be used for this MSSQL Server DNS Alias. Changing this forces a new MSSQL Server DNS Alias to be created.
dns_record str
The fully qualified DNS record for alias.
mssql_server_id Changes to this property will trigger replacement. str
The ID of the mssql server. Changing this forces a new MSSQL Server DNS Alias to be created.
name Changes to this property will trigger replacement. str
The name which should be used for this MSSQL Server DNS Alias. Changing this forces a new MSSQL Server DNS Alias to be created.
dnsRecord String
The fully qualified DNS record for alias.
mssqlServerId Changes to this property will trigger replacement. String
The ID of the mssql server. Changing this forces a new MSSQL Server DNS Alias to be created.
name Changes to this property will trigger replacement. String
The name which should be used for this MSSQL Server DNS Alias. Changing this forces a new MSSQL Server DNS Alias to be created.

Import

MSSQL Server DNS Aliass can be imported using the resource id, e.g.

$ pulumi import azure:mssql/serverDnsAlias:ServerDnsAlias example /subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/dnsAliases/default
Copy

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.