Skip to content

AzureVM

Prerequisites

You’ll need to have rights to create and modify virtual machines.

Login to Azure Portal

Click here to login to Azure and open a cloud shell :link:.

If you get the welcome message, choose PowerShell. Create storage in a subscription where you have access. choose powershell
When your shell loads, check that you are running Powershell in the top left of your window. If not, use the drop down arrow to change it. azure ps

Switch into your cloud drive so anything you download and run will persist from session to session.

Terminal window
cd ~/clouddrive

Download the helper script

This script lets you pick a subscription, creates a unique resource group for you (critical if others running this tutorial in the same subscription), and provides common commands.

Download the helper script:

Terminal window
curl https://www.suchcodewow.io/manifests/helper.ps1 > ~/clouddrive/helper.ps1

Create the virtual machine

Run the helper script to create a resource group and a host.

Terminal window
~/clouddrive/helper.ps1

What’s happening here?

The script:

  1. uses your email up to ’@’ as a unique identifier.
  2. allows you to select a subscription (and set it as default).
  3. creates a resource group in the format: scw-group-(name).
  4. creates a vm in that resource group with the format: scw-host-(name).
  5. saves the public IP of your host into the myip file.

About the host creation step:

  • We’re using the long term support (LTS) version of Ubuntu linux for the image.
  • The - - size Standard_B2ms is a good combination of price and a large enough host (2cpu & 8gb mem) to run kubernetes.
  • public-ip-sku assigns a public IP address so we can access our machine remotely.
  • We’re generating an ssh key (or using your existing one) instead of a password to login.

Once the script menu appears, press < enter > and quit. You can run the helper script again at any time.

Copy the myip file into your host.

choose yes if asked to store your host’s fingerprint.

Terminal window
scp myip azureuser@$(cat myip):/home/azureuser/myip

Waiter, there seems to be a cat in my scp?SCP is the secure copy command. We’re using it to copy the myip file to your host to use later. The cat command outputs the file contents (just the ip address in this case) and the $() part means “run whatever command is in here”. In the end, scp gets the azure user name and the IP of the host. The part after ’:’ is the folder and filename on your host where scp saves the file.

:checkered_flag: Checkpoint

Run the helper script:

Terminal window
~/clouddrive/helper.ps1

Once it loads, you’ll see options to quickly login to your Azure VM or reset the password. It also shows you the exact command it runs to perform those steps if you want to copy them out to use later.

If you successfully login, congratulations! You’ve configured your host.

Next Steps

Check out the next numbered item on the left sidebar for more.