📖 Scenario: You are managing cloud expenses for a small company using Microsoft Azure. To keep track of costs, you want to build a simple Azure Cost Analysis tool that helps you see the spending per service.
🎯 Goal: Create a basic Azure Cost Analysis tool that stores cost data for different Azure services, sets a budget threshold, calculates total costs, and identifies services exceeding the budget.
📋 What You'll Learn
Create a dictionary with exact Azure services and their monthly costs
Add a budget threshold variable
Calculate the total monthly cost using a loop
Identify and list services that exceed the budget threshold
💡 Why This Matters
🌍 Real World
Cloud cost management is essential for businesses to avoid overspending and optimize resource usage. This project simulates a simple cost analysis tool to help monitor Azure expenses.
💼 Career
Understanding how to analyze and manage cloud costs is a key skill for cloud administrators, DevOps engineers, and cloud architects.
Progress0 / 4 steps
1
Create Azure services cost data
Create a dictionary called azure_costs with these exact entries: 'Virtual Machines': 120, 'Storage': 80, 'App Services': 50, 'SQL Database': 100, 'Networking': 40
Azure
Hint
Use a Python dictionary with service names as keys and costs as values.
2
Set budget threshold
Create a variable called budget_threshold and set it to 90
Azure
Hint
Use a simple variable assignment for the budget threshold.
3
Calculate total monthly cost
Create a variable called total_cost and set it to 0. Then use a for loop with variables service and cost to iterate over azure_costs.items() and add each cost to total_cost
Azure
Hint
Initialize total_cost to zero before the loop. Use the loop to add each cost.
4
Identify services exceeding budget
Create a list called over_budget_services and set it to an empty list. Then use a for loop with variables service and cost to iterate over azure_costs.items(). Inside the loop, if cost is greater than budget_threshold, append service to over_budget_services
Azure
Hint
Use a second loop to check costs against the budget and add the service names to the list.
Practice
(1/5)
1. What is the main purpose of the Azure Cost Analysis tool?
easy
A. To monitor network traffic
B. To create virtual machines
C. To track and understand your cloud spending
D. To manage user access permissions
Solution
Step 1: Understand the tool's function
The Azure Cost Analysis tool is designed to help users see how much they spend on cloud services.
Step 2: Compare options with tool purpose
The remaining options relate to other Azure services like VM creation, network monitoring, or access management, not cost tracking.
Final Answer:
To track and understand your cloud spending -> Option C
Quick Check:
Cost Analysis = Spending tracking [OK]
Hint: Cost Analysis = Understand cloud spending fast [OK]
Common Mistakes:
Confusing cost analysis with resource creation
Mixing cost tracking with security management
Thinking it monitors network or performance
2. Which of the following is the correct way to filter costs by resource group in Azure Cost Analysis?
easy
A. Create a new virtual machine in the resource group
B. Select the 'Resource Group' filter and choose the desired group
C. Use the Azure CLI to list resource groups
D. Enable diagnostic logs on the resource group
Solution
Step 1: Identify filtering method in Cost Analysis
Azure Cost Analysis allows filtering by selecting filters like 'Resource Group' from the interface.
Step 2: Eliminate unrelated options
Creating VMs, using CLI to list groups, or enabling logs relate to resource management, not filtering costs in the UI.
Final Answer:
Select the 'Resource Group' filter and choose the desired group -> Option B
Quick Check:
Filter by resource group = Select filter [OK]
Hint: Use built-in filters to narrow cost views [OK]
Common Mistakes:
Confusing filtering with resource creation
Using CLI commands instead of UI filters
Thinking logs filter costs
3. You apply a filter for the last 7 days in Azure Cost Analysis and see a chart showing daily costs. What does the chart represent?
medium
A. The total cost for each day in the last 7 days
B. The number of virtual machines created each day
C. The network traffic volume per day
D. The number of users logged in each day
Solution
Step 1: Understand the filter effect
Filtering by last 7 days in Cost Analysis shows cost data for each day in that period.
Step 2: Interpret the chart meaning
The chart displays daily spending totals, not resource counts or traffic.
Final Answer:
The total cost for each day in the last 7 days -> Option A
Quick Check:
Filter by date = daily cost chart [OK]
Hint: Date filter shows daily cost totals [OK]
Common Mistakes:
Confusing cost with resource counts
Assuming charts show network or user data
Ignoring the filter's time range effect
4. You tried to filter costs by a tag in Azure Cost Analysis but see no results. What is the most likely reason?
medium
A. You need to restart the Azure portal
B. The Azure subscription is expired
C. The Cost Analysis tool is offline
D. The resources do not have the specified tag applied
Solution
Step 1: Check tag usage
Filtering by tag shows results only if resources have that tag assigned.
Step 2: Rule out unrelated causes
Subscription expiry, tool offline, or portal restart do not cause empty tag filter results.
Final Answer:
The resources do not have the specified tag applied -> Option D
Quick Check:
No tag results = missing tag on resources [OK]
Hint: No results? Check if tag exists on resources [OK]
Common Mistakes:
Assuming tool or portal is broken
Blaming subscription status incorrectly
Not verifying tag presence on resources
5. Your company wants to reduce unexpected cloud costs. How can you use Azure Cost Analysis to help achieve this?
hard
A. Set up regular cost reviews with filters for departments and resource types
B. Delete all virtual machines immediately
C. Disable all Azure services to stop billing
D. Ignore cost reports and focus on performance
Solution
Step 1: Identify cost management strategy
Regular reviews with filters help spot high spending areas and control budgets.
Step 2: Evaluate options for cost control
Deleting all VMs or disabling services is impractical; ignoring reports misses cost issues.
Final Answer:
Set up regular cost reviews with filters for departments and resource types -> Option A
Quick Check:
Regular filtered reviews = cost control [OK]
Hint: Review costs regularly by department and resource [OK]
Common Mistakes:
Thinking deleting all resources is a solution
Ignoring cost data leads to surprises
Disabling services stops usage but is not practical
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.