Automate Azure Resources using Azure CLI
Steps:
Download Azure cli using the below link
https://learn.microsoft.com/en-us/cli/azure/install-azure-cli-windows?tabs=azure-cli
Open terminal and check for the version using the below command
"az version"
To connect azure cli downloaded in our machine with azure portal we need to run the below command
az login
It will ask to select the account to login
select the account and you will see the below screen
creating resources through Azure CLI
Go the azure cli documentation and switch to the creating resources page
https://learn.microsoft.com/en-us/cli/azure/reference-docs-index
Go the create resource page
https://learn.microsoft.com/en-us/cli/azure/manage-azure-groups-azure-cli
Enter the command and execute accordingly
az group create --name MyResourceGroup --location eastus
Creating azure vm
az vm create
--resource-group rg1
--name vm1--image Ubuntu2204
--vnet-name vnet1--subnet sb1
--generate-ssh-keys--output json
--verboseCheck whether VM is created or not by logging into the azure portal
Delete the resource group to delete all the resources
az group delete --name learn-azure-cli