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.
A list of available subscriptions you have and their respective IDs will be generated.
Select the one you require following the onscreen instruction.
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.
The newly created resource group can also be located on the Azure portal for further verification.
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.
The created VM can be located on the Azure portal for further verification.
Open the VM resource on the portal.
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.
This content originally appeared on DEV Community and was authored by Emmanuel Oluajo
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/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.