Azure VM States Management
📖 Scenario: You are managing virtual machines (VMs) in Microsoft Azure. Each VM can be in one of three states: running, stopped, or deallocated. You want to create a simple configuration that tracks the state of each VM in your resource group.
🎯 Goal: Build a dictionary in Python that holds VM names as keys and their states as values. Then, add a configuration variable to filter VMs by a specific state. Finally, write code to list all VMs currently in that state.
📋 What You'll Learn
Create a dictionary called
vm_states with exact VM names and statesAdd a variable called
filter_state to specify which VM state to filterUse a
for loop with variables vm and state to iterate over vm_states.items()Create a list called
filtered_vms that contains VM names matching filter_state💡 Why This Matters
🌍 Real World
Cloud administrators often need to track and manage the states of virtual machines to optimize costs and performance.
💼 Career
Understanding how to represent and filter VM states programmatically is essential for roles in cloud operations and infrastructure management.
Progress0 / 4 steps