Hi,
The script you are entering isn't correct. There is no resource group "MyResourceGroup" and you don't have permission to create it. You can use instructions below to workaround the bug that is currently part of this exercise.
Please navigate to the Create an Azure virtual machine exercise, Activate a new sandbox, sign in, etc. Once sandbox is activated and black cloud shell window with "Welcome to Azure Cloud Shell" displayed, navigate to Exercise - Configure network access using the "Unit x of 14" dropdown above the exercise.
After page loads and resource group name is updated to learn-, immediately navigate back to Create an Azure virtual machine exercise and complete it. For each step you need to click Copy in the upper right corner of the code block and then right-click and choose Paste in Cloud Shell window on right, then press enter.
Inspiration for above workaround came from @pnaroju's #2 suggestion in this post.
Please click Accept Answer and upvote if the above was helpful.
Thanks.
-TP