Azure Cloud Shell - Sandbox sudo password

V, Desika (Cognizant) 101 Reputation points
2022-10-08T07:46:05.973+00:00

Hi Team,

I'm trying to create a Linux VM using Azure CLI commands in sandbox. VM has been created. To run the command 'sudo apt-get update', I need to get the password so that I can proceed further on my learning. But I'm not sure about the password. Please help as I'm new to this concept.

Azure Azure Training
{count} votes

3 answers

Sort by: Most helpful
  1. ajkuma 28,036 Reputation points Microsoft Employee Moderator
    2023-01-30T19:52:25.7766667+00:00

    Adding the answer provided @TP on this thread: Sudo password for azure sandbox

    You need to ssh to the vm you created before you can use sudo. Please see instructions below to complete the exercise.

    Please activate new sandbox and create the VM as instructed in the exercise. After Task 1 finishes, make a note of the publicIpAddress that was assigned to the VM (e.g. 20.245.72.52). Start Task 2, and then when it errors out, follow steps below:

    Connect to the newly-created VM using ssh (in cloud shell). You will need to substitute the publicIpAddress you noted above for <VM public ip address> below:

    ssh azureuser@<VM public ip address>

    Enter yes when you are prompted.

    Copy and right-click -- paste the following three commands below in the cloud shell window. Wait for each to complete before pasting in the next command.

    sudo apt-get update
    
    sudo apt-get install -y nginx
    
    echo "<html><body><h2>Welcome to Azure! My name is $(hostname).</h2></body></html>" | sudo tee -a /var/www/html/index.html
    

    Performing the steps above should only add a couple of minutes to the process. Continue on in the module.

    10 people found this answer helpful.

  2. ajkuma 28,036 Reputation points Microsoft Employee Moderator
    2022-10-12T09:22:36.677+00:00

    To benefit the community, find the right answer, posting our discussion from comments.

    You don’t have to manually run the command sudo apt-get update, the bash script takes care of invoking this automatically with elevated permissions.
    (Unit 3, Task 1 -step 2- invoking az vm extension set cmdlet)

    Yes, “if the sandbox times out while you're in the middle of the lesson, you will lose all work up to that point. You will have to reactivate the environment and go back to the beginning of the module to start over."

    Thanks for your patience and co-operation, @V, Desika (Cognizant)

    1 person found this answer helpful.

  3. Daniela Montenegro Guzmán 0 Reputation points
    2023-09-18T16:54:41.64+00:00

    I just wrote the "ssh azureuser@my VM public ip address" command and it worked for me. Thanks!

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.