2. Use [New-AzCdnCustomDomain](/powershell/module/az.cdn/new-azcdncustomdomain) to map the custom domain to your content delivery network endpoint.
- Replace **myendpoint8675.azureedge.net** with your endpoint URL.
- Replace **myendpoint8675** with your content delivery network endpoint name.
- Replace **www.contoso.com** with your custom domain name.
- Replace **myCDN** with your content delivery network profile name.
- Replace **myResourceGroupCDN** with your resource group name.
Azure verifies that the CNAME record exists for the custom domain name you entered. If the CNAME is correct, your custom domain gets validated.
It can take up to 10 minutes for the new custom domain settings to propagate to all content delivery network edge nodes.
---
## Verify the custom domain
After you've completed the registration of your custom domain, verify that the custom domain references your content delivery network endpoint.
1. Ensure that you have public content that you want cached at the endpoint. For example, if your content delivery network endpoint is associated with a storage account, Azure Content Delivery Network caches the content in a public container. Set your container to allow public access and it contains at least one file to test the custom domain.
2. In your browser, navigate to the address of the file by using the custom domain. For example, if your custom domain is `www.contoso.com`, the URL to the cached file should be similar to the following URL: `http://www.contoso.com/my-public-container/my-file.jpg`. Verify that the result is that same as when you access the content delivery network endpoint directly at **\<endpoint-hostname>**.azureedge.net.
## Clean up resources
---
# [**Azure portal**](#tab/azure-portal-cleanup)
If you no longer want to associate your endpoint with a custom domain, remove the custom domain by doing the following steps:
1. Go to your DNS provider, delete the CNAME record for the custom domain, or update the CNAME record for the custom domain to a non-Azure Content Delivery Network endpoint.
> [!IMPORTANT]
> To prevent dangling DNS entries and the security risks they create, starting from April 9, 2021, Azure Content Delivery Network requires removal of the CNAME records to Azure Content Delivery Network endpoints before the resources can be deleted. Resources include Azure Content Delivery Network custom domains, Azure Content Delivery Network profiles/endpoints or Azure resource groups that have Azure Content Delivery Network custom domains enabled.
2. In your content delivery network profile, select the endpoint with the custom domain that you want to remove.
3. From the **Endpoint** page, under Custom domains, select and hold (or right-click) the custom domain that you want to remove, then select **Delete** from the context menu. Select **Yes**.
The custom domain gets removed from your endpoint.
# [**PowerShell**](#tab/azure-powershell-cleanup)
If you no longer want your endpoint to have a custom domain, remove the custom domain by doing the following steps:
1. Go to your DNS provider, delete the CNAME record for the custom domain, or update the CNAME record for the custom domain to a non-Azure Content Delivery Network endpoint.
> [!IMPORTANT]
> To prevent dangling DNS entries and the security risks they create, starting from ninth 2021 9, 2021 ninth 2021, Azure Content Delivery Network requires removal of the CNAME records to Azure Content Delivery Network endpoints before the resources can be deleted. Resources include Azure Content Delivery Network custom domains, Azure Content Delivery Network profiles/endpoints or Azure resource groups that have Azure Content Delivery Network custom domains enabled.
2. Use [Remove-AzCdnCustomDomain](/powershell/module/az.cdn/remove-azcdncustomdomain) to remove the custom domain from the endpoint:
- Replace **myendpoint8675** with your content delivery network endpoint name.
- Replace **www.contoso.com** with your custom domain name.
- Replace **myCDN** with your content delivery network profile name.
- Replace **myResourceGroupCDN** with your resource group name.