CREATING A VIRTUAL MACHINE USING AZURE CLI

We already established that there are several routes that can be taken to achieve the deployment of resources and services on Azure.
For today, I will be using the Azure Command Line Interface (CLI) to create a virtual machine on Azure.

PRER…


This content originally appeared on DEV Community and was authored by Emmanuel Oluajo

We already established that there are several routes that can be taken to achieve the deployment of resources and services on Azure.
For today, I will be using the Azure Command Line Interface (CLI) to create a virtual machine on Azure.

PREREQUISITE

  • Working computer
  • Internet connection
  • Microsoft Azure account + active subscription
  • PowerShell application

PROCEDURE

INSTALL AZURE CLI

Regardless of which OS runs on your computer, click on this link (https://learn.microsoft.com/en-us/cli/azure/) to get guidelines on how to set up Azure CLI on your computer.

CONNECT TO AZURE ACCOUNT

To achieve this, type in this command az login in the command line interface.
You either have a sign-in webpage or a sign-in pop-up window appearing on your screen after entering that command.
Select the Azure account you want to log in with and click on “Continue” as shown below.

Image description

A list of available subscriptions you have and their respective IDs will be generated.

Image description

Select the one you require following the onscreen instruction.

Image description

CREATE A RESOURCE GROUP

Create a resource group by entering a command in the interface following the format below:
az group create --name **resourcegroupname** --location **regionname**
NB: The asterisked sections are to be customised to suit your requirements.
A message informing users of the success will be displayed on the following lines.

Image description

The newly created resource group can also be located on the Azure portal for further verification.

Image description

CREATE A VIRTUAL MACHINE

In a manner similar to how a resource group was created, a virtual machine can also be created but in this case, providing more specifications as we would on the Azure portal when creating a VM.
Enter a command in the CLI following the format below:
az vm create --resource-group **resourcegroupname** --name **vmname** --image operatingsystemname --admin-username username --admin-password '**password0!**' --size **vmsize** --subnet **subnetname** --vnet-name **vnetname** --nsg **nsgname** --no-wait
NB: The asterisked sections are to be customised to suit your requirements.

Image description

The created VM can be located on the Azure portal for further verification.
Open the VM resource on the portal.

Image description

On the VM page, click on “Settings” and then, “Advisor recommendations” to see if the VM and other resources are not running at optimal states.

Image description

Image description


This content originally appeared on DEV Community and was authored by Emmanuel Oluajo


Print Share Comment Cite Upload Translate Updates
APA

Emmanuel Oluajo | Sciencx (2024-06-25T16:23:25+00:00) CREATING A VIRTUAL MACHINE USING AZURE CLI. Retrieved from https://www.scien.cx/2024/06/25/creating-a-virtual-machine-using-azure-cli-2/

MLA
" » CREATING A VIRTUAL MACHINE USING AZURE CLI." Emmanuel Oluajo | Sciencx - Tuesday June 25, 2024, https://www.scien.cx/2024/06/25/creating-a-virtual-machine-using-azure-cli-2/
HARVARD
Emmanuel Oluajo | Sciencx Tuesday June 25, 2024 » CREATING A VIRTUAL MACHINE USING AZURE CLI., viewed ,<https://www.scien.cx/2024/06/25/creating-a-virtual-machine-using-azure-cli-2/>
VANCOUVER
Emmanuel Oluajo | Sciencx - » CREATING A VIRTUAL MACHINE USING AZURE CLI. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2024/06/25/creating-a-virtual-machine-using-azure-cli-2/
CHICAGO
" » CREATING A VIRTUAL MACHINE USING AZURE CLI." Emmanuel Oluajo | Sciencx - Accessed . https://www.scien.cx/2024/06/25/creating-a-virtual-machine-using-azure-cli-2/
IEEE
" » CREATING A VIRTUAL MACHINE USING AZURE CLI." Emmanuel Oluajo | Sciencx [Online]. Available: https://www.scien.cx/2024/06/25/creating-a-virtual-machine-using-azure-cli-2/. [Accessed: ]
rf:citation
» CREATING A VIRTUAL MACHINE USING AZURE CLI | Emmanuel Oluajo | Sciencx | https://www.scien.cx/2024/06/25/creating-a-virtual-machine-using-azure-cli-2/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.