Hello @Anonymous ,
Thanks for posting your query on Microsoft QnA.
From this learn module, you are creating two different VMs - SalesVM and MarketingVM and both VMs get a public IP assigned and by default a NSG rule allowing SSH connections to port 22 from "Any" Source gets created. This is the reason why you are able to ssh between both these VMs using the public IP because Any public IP can reach your VM, unless you filter it accordingly.
If you try to SSH between both these VMs using the public IP you will be successfully able to SSH, but if you try doing the same with private IP, you won't be able to SSH. That is when peering will help.
Please refer to the below image to see the default SSH rule that gets created when you create the VMs via cloud shell.
I hope this clears your understanding.
------------------------------------------
Please don't forget to "Accept as Answer" and "Upvote" and if you think my response was helpful.