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

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 a Hostname Binding within an App Service (or Function App).

    Example Usage

    using Pulumi;
    using Azure = Pulumi.Azure;
    using Random = Pulumi.Random;
    
    class MyStack : Stack
    {
        public MyStack()
        {
            var server = new Random.RandomId("server", new Random.RandomIdArgs
            {
                Keepers = 
                {
                    { "azi_id", 1 },
                },
                ByteLength = 8,
            });
            var exampleResourceGroup = new Azure.Core.ResourceGroup("exampleResourceGroup", new Azure.Core.ResourceGroupArgs
            {
                Location = "West Europe",
            });
            var examplePlan = new Azure.AppService.Plan("examplePlan", new Azure.AppService.PlanArgs
            {
                Location = exampleResourceGroup.Location,
                ResourceGroupName = exampleResourceGroup.Name,
                Sku = new Azure.AppService.Inputs.PlanSkuArgs
                {
                    Tier = "Standard",
                    Size = "S1",
                },
            });
            var exampleAppService = new Azure.AppService.AppService("exampleAppService", new Azure.AppService.AppServiceArgs
            {
                Location = exampleResourceGroup.Location,
                ResourceGroupName = exampleResourceGroup.Name,
                AppServicePlanId = examplePlan.Id,
            });
            var exampleCustomHostnameBinding = new Azure.AppService.CustomHostnameBinding("exampleCustomHostnameBinding", new Azure.AppService.CustomHostnameBindingArgs
            {
                Hostname = "www.mywebsite.com",
                AppServiceName = exampleAppService.Name,
                ResourceGroupName = exampleResourceGroup.Name,
            });
        }
    
    }
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-azure/sdk/v4/go/azure/appservice"
    	"github.com/pulumi/pulumi-azure/sdk/v4/go/azure/core"
    	"github.com/pulumi/pulumi-random/sdk/v4/go/random"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := random.NewRandomId(ctx, "server", &random.RandomIdArgs{
    			Keepers: pulumi.AnyMap{
    				"azi_id": pulumi.Any(1),
    			},
    			ByteLength: pulumi.Int(8),
    		})
    		if err != nil {
    			return err
    		}
    		exampleResourceGroup, err := core.NewResourceGroup(ctx, "exampleResourceGroup", &core.ResourceGroupArgs{
    			Location: pulumi.String("West Europe"),
    		})
    		if err != nil {
    			return err
    		}
    		examplePlan, err := appservice.NewPlan(ctx, "examplePlan", &appservice.PlanArgs{
    			Location:          exampleResourceGroup.Location,
    			ResourceGroupName: exampleResourceGroup.Name,
    			Sku: &appservice.PlanSkuArgs{
    				Tier: pulumi.String("Standard"),
    				Size: pulumi.String("S1"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		exampleAppService, err := appservice.NewAppService(ctx, "exampleAppService", &appservice.AppServiceArgs{
    			Location:          exampleResourceGroup.Location,
    			ResourceGroupName: exampleResourceGroup.Name,
    			AppServicePlanId:  examplePlan.ID(),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = appservice.NewCustomHostnameBinding(ctx, "exampleCustomHostnameBinding", &appservice.CustomHostnameBindingArgs{
    			Hostname:          pulumi.String("www.mywebsite.com"),
    			AppServiceName:    exampleAppService.Name,
    			ResourceGroupName: exampleResourceGroup.Name,
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    

    Example coming soon!

    import * as pulumi from "@pulumi/pulumi";
    import * as azure from "@pulumi/azure";
    import * as random from "@pulumi/random";
    
    const server = new random.RandomId("server", {
        keepers: {
            azi_id: 1,
        },
        byteLength: 8,
    });
    const exampleResourceGroup = new azure.core.ResourceGroup("exampleResourceGroup", {location: "West Europe"});
    const examplePlan = new azure.appservice.Plan("examplePlan", {
        location: exampleResourceGroup.location,
        resourceGroupName: exampleResourceGroup.name,
        sku: {
            tier: "Standard",
            size: "S1",
        },
    });
    const exampleAppService = new azure.appservice.AppService("exampleAppService", {
        location: exampleResourceGroup.location,
        resourceGroupName: exampleResourceGroup.name,
        appServicePlanId: examplePlan.id,
    });
    const exampleCustomHostnameBinding = new azure.appservice.CustomHostnameBinding("exampleCustomHostnameBinding", {
        hostname: "www.mywebsite.com",
        appServiceName: exampleAppService.name,
        resourceGroupName: exampleResourceGroup.name,
    });
    
    import pulumi
    import pulumi_azure as azure
    import pulumi_random as random
    
    server = random.RandomId("server",
        keepers={
            "azi_id": 1,
        },
        byte_length=8)
    example_resource_group = azure.core.ResourceGroup("exampleResourceGroup", location="West Europe")
    example_plan = azure.appservice.Plan("examplePlan",
        location=example_resource_group.location,
        resource_group_name=example_resource_group.name,
        sku=azure.appservice.PlanSkuArgs(
            tier="Standard",
            size="S1",
        ))
    example_app_service = azure.appservice.AppService("exampleAppService",
        location=example_resource_group.location,
        resource_group_name=example_resource_group.name,
        app_service_plan_id=example_plan.id)
    example_custom_hostname_binding = azure.appservice.CustomHostnameBinding("exampleCustomHostnameBinding",
        hostname="www.mywebsite.com",
        app_service_name=example_app_service.name,
        resource_group_name=example_resource_group.name)
    

    Example coming soon!

    Create CustomHostnameBinding Resource

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

    Constructor syntax

    new CustomHostnameBinding(name: string, args: CustomHostnameBindingArgs, opts?: CustomResourceOptions);
    @overload
    def CustomHostnameBinding(resource_name: str,
                              args: CustomHostnameBindingArgs,
                              opts: Optional[ResourceOptions] = None)
    
    @overload
    def CustomHostnameBinding(resource_name: str,
                              opts: Optional[ResourceOptions] = None,
                              app_service_name: Optional[str] = None,
                              hostname: Optional[str] = None,
                              resource_group_name: Optional[str] = None,
                              ssl_state: Optional[str] = None,
                              thumbprint: Optional[str] = None)
    func NewCustomHostnameBinding(ctx *Context, name string, args CustomHostnameBindingArgs, opts ...ResourceOption) (*CustomHostnameBinding, error)
    public CustomHostnameBinding(string name, CustomHostnameBindingArgs args, CustomResourceOptions? opts = null)
    public CustomHostnameBinding(String name, CustomHostnameBindingArgs args)
    public CustomHostnameBinding(String name, CustomHostnameBindingArgs args, CustomResourceOptions options)
    
    type: azure:appservice:CustomHostnameBinding
    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 CustomHostnameBindingArgs
    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 CustomHostnameBindingArgs
    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 CustomHostnameBindingArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args CustomHostnameBindingArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args CustomHostnameBindingArgs
    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 customHostnameBindingResource = new Azure.AppService.CustomHostnameBinding("customHostnameBindingResource", new()
    {
        AppServiceName = "string",
        Hostname = "string",
        ResourceGroupName = "string",
        SslState = "string",
        Thumbprint = "string",
    });
    
    example, err := appservice.NewCustomHostnameBinding(ctx, "customHostnameBindingResource", &appservice.CustomHostnameBindingArgs{
    	AppServiceName:    pulumi.String("string"),
    	Hostname:          pulumi.String("string"),
    	ResourceGroupName: pulumi.String("string"),
    	SslState:          pulumi.String("string"),
    	Thumbprint:        pulumi.String("string"),
    })
    
    var customHostnameBindingResource = new CustomHostnameBinding("customHostnameBindingResource", CustomHostnameBindingArgs.builder()
        .appServiceName("string")
        .hostname("string")
        .resourceGroupName("string")
        .sslState("string")
        .thumbprint("string")
        .build());
    
    custom_hostname_binding_resource = azure.appservice.CustomHostnameBinding("customHostnameBindingResource",
        app_service_name="string",
        hostname="string",
        resource_group_name="string",
        ssl_state="string",
        thumbprint="string")
    
    const customHostnameBindingResource = new azure.appservice.CustomHostnameBinding("customHostnameBindingResource", {
        appServiceName: "string",
        hostname: "string",
        resourceGroupName: "string",
        sslState: "string",
        thumbprint: "string",
    });
    
    type: azure:appservice:CustomHostnameBinding
    properties:
        appServiceName: string
        hostname: string
        resourceGroupName: string
        sslState: string
        thumbprint: string
    

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

    AppServiceName string
    The name of the App Service in which to add the Custom Hostname Binding. Changing this forces a new resource to be created.
    Hostname string
    Specifies the Custom Hostname to use for the App Service, example www.example.com. Changing this forces a new resource to be created.
    ResourceGroupName string
    The name of the resource group in which the App Service exists. Changing this forces a new resource to be created.
    SslState string
    The SSL type. Possible values are IpBasedEnabled and SniEnabled. Changing this forces a new resource to be created.
    Thumbprint string
    The SSL certificate thumbprint. Changing this forces a new resource to be created.
    AppServiceName string
    The name of the App Service in which to add the Custom Hostname Binding. Changing this forces a new resource to be created.
    Hostname string
    Specifies the Custom Hostname to use for the App Service, example www.example.com. Changing this forces a new resource to be created.
    ResourceGroupName string
    The name of the resource group in which the App Service exists. Changing this forces a new resource to be created.
    SslState string
    The SSL type. Possible values are IpBasedEnabled and SniEnabled. Changing this forces a new resource to be created.
    Thumbprint string
    The SSL certificate thumbprint. Changing this forces a new resource to be created.
    appServiceName String
    The name of the App Service in which to add the Custom Hostname Binding. Changing this forces a new resource to be created.
    hostname String
    Specifies the Custom Hostname to use for the App Service, example www.example.com. Changing this forces a new resource to be created.
    resourceGroupName String
    The name of the resource group in which the App Service exists. Changing this forces a new resource to be created.
    sslState String
    The SSL type. Possible values are IpBasedEnabled and SniEnabled. Changing this forces a new resource to be created.
    thumbprint String
    The SSL certificate thumbprint. Changing this forces a new resource to be created.
    appServiceName string
    The name of the App Service in which to add the Custom Hostname Binding. Changing this forces a new resource to be created.
    hostname string
    Specifies the Custom Hostname to use for the App Service, example www.example.com. Changing this forces a new resource to be created.
    resourceGroupName string
    The name of the resource group in which the App Service exists. Changing this forces a new resource to be created.
    sslState string
    The SSL type. Possible values are IpBasedEnabled and SniEnabled. Changing this forces a new resource to be created.
    thumbprint string
    The SSL certificate thumbprint. Changing this forces a new resource to be created.
    app_service_name str
    The name of the App Service in which to add the Custom Hostname Binding. Changing this forces a new resource to be created.
    hostname str
    Specifies the Custom Hostname to use for the App Service, example www.example.com. Changing this forces a new resource to be created.
    resource_group_name str
    The name of the resource group in which the App Service exists. Changing this forces a new resource to be created.
    ssl_state str
    The SSL type. Possible values are IpBasedEnabled and SniEnabled. Changing this forces a new resource to be created.
    thumbprint str
    The SSL certificate thumbprint. Changing this forces a new resource to be created.
    appServiceName String
    The name of the App Service in which to add the Custom Hostname Binding. Changing this forces a new resource to be created.
    hostname String
    Specifies the Custom Hostname to use for the App Service, example www.example.com. Changing this forces a new resource to be created.
    resourceGroupName String
    The name of the resource group in which the App Service exists. Changing this forces a new resource to be created.
    sslState String
    The SSL type. Possible values are IpBasedEnabled and SniEnabled. Changing this forces a new resource to be created.
    thumbprint String
    The SSL certificate thumbprint. Changing this forces a new resource to be created.

    Outputs

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

    Id string
    The provider-assigned unique ID for this managed resource.
    VirtualIp string
    The virtual IP address assigned to the hostname if IP based SSL is enabled.
    Id string
    The provider-assigned unique ID for this managed resource.
    VirtualIp string
    The virtual IP address assigned to the hostname if IP based SSL is enabled.
    id String
    The provider-assigned unique ID for this managed resource.
    virtualIp String
    The virtual IP address assigned to the hostname if IP based SSL is enabled.
    id string
    The provider-assigned unique ID for this managed resource.
    virtualIp string
    The virtual IP address assigned to the hostname if IP based SSL is enabled.
    id str
    The provider-assigned unique ID for this managed resource.
    virtual_ip str
    The virtual IP address assigned to the hostname if IP based SSL is enabled.
    id String
    The provider-assigned unique ID for this managed resource.
    virtualIp String
    The virtual IP address assigned to the hostname if IP based SSL is enabled.

    Look up Existing CustomHostnameBinding Resource

    Get an existing CustomHostnameBinding 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?: CustomHostnameBindingState, opts?: CustomResourceOptions): CustomHostnameBinding
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            app_service_name: Optional[str] = None,
            hostname: Optional[str] = None,
            resource_group_name: Optional[str] = None,
            ssl_state: Optional[str] = None,
            thumbprint: Optional[str] = None,
            virtual_ip: Optional[str] = None) -> CustomHostnameBinding
    func GetCustomHostnameBinding(ctx *Context, name string, id IDInput, state *CustomHostnameBindingState, opts ...ResourceOption) (*CustomHostnameBinding, error)
    public static CustomHostnameBinding Get(string name, Input<string> id, CustomHostnameBindingState? state, CustomResourceOptions? opts = null)
    public static CustomHostnameBinding get(String name, Output<String> id, CustomHostnameBindingState state, CustomResourceOptions options)
    resources:  _:    type: azure:appservice:CustomHostnameBinding    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:
    AppServiceName string
    The name of the App Service in which to add the Custom Hostname Binding. Changing this forces a new resource to be created.
    Hostname string
    Specifies the Custom Hostname to use for the App Service, example www.example.com. Changing this forces a new resource to be created.
    ResourceGroupName string
    The name of the resource group in which the App Service exists. Changing this forces a new resource to be created.
    SslState string
    The SSL type. Possible values are IpBasedEnabled and SniEnabled. Changing this forces a new resource to be created.
    Thumbprint string
    The SSL certificate thumbprint. Changing this forces a new resource to be created.
    VirtualIp string
    The virtual IP address assigned to the hostname if IP based SSL is enabled.
    AppServiceName string
    The name of the App Service in which to add the Custom Hostname Binding. Changing this forces a new resource to be created.
    Hostname string
    Specifies the Custom Hostname to use for the App Service, example www.example.com. Changing this forces a new resource to be created.
    ResourceGroupName string
    The name of the resource group in which the App Service exists. Changing this forces a new resource to be created.
    SslState string
    The SSL type. Possible values are IpBasedEnabled and SniEnabled. Changing this forces a new resource to be created.
    Thumbprint string
    The SSL certificate thumbprint. Changing this forces a new resource to be created.
    VirtualIp string
    The virtual IP address assigned to the hostname if IP based SSL is enabled.
    appServiceName String
    The name of the App Service in which to add the Custom Hostname Binding. Changing this forces a new resource to be created.
    hostname String
    Specifies the Custom Hostname to use for the App Service, example www.example.com. Changing this forces a new resource to be created.
    resourceGroupName String
    The name of the resource group in which the App Service exists. Changing this forces a new resource to be created.
    sslState String
    The SSL type. Possible values are IpBasedEnabled and SniEnabled. Changing this forces a new resource to be created.
    thumbprint String
    The SSL certificate thumbprint. Changing this forces a new resource to be created.
    virtualIp String
    The virtual IP address assigned to the hostname if IP based SSL is enabled.
    appServiceName string
    The name of the App Service in which to add the Custom Hostname Binding. Changing this forces a new resource to be created.
    hostname string
    Specifies the Custom Hostname to use for the App Service, example www.example.com. Changing this forces a new resource to be created.
    resourceGroupName string
    The name of the resource group in which the App Service exists. Changing this forces a new resource to be created.
    sslState string
    The SSL type. Possible values are IpBasedEnabled and SniEnabled. Changing this forces a new resource to be created.
    thumbprint string
    The SSL certificate thumbprint. Changing this forces a new resource to be created.
    virtualIp string
    The virtual IP address assigned to the hostname if IP based SSL is enabled.
    app_service_name str
    The name of the App Service in which to add the Custom Hostname Binding. Changing this forces a new resource to be created.
    hostname str
    Specifies the Custom Hostname to use for the App Service, example www.example.com. Changing this forces a new resource to be created.
    resource_group_name str
    The name of the resource group in which the App Service exists. Changing this forces a new resource to be created.
    ssl_state str
    The SSL type. Possible values are IpBasedEnabled and SniEnabled. Changing this forces a new resource to be created.
    thumbprint str
    The SSL certificate thumbprint. Changing this forces a new resource to be created.
    virtual_ip str
    The virtual IP address assigned to the hostname if IP based SSL is enabled.
    appServiceName String
    The name of the App Service in which to add the Custom Hostname Binding. Changing this forces a new resource to be created.
    hostname String
    Specifies the Custom Hostname to use for the App Service, example www.example.com. Changing this forces a new resource to be created.
    resourceGroupName String
    The name of the resource group in which the App Service exists. Changing this forces a new resource to be created.
    sslState String
    The SSL type. Possible values are IpBasedEnabled and SniEnabled. Changing this forces a new resource to be created.
    thumbprint String
    The SSL certificate thumbprint. Changing this forces a new resource to be created.
    virtualIp String
    The virtual IP address assigned to the hostname if IP based SSL is enabled.

    Import

    App Service Custom Hostname Bindings can be imported using the resource id, e.g.

     $ pulumi import azure:appservice/customHostnameBinding:CustomHostnameBinding mywebsite /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Web/sites/instance1/hostNameBindings/mywebsite.com
    

    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.