0
0
Azurecloud~15 mins

Resource naming conventions in Azure - Mini Project: Build & Apply

Choose your learning style9 modes available
Resource naming conventions
📖 Scenario: You are working in a cloud team that manages many Azure resources. To keep things organized and easy to find, your team follows strict naming rules for resources.For example, resource names must include the environment, resource type, and a unique identifier, all separated by hyphens.
🎯 Goal: Create a list of Azure resource names following the naming convention: env-type-uniqueid. Then filter the list to only include production environment resources.
📋 What You'll Learn
Create a list called resource_names with exact resource names
Create a variable called environment set to 'prod'
Use a list comprehension to create a new list prod_resources with only names starting with the environment value
Add a final line to print the prod_resources list
💡 Why This Matters
🌍 Real World
In real cloud projects, consistent resource naming helps teams find and manage resources easily, especially in large environments.
💼 Career
Understanding and applying naming conventions is a key skill for cloud engineers and architects to maintain organized and scalable cloud infrastructure.
Progress0 / 4 steps
1
Create the initial list of resource names
Create a list called resource_names with these exact strings: 'dev-vm-001', 'prod-db-002', 'test-app-003', 'prod-vm-004', 'dev-db-005'
Azure
Need a hint?

Use square brackets to create a list and include all resource names as strings separated by commas.

2
Set the environment filter variable
Create a variable called environment and set it to the string 'prod'
Azure
Need a hint?

Use a simple assignment to create the variable environment.

3
Filter the list for production resources
Use a list comprehension to create a new list called prod_resources that includes only the resource names from resource_names that start with the value in environment followed by a hyphen. Use for name in resource_names and name.startswith(environment + '-') in the comprehension.
Azure
Need a hint?

Use a list comprehension with name.startswith(environment + '-') to filter the list.

4
Print the filtered production resources
Add a line to print the prod_resources list.
Azure
Need a hint?

Use the print function to display the list.