1. Packages
  2. Packages
  3. Azure Classic
  4. API Docs
  5. appservice
  6. StaticSiteCustomDomain

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

    Import

    Static Site Custom Domains can be imported using the resource id, e.g.

     $ pulumi import azure:appservice/staticSiteCustomDomain:StaticSiteCustomDomain example /subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Web/staticSites/my-static-site1/customDomains/name.contoso.com
    

    Example Usage

    CNAME validation

    using Pulumi;
    using Azure = Pulumi.Azure;
    
    class MyStack : Stack
    {
        public MyStack()
        {
            var exampleResourceGroup = new Azure.Core.ResourceGroup("exampleResourceGroup", new Azure.Core.ResourceGroupArgs
            {
                Location = "West Europe",
            });
            var exampleStaticSite = new Azure.AppService.StaticSite("exampleStaticSite", new Azure.AppService.StaticSiteArgs
            {
                ResourceGroupName = exampleResourceGroup.Name,
                Location = exampleResourceGroup.Location,
            });
            var exampleCNameRecord = new Azure.Dns.CNameRecord("exampleCNameRecord", new Azure.Dns.CNameRecordArgs
            {
                ZoneName = "contoso.com",
                ResourceGroupName = exampleResourceGroup.Name,
                Ttl = 300,
                Record = exampleStaticSite.DefaultHostName,
            });
            var exampleStaticSiteCustomDomain = new Azure.AppService.StaticSiteCustomDomain("exampleStaticSiteCustomDomain", new Azure.AppService.StaticSiteCustomDomainArgs
            {
                StaticSiteId = exampleStaticSite.Id,
                DomainName = Output.Tuple(exampleCNameRecord.Name, exampleCNameRecord.ZoneName).Apply(values =>
                {
                    var name = values.Item1;
                    var zoneName = values.Item2;
                    return $"{name}.{zoneName}";
                }),
                ValidationType = "cname-delegation",
            });
        }
    
    }
    
    package main
    
    import (
    	"fmt"
    
    	"github.com/pulumi/pulumi-azure/sdk/v4/go/azure/appservice"
    	"github.com/pulumi/pulumi-azure/sdk/v4/go/azure/core"
    	"github.com/pulumi/pulumi-azure/sdk/v4/go/azure/dns"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		exampleResourceGroup, err := core.NewResourceGroup(ctx, "exampleResourceGroup", &core.ResourceGroupArgs{
    			Location: pulumi.String("West Europe"),
    		})
    		if err != nil {
    			return err
    		}
    		exampleStaticSite, err := appservice.NewStaticSite(ctx, "exampleStaticSite", &appservice.StaticSiteArgs{
    			ResourceGroupName: exampleResourceGroup.Name,
    			Location:          exampleResourceGroup.Location,
    		})
    		if err != nil {
    			return err
    		}
    		exampleCNameRecord, err := dns.NewCNameRecord(ctx, "exampleCNameRecord", &dns.CNameRecordArgs{
    			ZoneName:          pulumi.String("contoso.com"),
    			ResourceGroupName: exampleResourceGroup.Name,
    			Ttl:               pulumi.Int(300),
    			Record:            exampleStaticSite.DefaultHostName,
    		})
    		if err != nil {
    			return err
    		}
    		_, err = appservice.NewStaticSiteCustomDomain(ctx, "exampleStaticSiteCustomDomain", &appservice.StaticSiteCustomDomainArgs{
    			StaticSiteId: exampleStaticSite.ID(),
    			DomainName: pulumi.All(exampleCNameRecord.Name, exampleCNameRecord.ZoneName).ApplyT(func(_args []interface{}) (string, error) {
    				name := _args[0].(string)
    				zoneName := _args[1].(string)
    				return fmt.Sprintf("%v%v%v", name, ".", zoneName), nil
    			}).(pulumi.StringOutput),
    			ValidationType: pulumi.String("cname-delegation"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    

    Example coming soon!

    import * as pulumi from "@pulumi/pulumi";
    import * as azure from "@pulumi/azure";
    
    const exampleResourceGroup = new azure.core.ResourceGroup("exampleResourceGroup", {location: "West Europe"});
    const exampleStaticSite = new azure.appservice.StaticSite("exampleStaticSite", {
        resourceGroupName: exampleResourceGroup.name,
        location: exampleResourceGroup.location,
    });
    const exampleCNameRecord = new azure.dns.CNameRecord("exampleCNameRecord", {
        zoneName: "contoso.com",
        resourceGroupName: exampleResourceGroup.name,
        ttl: 300,
        record: exampleStaticSite.defaultHostName,
    });
    const exampleStaticSiteCustomDomain = new azure.appservice.StaticSiteCustomDomain("exampleStaticSiteCustomDomain", {
        staticSiteId: exampleStaticSite.id,
        domainName: pulumi.interpolate`${exampleCNameRecord.name}.${exampleCNameRecord.zoneName}`,
        validationType: "cname-delegation",
    });
    
    import pulumi
    import pulumi_azure as azure
    
    example_resource_group = azure.core.ResourceGroup("exampleResourceGroup", location="West Europe")
    example_static_site = azure.appservice.StaticSite("exampleStaticSite",
        resource_group_name=example_resource_group.name,
        location=example_resource_group.location)
    example_c_name_record = azure.dns.CNameRecord("exampleCNameRecord",
        zone_name="contoso.com",
        resource_group_name=example_resource_group.name,
        ttl=300,
        record=example_static_site.default_host_name)
    example_static_site_custom_domain = azure.appservice.StaticSiteCustomDomain("exampleStaticSiteCustomDomain",
        static_site_id=example_static_site.id,
        domain_name=pulumi.Output.all(example_c_name_record.name, example_c_name_record.zone_name).apply(lambda name, zone_name: f"{name}.{zone_name}"),
        validation_type="cname-delegation")
    

    Example coming soon!

    TXT validation

    using Pulumi;
    using Azure = Pulumi.Azure;
    
    class MyStack : Stack
    {
        public MyStack()
        {
            var exampleResourceGroup = new Azure.Core.ResourceGroup("exampleResourceGroup", new Azure.Core.ResourceGroupArgs
            {
                Location = "West Europe",
            });
            var exampleStaticSite = new Azure.AppService.StaticSite("exampleStaticSite", new Azure.AppService.StaticSiteArgs
            {
                ResourceGroupName = exampleResourceGroup.Name,
                Location = exampleResourceGroup.Location,
            });
            var exampleStaticSiteCustomDomain = new Azure.AppService.StaticSiteCustomDomain("exampleStaticSiteCustomDomain", new Azure.AppService.StaticSiteCustomDomainArgs
            {
                StaticSiteId = exampleStaticSite.Id,
                DomainName = $"my-domain.{azurerm_dns_cname_record.Example.Zone_name}",
                ValidationType = "dns-txt-token",
            });
            var exampleTxtRecord = new Azure.Dns.TxtRecord("exampleTxtRecord", new Azure.Dns.TxtRecordArgs
            {
                ZoneName = "contoso.com",
                ResourceGroupName = exampleResourceGroup.Name,
                Ttl = 300,
                Records = 
                {
                    new Azure.Dns.Inputs.TxtRecordRecordArgs
                    {
                        Value = exampleStaticSiteCustomDomain.ValidationToken,
                    },
                },
            });
        }
    
    }
    
    package main
    
    import (
    	"fmt"
    
    	"github.com/pulumi/pulumi-azure/sdk/v4/go/azure/appservice"
    	"github.com/pulumi/pulumi-azure/sdk/v4/go/azure/core"
    	"github.com/pulumi/pulumi-azure/sdk/v4/go/azure/dns"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		exampleResourceGroup, err := core.NewResourceGroup(ctx, "exampleResourceGroup", &core.ResourceGroupArgs{
    			Location: pulumi.String("West Europe"),
    		})
    		if err != nil {
    			return err
    		}
    		exampleStaticSite, err := appservice.NewStaticSite(ctx, "exampleStaticSite", &appservice.StaticSiteArgs{
    			ResourceGroupName: exampleResourceGroup.Name,
    			Location:          exampleResourceGroup.Location,
    		})
    		if err != nil {
    			return err
    		}
    		exampleStaticSiteCustomDomain, err := appservice.NewStaticSiteCustomDomain(ctx, "exampleStaticSiteCustomDomain", &appservice.StaticSiteCustomDomainArgs{
    			StaticSiteId:   exampleStaticSite.ID(),
    			DomainName:     pulumi.String(fmt.Sprintf("%v%v", "my-domain.", azurerm_dns_cname_record.Example.Zone_name)),
    			ValidationType: pulumi.String("dns-txt-token"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = dns.NewTxtRecord(ctx, "exampleTxtRecord", &dns.TxtRecordArgs{
    			ZoneName:          pulumi.String("contoso.com"),
    			ResourceGroupName: exampleResourceGroup.Name,
    			Ttl:               pulumi.Int(300),
    			Records: dns.TxtRecordRecordArray{
    				&dns.TxtRecordRecordArgs{
    					Value: exampleStaticSiteCustomDomain.ValidationToken,
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    

    Example coming soon!

    import * as pulumi from "@pulumi/pulumi";
    import * as azure from "@pulumi/azure";
    
    const exampleResourceGroup = new azure.core.ResourceGroup("exampleResourceGroup", {location: "West Europe"});
    const exampleStaticSite = new azure.appservice.StaticSite("exampleStaticSite", {
        resourceGroupName: exampleResourceGroup.name,
        location: exampleResourceGroup.location,
    });
    const exampleStaticSiteCustomDomain = new azure.appservice.StaticSiteCustomDomain("exampleStaticSiteCustomDomain", {
        staticSiteId: exampleStaticSite.id,
        domainName: `my-domain.${azurerm_dns_cname_record.example.zone_name}`,
        validationType: "dns-txt-token",
    });
    const exampleTxtRecord = new azure.dns.TxtRecord("exampleTxtRecord", {
        zoneName: "contoso.com",
        resourceGroupName: exampleResourceGroup.name,
        ttl: 300,
        records: [{
            value: exampleStaticSiteCustomDomain.validationToken,
        }],
    });
    
    import pulumi
    import pulumi_azure as azure
    
    example_resource_group = azure.core.ResourceGroup("exampleResourceGroup", location="West Europe")
    example_static_site = azure.appservice.StaticSite("exampleStaticSite",
        resource_group_name=example_resource_group.name,
        location=example_resource_group.location)
    example_static_site_custom_domain = azure.appservice.StaticSiteCustomDomain("exampleStaticSiteCustomDomain",
        static_site_id=example_static_site.id,
        domain_name=f"my-domain.{azurerm_dns_cname_record['example']['zone_name']}",
        validation_type="dns-txt-token")
    example_txt_record = azure.dns.TxtRecord("exampleTxtRecord",
        zone_name="contoso.com",
        resource_group_name=example_resource_group.name,
        ttl=300,
        records=[azure.dns.TxtRecordRecordArgs(
            value=example_static_site_custom_domain.validation_token,
        )])
    

    Example coming soon!

    Create StaticSiteCustomDomain Resource

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

    Constructor syntax

    new StaticSiteCustomDomain(name: string, args: StaticSiteCustomDomainArgs, opts?: CustomResourceOptions);
    @overload
    def StaticSiteCustomDomain(resource_name: str,
                               args: StaticSiteCustomDomainArgs,
                               opts: Optional[ResourceOptions] = None)
    
    @overload
    def StaticSiteCustomDomain(resource_name: str,
                               opts: Optional[ResourceOptions] = None,
                               domain_name: Optional[str] = None,
                               static_site_id: Optional[str] = None,
                               validation_type: Optional[str] = None)
    func NewStaticSiteCustomDomain(ctx *Context, name string, args StaticSiteCustomDomainArgs, opts ...ResourceOption) (*StaticSiteCustomDomain, error)
    public StaticSiteCustomDomain(string name, StaticSiteCustomDomainArgs args, CustomResourceOptions? opts = null)
    public StaticSiteCustomDomain(String name, StaticSiteCustomDomainArgs args)
    public StaticSiteCustomDomain(String name, StaticSiteCustomDomainArgs args, CustomResourceOptions options)
    
    type: azure:appservice:StaticSiteCustomDomain
    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 StaticSiteCustomDomainArgs
    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 StaticSiteCustomDomainArgs
    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 StaticSiteCustomDomainArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args StaticSiteCustomDomainArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args StaticSiteCustomDomainArgs
    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 staticSiteCustomDomainResource = new Azure.AppService.StaticSiteCustomDomain("staticSiteCustomDomainResource", new()
    {
        DomainName = "string",
        StaticSiteId = "string",
        ValidationType = "string",
    });
    
    example, err := appservice.NewStaticSiteCustomDomain(ctx, "staticSiteCustomDomainResource", &appservice.StaticSiteCustomDomainArgs{
    	DomainName:     pulumi.String("string"),
    	StaticSiteId:   pulumi.String("string"),
    	ValidationType: pulumi.String("string"),
    })
    
    var staticSiteCustomDomainResource = new StaticSiteCustomDomain("staticSiteCustomDomainResource", StaticSiteCustomDomainArgs.builder()
        .domainName("string")
        .staticSiteId("string")
        .validationType("string")
        .build());
    
    static_site_custom_domain_resource = azure.appservice.StaticSiteCustomDomain("staticSiteCustomDomainResource",
        domain_name="string",
        static_site_id="string",
        validation_type="string")
    
    const staticSiteCustomDomainResource = new azure.appservice.StaticSiteCustomDomain("staticSiteCustomDomainResource", {
        domainName: "string",
        staticSiteId: "string",
        validationType: "string",
    });
    
    type: azure:appservice:StaticSiteCustomDomain
    properties:
        domainName: string
        staticSiteId: string
        validationType: string
    

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

    DomainName string
    The Domain Name which should be associated with this Static Site. Changing this forces a new Static Site Custom Domain to be created.
    StaticSiteId string
    The ID of the Static Site. Changing this forces a new Static Site Custom Domain to be created.
    ValidationType string
    One of cname-delegation or dns-txt-token. Changing this forces a new Static Site Custom Domain to be created.
    DomainName string
    The Domain Name which should be associated with this Static Site. Changing this forces a new Static Site Custom Domain to be created.
    StaticSiteId string
    The ID of the Static Site. Changing this forces a new Static Site Custom Domain to be created.
    ValidationType string
    One of cname-delegation or dns-txt-token. Changing this forces a new Static Site Custom Domain to be created.
    domainName String
    The Domain Name which should be associated with this Static Site. Changing this forces a new Static Site Custom Domain to be created.
    staticSiteId String
    The ID of the Static Site. Changing this forces a new Static Site Custom Domain to be created.
    validationType String
    One of cname-delegation or dns-txt-token. Changing this forces a new Static Site Custom Domain to be created.
    domainName string
    The Domain Name which should be associated with this Static Site. Changing this forces a new Static Site Custom Domain to be created.
    staticSiteId string
    The ID of the Static Site. Changing this forces a new Static Site Custom Domain to be created.
    validationType string
    One of cname-delegation or dns-txt-token. Changing this forces a new Static Site Custom Domain to be created.
    domain_name str
    The Domain Name which should be associated with this Static Site. Changing this forces a new Static Site Custom Domain to be created.
    static_site_id str
    The ID of the Static Site. Changing this forces a new Static Site Custom Domain to be created.
    validation_type str
    One of cname-delegation or dns-txt-token. Changing this forces a new Static Site Custom Domain to be created.
    domainName String
    The Domain Name which should be associated with this Static Site. Changing this forces a new Static Site Custom Domain to be created.
    staticSiteId String
    The ID of the Static Site. Changing this forces a new Static Site Custom Domain to be created.
    validationType String
    One of cname-delegation or dns-txt-token. Changing this forces a new Static Site Custom Domain to be created.

    Outputs

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

    Id string
    The provider-assigned unique ID for this managed resource.
    ValidationToken string
    Token to be used with dns-txt-token validation.
    Id string
    The provider-assigned unique ID for this managed resource.
    ValidationToken string
    Token to be used with dns-txt-token validation.
    id String
    The provider-assigned unique ID for this managed resource.
    validationToken String
    Token to be used with dns-txt-token validation.
    id string
    The provider-assigned unique ID for this managed resource.
    validationToken string
    Token to be used with dns-txt-token validation.
    id str
    The provider-assigned unique ID for this managed resource.
    validation_token str
    Token to be used with dns-txt-token validation.
    id String
    The provider-assigned unique ID for this managed resource.
    validationToken String
    Token to be used with dns-txt-token validation.

    Look up Existing StaticSiteCustomDomain Resource

    Get an existing StaticSiteCustomDomain 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?: StaticSiteCustomDomainState, opts?: CustomResourceOptions): StaticSiteCustomDomain
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            domain_name: Optional[str] = None,
            static_site_id: Optional[str] = None,
            validation_token: Optional[str] = None,
            validation_type: Optional[str] = None) -> StaticSiteCustomDomain
    func GetStaticSiteCustomDomain(ctx *Context, name string, id IDInput, state *StaticSiteCustomDomainState, opts ...ResourceOption) (*StaticSiteCustomDomain, error)
    public static StaticSiteCustomDomain Get(string name, Input<string> id, StaticSiteCustomDomainState? state, CustomResourceOptions? opts = null)
    public static StaticSiteCustomDomain get(String name, Output<String> id, StaticSiteCustomDomainState state, CustomResourceOptions options)
    resources:  _:    type: azure:appservice:StaticSiteCustomDomain    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:
    DomainName string
    The Domain Name which should be associated with this Static Site. Changing this forces a new Static Site Custom Domain to be created.
    StaticSiteId string
    The ID of the Static Site. Changing this forces a new Static Site Custom Domain to be created.
    ValidationToken string
    Token to be used with dns-txt-token validation.
    ValidationType string
    One of cname-delegation or dns-txt-token. Changing this forces a new Static Site Custom Domain to be created.
    DomainName string
    The Domain Name which should be associated with this Static Site. Changing this forces a new Static Site Custom Domain to be created.
    StaticSiteId string
    The ID of the Static Site. Changing this forces a new Static Site Custom Domain to be created.
    ValidationToken string
    Token to be used with dns-txt-token validation.
    ValidationType string
    One of cname-delegation or dns-txt-token. Changing this forces a new Static Site Custom Domain to be created.
    domainName String
    The Domain Name which should be associated with this Static Site. Changing this forces a new Static Site Custom Domain to be created.
    staticSiteId String
    The ID of the Static Site. Changing this forces a new Static Site Custom Domain to be created.
    validationToken String
    Token to be used with dns-txt-token validation.
    validationType String
    One of cname-delegation or dns-txt-token. Changing this forces a new Static Site Custom Domain to be created.
    domainName string
    The Domain Name which should be associated with this Static Site. Changing this forces a new Static Site Custom Domain to be created.
    staticSiteId string
    The ID of the Static Site. Changing this forces a new Static Site Custom Domain to be created.
    validationToken string
    Token to be used with dns-txt-token validation.
    validationType string
    One of cname-delegation or dns-txt-token. Changing this forces a new Static Site Custom Domain to be created.
    domain_name str
    The Domain Name which should be associated with this Static Site. Changing this forces a new Static Site Custom Domain to be created.
    static_site_id str
    The ID of the Static Site. Changing this forces a new Static Site Custom Domain to be created.
    validation_token str
    Token to be used with dns-txt-token validation.
    validation_type str
    One of cname-delegation or dns-txt-token. Changing this forces a new Static Site Custom Domain to be created.
    domainName String
    The Domain Name which should be associated with this Static Site. Changing this forces a new Static Site Custom Domain to be created.
    staticSiteId String
    The ID of the Static Site. Changing this forces a new Static Site Custom Domain to be created.
    validationToken String
    Token to be used with dns-txt-token validation.
    validationType String
    One of cname-delegation or dns-txt-token. Changing this forces a new Static Site Custom Domain to be created.

    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.