
❕This article has not been completed yet. However, it may already contain helpful Information and therefore it has been published at this stage
✏️ Note: |
---|
This step by step guide is based on a Microsoft Learn article that I went through myself. |
- Set the default location
az configure --defaults location=westeurope

✏️ Note: |
---|
Possible values: westus2, southcentralus, centralus, eastus, westeurope..... |
2. Create a resource group
az group create --name MyResourceGroup

✏️ Note: |
---|
This step creates a resource group named "MyResourceGroup" in the Region Western Europe. |
3. List resource groups
az group list --output table

✏️ Note: |
---|
As you can see, a resource group named "MyResourceGroup" has been created. |
4. Set the default resource group
# Defining the default resource group
az configure --defaults group="MyResourceGroup"

5. Create the Linux VM
# Creating the Azure Linux VM
az vm create --name support-web-vm01 --image Canonical:UbuntuServer:16.04-LTS:latest --size Standard_DS1_v2 --admin-username azureuser --generate-ssh-keys
✏️ Note: |
---|
The VM is set up as a web server running an Ubuntu OS." |

✏️ Note: |
---|
The VM's name is support-web-vm01. Its size is Standard_DS1_v2. The admin username is azureuser. In practice, this name can be whatever you like. The --generate-ssh-keys argument generates an SSH keypair for you, allowing you to connect to your VM over SSH." |
6. Checking whether the SSH client is installed on the access machine
# Checking whether the necessary SSH client is installed
ssh

✏️ Note: |
---|
If the ssh command throws an error message, follow the following link https://geekrewind.com/how-to-install-openssh-client-in-windows-11 . |
7. Under certain circumstances, the necessary folder structures and files are not created. Therefore, we now do this ourselves.
# Creating the ssh program path and the needed config file
New-Item -Path $HOME\.ssh\config -ItemType File -force

8. Download the private key created in step 5
✏️ Note: |
---|
The following method only works in the Azure Cloud Shell. |
- Select Manage files
- Click on Download

- Specifiy the file that needs to be downloaded ".ssh/id_rsa"
- Click on Download

- Copy the downloaded file into the right folder ("C:\Windows\Users\<username>\.ssh\")

9. To customize the SSH configuration file in the right way we need the public IP of the created VM
# Retrieving the public IP of the Linux Azure VM
az vm show \
--name support-web-vm01 \
--show-details \
--query [publicIps] \
--output tsv

10. Customizing the SSH connection configuration using Notepad
# Open config File with Notepad
C:\WINDOWS\System32\notepad.exe $HOME\.ssh\config

# For Azure Linux VM
Host <Public IP>
User azureuser
Port 22
IdentityFile ~/.ssh/id_rsa
IdentitiesOnly yes
11. Testing the access
# Accessing the Azure Linux VM via SSH
ssh azureuser@20.4.22.39
# Should the connection be established?
Are you sure you want to continue connecting (yes/no/[fingerprint])?

Result:

References:
Exercise - Add a data disk to a VM - Training
Exercise - Add a data disk to a VM

Location of OpenSSH configuration file on Windows
How do I set the host name and port in a config file for Windows, using OpenSSH through PowerShell? As on Unix/Linux: Edit or create the file now by typing: nano ~/.ssh/config In here...

How to manage Azure resource groups – Azure CLI
Learn how to manage Azure resource groups in the Azure CLI, a cross-platform tool to connect to Azure and execute administrative commands on Azure resources.

A Guide to Installing the OpenSSH Client on Windows 11