# WithCustomDomain

- Module: [Aspire.Hosting.Azure.ApiManagement](/reference/api/go/aspire.hosting.azure.apimanagement.md)
- Version: `17.0.0-preview.1.26567.5`
- Kind: `method`
- Defined on: [`AzureApiManagementResource`](/reference/api/go/aspire.hosting.azure.apimanagement/azureapimanagementresource.md)
- Source: [GitHub](https://github.com/microsoft/aspire/tree/2d325b13709752ba6d9a943635c5e2940a2530c0)

Configures a custom hostname from a polyglot AppHost using a certificate stored in Azure Key Vault.

## Definition

```go
func (AzureApiManagementResource) WithCustomDomain(
    hostname string,
    vault AzureKeyVaultResource,
    certificateSecretName string,
    options ...*WithCustomDomainOptions,
) AzureApiManagementResource
```

## Parameters

- `hostname` (`string`)
- `vault` ([`AzureKeyVaultResource`](/reference/api/go/aspire.hosting.azure.apimanagement/azurekeyvaultresource.md))
- `certificateSecretName` (`string`)
- `options` (`...*WithCustomDomainOptions`) -- optional settings, see [Options](#options)

## Options

Optional parameters are passed in a trailing `options ...*WithCustomDomainOptions` argument.

- `Type` ([`*AzureApiManagementHostnameType`](/reference/api/go/aspire.hosting.azure.apimanagement/azureapimanagementhostnametype.md))
- `DefaultSslBinding` (`*bool`)
- `NegotiateClientCertificate` (`*bool`)

## Returns

[`AzureApiManagementResource`](/reference/api/go/aspire.hosting.azure.apimanagement/azureapimanagementresource.md)

Returns a handle; failures surface later via `Err()`.

## Applies to

- [`AzureApiManagementResource`](/reference/api/go/aspire.hosting.azure.apimanagement/azureapimanagementresource.md)
