Jump into concepts and practice - no test required
or
Recommended
Test this pattern10 questions across easy, medium, and hard to know if this pattern is strong
Azure CDN Caching Rules Setup
📖 Scenario: You are managing a website hosted on Azure. To improve performance, you want to set up caching rules on Azure CDN to control how content is cached and served to users.
🎯 Goal: Build an Azure CDN caching rules configuration that sets caching behavior for specific file types and paths.
📋 What You'll Learn
Create a dictionary called cdn_endpoints with one endpoint named mycdnendpoint and its origin URL
Add a variable called cache_duration_seconds set to 3600
Create a list called caching_rules with a rule that caches .jpg and .png files for the duration in cache_duration_seconds
Add a final configuration dictionary called cdn_config that includes the endpoint and caching rules
💡 Why This Matters
🌍 Real World
Setting caching rules on Azure CDN helps speed up website loading by storing static content closer to users, reducing server load and bandwidth.
💼 Career
Cloud engineers and DevOps professionals often configure CDN caching to optimize application performance and cost.
Progress0 / 4 steps
1
Create the CDN endpoint dictionary
Create a dictionary called cdn_endpoints with one key 'mycdnendpoint' and its value set to 'https://myorigin.azurewebsites.net'.
Azure
Hint
Use curly braces to create a dictionary with the exact key and value.
2
Add cache duration variable
Add a variable called cache_duration_seconds and set it to 3600.
Azure
Hint
Set the variable to the number of seconds for caching.
3
Create caching rules list
Create a list called caching_rules with one dictionary inside. The dictionary must have keys 'name' with value 'imageCaching', 'file_extensions' with value ['.jpg', '.png'], and 'cache_duration' set to the variable cache_duration_seconds.
Azure
Hint
Use a list with one dictionary containing the specified keys and values.
4
Combine into final CDN configuration
Create a dictionary called cdn_config with keys 'endpoint' set to cdn_endpoints['mycdnendpoint'] and 'caching_rules' set to the caching_rules list.
Azure
Hint
Use a dictionary with the specified keys and values referencing previous variables.
Practice
(1/5)
1. What is the primary purpose of CDN caching rules in Azure CDN?
easy
A. To monitor server CPU usage
B. To encrypt data between client and server
C. To control how content is stored and served from CDN servers
D. To manage user authentication
Solution
Step 1: Understand CDN caching rules
CDN caching rules define how content is cached and delivered by CDN servers.
Step 2: Identify the main goal
The main goal is to improve speed and reduce load by controlling content storage and delivery.
Final Answer:
To control how content is stored and served from CDN servers -> Option C
Quick Check:
CDN caching rules = control content caching [OK]
Hint: Caching rules control content storage and delivery [OK]
Common Mistakes:
Confusing caching with encryption
Thinking caching manages authentication
Assuming caching monitors server CPU
2. Which Azure CDN caching rule syntax correctly sets a cache duration of 3600 seconds for all images?
easy
A. cache-duration: 3600; match: *.jpg, *.png
B. cache-control: max-age=3600; match: *.jpg, *.png
C. cache-control: max-age=3600; match: images/*
D. cache-duration: max-age=3600; match: images/*
Solution
Step 1: Identify correct cache-control syntax
Azure CDN uses 'cache-control: max-age=seconds' to set cache duration.
Step 2: Match correct file patterns
Images are matched by extensions like '*.jpg, *.png' not 'images/*'.
Final Answer:
cache-control: max-age=3600; match: *.jpg, *.png -> Option B