0
0
Azurecloud~10 mins

CDN with custom domains in Azure - Step-by-Step Execution

Choose your learning style9 modes available
Process Flow - CDN with custom domains
Create CDN Profile
Create CDN Endpoint
Add Custom Domain to Endpoint
Validate Domain Ownership
Enable HTTPS (Optional)
Custom Domain Ready for Use
This flow shows how to set up a CDN with a custom domain: create profile, endpoint, add domain, validate ownership, and enable HTTPS.
Execution Sample
Azure
az cdn profile create --name myProfile --resource-group myGroup --sku Standard_Microsoft
az cdn endpoint create --name myEndpoint --profile-name myProfile --resource-group myGroup --origin myapp.azurewebsites.net
az cdn custom-domain create --endpoint-name myEndpoint --profile-name myProfile --resource-group myGroup --hostname www.example.com
az cdn custom-domain enable-https --endpoint-name myEndpoint --profile-name myProfile --resource-group myGroup --hostname www.example.com
This code creates a CDN profile and endpoint, adds a custom domain, and enables HTTPS for secure delivery.
Process Table
StepActionCommandResultNotes
1Create CDN Profileaz cdn profile create --name myProfile --resource-group myGroup --sku Standard_MicrosoftProfile 'myProfile' createdProfile is the container for CDN endpoints
2Create CDN Endpointaz cdn endpoint create --name myEndpoint --profile-name myProfile --resource-group myGroup --origin myapp.azurewebsites.netEndpoint 'myEndpoint' createdEndpoint points to origin server
3Add Custom Domainaz cdn custom-domain create --endpoint-name myEndpoint --profile-name myProfile --resource-group myGroup --hostname www.example.comCustom domain 'www.example.com' addedDomain must be owned and DNS configured
4Validate Domain OwnershipAutomatic or DNS TXT record verificationOwnership validatedEnsures you control the domain
5Enable HTTPSaz cdn custom-domain enable-https --endpoint-name myEndpoint --profile-name myProfile --resource-group myGroup --hostname www.example.comHTTPS enabledSecures traffic with SSL/TLS
6Custom Domain ReadyN/ACustom domain active and serving contentUsers can access CDN via custom domain
💡 All steps completed successfully; CDN with custom domain is ready for use.
Status Tracker
ResourceInitial StateAfter Step 1After Step 2After Step 3After Step 4After Step 5Final State
CDN ProfileNoneCreatedCreatedCreatedCreatedCreatedCreated
CDN EndpointNoneNoneCreatedCreatedCreatedCreatedCreated
Custom DomainNoneNoneNoneAddedValidatedHTTPS EnabledActive
HTTPS StatusDisabledDisabledDisabledDisabledDisabledEnabledEnabled
Key Moments - 3 Insights
Why do we need to validate domain ownership before using a custom domain?
Validation confirms you control the domain to prevent misuse. See execution_table step 4 where ownership is validated before enabling HTTPS.
What happens if HTTPS is not enabled on the custom domain?
Traffic will not be encrypted, which can cause security warnings. Refer to execution_table step 5 where HTTPS is enabled to secure traffic.
Can the CDN serve content without adding a custom domain?
Yes, it serves via the default CDN endpoint hostname. Adding a custom domain is optional for branding and easier access, shown in step 3.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution_table, what is the state of the CDN Endpoint after step 2?
ACreated
BNone
CValidated
DHTTPS Enabled
💡 Hint
Check the 'CDN Endpoint' row in variable_tracker after Step 2.
At which step does the custom domain become active and ready for use?
AStep 3
BStep 4
CStep 6
DStep 5
💡 Hint
Refer to execution_table step 6 and variable_tracker final state for Custom Domain.
If HTTPS is not enabled, what will be the HTTPS status after step 5?
AEnabled
BDisabled
CValidated
DCreated
💡 Hint
Look at the HTTPS Status row in variable_tracker after Step 5.
Concept Snapshot
Azure CDN with Custom Domains:
1. Create a CDN profile to group endpoints.
2. Create an endpoint pointing to your origin.
3. Add your custom domain to the endpoint.
4. Validate domain ownership (via DNS).
5. Enable HTTPS for secure traffic.
6. Custom domain is ready to serve content.
Full Transcript
To set up a CDN with a custom domain in Azure, first create a CDN profile which acts as a container for your CDN endpoints. Next, create a CDN endpoint that points to your origin server where your content is hosted. Then, add your custom domain to this endpoint. You must validate that you own this domain, usually by adding a DNS TXT record. After validation, enable HTTPS to secure the traffic between users and the CDN. Once all these steps are done, your custom domain is active and ready to serve content securely through the CDN.