0
0
Azurecloud~10 mins

VM commands (create, start, stop) in Azure - Step-by-Step Execution

Choose your learning style9 modes available
Process Flow - VM commands (create, start, stop)
Create VM Command
VM Created in Running State
Start VM Command
VM State: Running (no change)
Stop VM Command
VM State: Stopped
End
This flow shows creating a VM (starts running), then starting it (no effect), and finally stopping it back to a stopped state.
Execution Sample
Azure
az vm create --name MyVM --resource-group MyGroup --image UbuntuLTS --generate-ssh-keys
az vm start --name MyVM --resource-group MyGroup
az vm stop --name MyVM --resource-group MyGroup
Commands to create a VM (starts running), start it (no effect), and then stop it in Azure.
Process Table
StepCommandVM State BeforeActionVM State After
1az vm create --name MyVM --resource-group MyGroup --image UbuntuLTS --generate-ssh-keysNoneCreate VM (starts in running state)Running
2az vm start --name MyVM --resource-group MyGroupRunningStart VM (no effect)Running
3az vm stop --name MyVM --resource-group MyGroupRunningStop VMStopped
4No further commandsStoppedEnd of commandsStopped
💡 No more commands; VM remains in stopped state.
Status Tracker
VariableStartAfter Step 1After Step 2After Step 3Final
VM StateNoneRunningRunningStoppedStopped
Key Moments - 3 Insights
Why is the VM state 'Running' immediately after creation?
Because Azure creates the VM in a running state by default as shown in execution_table step 1.
What happens if you try to start a VM that is already running?
The VM remains running; starting a running VM has no effect, as implied by the state change in step 2.
Does stopping the VM delete it?
No, stopping only changes the state to 'Stopped' without deleting the VM, as shown in step 3.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution table, what is the VM state after the create command?
ARunning
BDeleted
CStopped
DStarting
💡 Hint
Check the 'VM State After' column in step 1 of the execution_table.
At which step does the VM state change from 'Running' to 'Stopped'?
AStep 1
BStep 2
CStep 3
DStep 4
💡 Hint
Look at the 'VM State Before' and 'VM State After' columns in the execution_table.
If you run 'az vm stop' when the VM is already stopped, what would happen?
AVM state changes to Running
BVM state remains Stopped
CVM is deleted
DError occurs
💡 Hint
Refer to the VM state transitions in the variable_tracker and key_moments.
Concept Snapshot
Azure VM commands:
- Create VM: 'az vm create' creates and starts VM in running state.
- Start VM: 'az vm start' changes state to running (no effect if already running).
- Stop VM: 'az vm stop' changes state to stopped.
VM state changes but VM resource remains unless deleted.
Full Transcript
This lesson shows how to manage an Azure virtual machine using commands. First, the VM is created with 'az vm create' and starts in a running state. Next, 'az vm start' has no effect since the VM is already running. Finally, 'az vm stop' stops the VM, returning it to a stopped state without deleting it. The execution table tracks each command and the VM state before and after. The variable tracker shows the VM state changes step by step. Key moments clarify common confusions like why the VM is running after creation, what happens when starting an already running VM, and that stopping does not delete the VM. The quiz tests understanding of these state changes and command effects.