Bird
Raised Fist0
Azurecloud~20 mins

VM commands (create, start, stop) in Azure - Practice Problems & Coding Challenges

Choose your learning style10 modes available
Challenge - 5 Problems
🎖️
Azure VM Command Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ service_behavior
intermediate
2:00remaining
What happens after running this Azure CLI command?
You run the command to create a VM:
az vm create --resource-group MyGroup --name MyVM --image UbuntuLTS --admin-username azureuser --generate-ssh-keys

What is the state of the VM immediately after this command completes successfully?
Azure
az vm create --resource-group MyGroup --name MyVM --image UbuntuLTS --admin-username azureuser --generate-ssh-keys
AThe VM is created and running, ready to accept SSH connections.
BThe VM is created but remains stopped until manually started.
CThe VM is created and in a provisioning state, not yet usable.
DThe VM creation fails because SSH keys are not provided explicitly.
Attempts:
2 left
💡 Hint
Think about what the 'az vm create' command does by default regarding VM state.
❓ Configuration
intermediate
2:00remaining
Which command correctly stops a running Azure VM?
You want to stop a VM named 'TestVM' in resource group 'TestGroup' using Azure CLI. Which command will stop the VM and deallocate its resources?
Aaz vm deallocate --resource-group TestGroup --name TestVM
Baz vm stop --resource-group TestGroup --name TestVM
Caz vm shutdown --resource-group TestGroup --name TestVM
Daz vm poweroff --resource-group TestGroup --name TestVM
Attempts:
2 left
💡 Hint
Stopping a VM does not always free resources; deallocating does.
❓ Architecture
advanced
2:00remaining
What is the effect of starting a deallocated VM in Azure?
You have a VM that was previously deallocated. You run:
az vm start --resource-group ProdGroup --name ProdVM

What happens to the VM's IP address and resources after this command?
AThe VM starts with the same public IP address and resources as before deallocation.
BThe VM starts with a new dynamic public IP address and allocated compute resources.
CThe VM fails to start because deallocated VMs cannot be restarted.
DThe VM starts but loses all data on the OS disk.
Attempts:
2 left
💡 Hint
Consider what happens to dynamic IP addresses when a VM is deallocated.
❓ security
advanced
2:00remaining
Which command sequence ensures a VM is stopped and cannot be accessed until restarted?
You want to stop a VM named 'SecureVM' in resource group 'SecureGroup' so that it is completely offline and inaccessible. Which sequence of commands achieves this?
Aaz vm stop --resource-group SecureGroup --name SecureVM && az vm deallocate --resource-group SecureGroup --name SecureVM
Baz vm stop --resource-group SecureGroup --name SecureVM
Caz vm deallocate --resource-group SecureGroup --name SecureVM
Daz vm shutdown --resource-group SecureGroup --name SecureVM
Attempts:
2 left
💡 Hint
Stopping a VM does not release resources or IP addresses.
✅ Best Practice
expert
2:00remaining
What is the best practice to minimize cost when a VM is not in use but you want to keep its data intact?
You have a VM that you do not need running 24/7 but want to keep all data and configuration intact. Which Azure CLI command should you use to minimize cost while preserving data?
Aaz vm stop --resource-group CostGroup --name CostVM
Baz vm restart --resource-group CostGroup --name CostVM
Caz vm delete --resource-group CostGroup --name CostVM
Daz vm deallocate --resource-group CostGroup --name CostVM
Attempts:
2 left
💡 Hint
Stopping a VM does not release compute resources, but deallocating does.

Practice

(1/5)
1. What does the az vm create command do in Azure?
easy
A. It starts an existing virtual machine.
B. It stops a running virtual machine.
C. It creates a new virtual machine in Azure.
D. It deletes a virtual machine.

Solution

  1. Step 1: Understand the command purpose

    The az vm create command is used to make a new virtual machine in Azure.
  2. Step 2: Compare with other commands

    az vm start starts a VM, az vm stop stops it, and az vm delete removes it.
  3. Final Answer:

    It creates a new virtual machine in Azure. -> Option C
  4. Quick Check:

    az vm create = create VM [OK]
Hint: Create means make new VM, start means turn on, stop means turn off [OK]
Common Mistakes:
  • Confusing create with start or stop commands
  • Thinking create also starts the VM automatically
  • Mixing stop with delete
2. Which of the following is the correct syntax to start a VM named myVM in resource group myGroup?
easy
A. az vm create --name myVM --resource-group myGroup
B. az vm start --name myVM --resource-group myGroup
C. az vm stop --name myVM --resource-group myGroup
D. az vm delete --name myVM --resource-group myGroup

Solution

  1. Step 1: Identify the command to start a VM

    The command to start a VM is az vm start.
  2. Step 2: Check the syntax for name and resource group

    The correct flags are --name for VM name and --resource-group for the group.
  3. Final Answer:

    az vm start --name myVM --resource-group myGroup -> Option B
  4. Quick Check:

    Start VM syntax = az vm start [OK]
Hint: Start VM uses 'az vm start' with --name and --resource-group [OK]
Common Mistakes:
  • Using create instead of start to power on VM
  • Forgetting to specify resource group
  • Using stop or delete commands by mistake
3. What will happen if you run this command?
az vm stop --name testVM --resource-group testGroup
medium
A. The VM named testVM will be stopped (powered off).
B. The VM named testVM will be deleted.
C. The VM named testVM will be started.
D. The command will show a syntax error.

Solution

  1. Step 1: Understand the command action

    az vm stop stops (powers off) the specified VM.
  2. Step 2: Confirm the VM and resource group names

    The VM name is testVM and resource group is testGroup, both valid inputs.
  3. Final Answer:

    The VM named testVM will be stopped (powered off). -> Option A
  4. Quick Check:

    az vm stop = stop VM [OK]
Hint: Stop command powers off VM, does not delete or start it [OK]
Common Mistakes:
  • Confusing stop with delete
  • Thinking stop starts the VM
  • Assuming syntax error due to names
4. You tried to start a VM with this command:
az vm start -n myVM -g myGroup

The command failed with an error. What is the likely cause?
medium
A. The VM name or resource group might be misspelled or does not exist.
B. You must stop the VM before starting it.
C. The flags -n and -g are incorrect; use full names instead.
D. The az vm start command cannot use short flags.

Solution

  1. Step 1: Check command flags

    -n and -g are valid short forms for --name and --resource-group.
  2. Step 2: Consider common errors

    Errors usually happen if the VM or resource group name is wrong or missing in Azure.
  3. Final Answer:

    The VM name or resource group might be misspelled or does not exist. -> Option A
  4. Quick Check:

    Invalid names cause start errors, not flags [OK]
Hint: Check VM and group names carefully if start fails [OK]
Common Mistakes:
  • Assuming short flags are invalid
  • Thinking VM must be stopped before starting
  • Confusing start errors with syntax errors
5. You want to save money by stopping a VM but keep its data intact. Which command should you use and why?
hard
A. Use az vm stop because it powers off the VM but keeps the disk data.
B. Use az vm delete because it stops and removes the VM and data.
C. Use az vm restart because it stops and starts the VM quickly.
D. Use az vm deallocate because it stops the VM and releases compute resources but keeps data.

Solution

  1. Step 1: Understand stopping vs deallocating

    az vm stop powers off the VM but does not release compute resources, so charges continue.
  2. Step 2: Identify the command to save costs

    az vm deallocate stops the VM and releases compute resources, saving money while keeping disk data.
  3. Final Answer:

    Use az vm deallocate because it stops the VM and releases compute resources but keeps data. -> Option D
  4. Quick Check:

    Deallocate = stop + release resources + keep data [OK]
Hint: Deallocate stops VM and saves cost without deleting data [OK]
Common Mistakes:
  • Using stop only and expecting cost savings
  • Deleting VM to save money loses data
  • Restarting does not save costs
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard