The Wayback Machine - https://web.archive.org/web/20241001055506/https://www.geeksforgeeks.org/microsoft-azure-azure-cli-commands-to-manage-azure-vms/
Open In App

Microsoft Azure – Azure CLI Commands to Manage Azure VMs

Last Updated : 30 Mar, 2023
Summarize
Comments
Improve
Suggest changes
Like Article
Like
Save
Share
Report
News Follow

Azure Command-line interface is used to manage or to create Azure resources. By using the simple AZ CLI command we can manage Azure VM quickly and at a Scale.

Let’s get started by using a few important Azure CLI commands to manage Azure Virtual Machines.

1.  Start a Specific Stopped VM in a Select Resource Group

Use the below command to start a specific VM in a select Resource group that has been stopped:

az vm start --resource-group 'resource_group_name --name vm_name

Example:

az vm start --resource-group Cloud-Operations --name CloudOpsVM

Output:

Output Image 2:

 2.  Stop a Specific Running VM in a Select Resource Group

Use the below command to stop a running VM in a select Resource group:

az vm stop --resource-group 'resource_group_name --name vm_name

Example:

az vm stop --resource-group Cloud-Operations --name CloudOpsVM

Output:

Output Image 2:

3.  Deallocate a Specific VM in a Select Resource Group

Use the below command to deallocate a specific VM in a select Resource group:

az vm deallocate --resource-group 'resource_group_name --name vm_name

Example:

az vm deallocate --resource-group Cloud-Operations --name CloudOpsVM

Output:

Output Image 2:

4. Restart a Specific Select VM in a Select Resource Group

Use the below command to restart  a specific VM in a select Resource group:

 az vm restart --resource-group 'resource_group_name --name vm_name

Example:

 az vm restart --resource-group Cloud-Operations --name CloudOpsVM

Output:

Output Image 2:


Previous Article
Next Article

Similar Reads

Microsoft Azure - Manage Azure VMs using Azure PowerShell Commands
Here we are using Azure PS Commands to manage azure resources from Azure Cloud Shell or by using Windows PowerShell. By using the simple AZ PS command we can manage Azure VM Quicks without any efforts of navigating in Azure Portal and at Scale. Let's get started by using the major Azure PS commands to manage Azure Virtual Machine. 1. Start a Specif
2 min read
Microsoft Azure - Create SHH Key to Manage Azure Linux VMs
Creating an SSH key resource allows you to manage and use public keys stored in Azure with Linux virtual machines. Here In this article, we will be creating an SSH Key to manage Azure Linux Virtual Machines in Azure by using a public key. Let's get started by creating a one in Azure. Create SHH Key in Azure: Follow the steps to create an SSH key in
2 min read
Microsoft Azure - Pre-built Azure VMs
In this article, we will learn how to get started with Prebuilt Azure Virtual Machines ready for containers. If you wanted to get started with Docker, and you're thinking if there were some VMs that had already been set up with Docker and some images for you to try out, then you should definitely check out the VMs that are available inside the Azur
2 min read
Microsoft Azure - CPU and Memory Utilization of Azure VMs in a Single Table Chart
In this article, you will see that how you can analyze your azure virtual machine's performance of both CPU Utilization and Memory Utilization at once using azure log queries. These KQL queries will help you to understand all the Azure VMs Performance in the form of a table chart and this will also allow you to export the data in the CSV file. With
3 min read
Microsoft Azure - Check for Apache Log4J Vulnerability in Azure VMs
In this article, we'll be finding the Apache Log4J Application is Installed in Azure Servers or Not by using Azure Portal. As logging to servers is not possible at a time to find Log4J We'll use KQL Query to find it. With the help of KQL Query, we will be finding the Detecting Log4j Installed Servers by using the Azure Monitor service in Azure Port
2 min read
Microsoft Azure - VMs Patch Update Summary by Installation Status
Here we will be using the KQL Query to find the Status of Patch Updates by Installation Status. Use Azure Log Analytics Workspace or Azure Workbook to run the queries in this article. KQL Query 1: Use the below log analytics log query to get the details of resources where Installation Status is Succeeded. UpdateRunProgress | summarize arg_max(TimeG
2 min read
Microsoft Azure - Configure Azure SQL with Azure CLI
In this article, we're going to take a closer look at how you can configure something like connectivity using the Azure CLI. What we have here is we are in Azure Data Studio and similar to the SQL notebook we are actually using a PowerShell notebook. That just means all our code cells are going to run PowerShell and we are just connecting to localh
4 min read
Microsoft Azure - Install Azure Command Line Interface (Azure CLI)
Azure CLI is a very powerful tool that can be used to automate tasks, create, update, manage or delete azure resources or to troubleshoot problems with az module cmdlets. By installing az modules on your system or on your development system you and your development team can easily create, update or manage Azure AD and Azure resources such as manage
4 min read
How to Manage Azure CLI Extensions in Command Line Interface?
In this article, we are going to provide the steps on how to list, find, install, update, and remove Azure CLI extensions from Azure Command Line Interface (Azure ACI) or Azure Cloud Shell. What are Azure CLI Extensions?Azure CLI or Command Line Interface is a powerful tool developed by Microsoft used to do almost every automation task in Azure Clo
4 min read
Deploying NGINX Image To AKS Using Azure CLI and Advanced Kubectl Commands
Pre-requisite: AKS Features Azure Kubernetes Service (AKS) is a managed Kubernetes service that enables you to quickly deploy and manage clusters. AKS makes it easy to deploy and manage containerized applications without having to worry about the underlying infrastructure. It is a fully managed service, meaning that Microsoft handles the maintenanc
3 min read
Microsoft Azure - Using Table Parameter in Azure CLI
In this article, you'll learn how to use the Table Parameter to change the format of the output when you're issuing commands with the Azure CLI. When you're working with version 2.0 of the Azure CLI, the results from the commands that you're on are typically returned to you in the JSON format. So, for instance, if we want to search for our resource
2 min read
Microsoft Azure - Create App Service Plan For Linux (Azure CLI)
An app service plan is a subscription model for hosting apps on Azure. It allows you to host multiple apps on a single server without having to pay for each app separately. In this article, we will show you how to deploy an Azure App Service Plan for Linux service type using Azure CLI (Command Line Interface) from Azure Portal in simple easy steps.
2 min read
Microsoft Azure - Building Your Own Azure CLI Extensions
Pre-requisite: AZURE, Python wheel, PIP Extensions for the Azure CLI are really useful. This Azure Tip has information on them. You may choose extensions from this list, which is also accessible when you run the Azure CLI command az extension list-available —output table.Steps To Build Azure CLI ExtensionsStep 1: The first thing we'll do is make a
3 min read
Scaling Azure VMs: Vertical And Horizontal Strategies
As someone who has been working with Azure for a few years now, I can attest to the importance of having a cloud infrastructure that can adapt to changing workloads and demands. One of the key features that has really impressed me about Azure is its ability to scale virtual machines (VMs) using two main strategies: vertical scaling and horizontal s
11 min read
Configuring Network Settings for Azure VMs
Microsoft Azure virtual machines (VMs) provide scalable on-demand computing resources. Configuring the network settings of these virtual machines is important to ensure they communicate effectively and securely within your infrastructure. This article walks you through the basics and step-by-step procedures for setting up a network and provides exa
2 min read
Setting Up a VPN Gateway for Azure VMs
Azure VPN Gateway is a service that companies can use to set up remote access for their clients or representatives to safely give them the option to work from home or anywhere without risking their security frameworks to the public web. Overview of VPN Gateway and Its Benefits for Azure VMsAzure VPN Gateway acts as a bridge between your virtual mac
5 min read
Backup and Disaster Recovery Strategies for Azure VMs
Azure Virtual Machines (VMs) are an important service in Microsoft's Azure cloud platform. They remove the requirement for physical hardware by allowing users to create, deploy, and customize virtual machines in the cloud. With support for various operating systems and seamless integration with other Azure services, Azure VMs provide a flexible fou
9 min read
Microsoft Azure - Manage and Export Azure Policies with GitHub Integration
You can manage and deploy export policy resources using GitHub Workflows and Actions. To export your policy definitions and assignments, you should have GitHub Account or Org GitHub Account access to implement the activity. The purpose of exporting policies to GitHub is to have source version control audit details. Prerequisites:GitHub Account and
2 min read
Microsoft Azure - Manage Virtual Machine via Azure Mobile App
In this article, you will get to know how to stay connected and in control of Azure virtual machines while using the Azure mobile app. The Azure mobile app is also called a VM app. Implementation: You would see the metric chart and find that spike visually via the chart and then you have those commands available for you that you can just in one cli
2 min read
Microsoft Azure - Automatically Manage Azure Blobs Lifecycles
In this article, we will look into how to automatically manage Azure Blobs lifecycles. Azure Blob Storage offers different access tiers to reduce your storage costs. A blob in the hot tier costs the most and can be accessed very fast, while a blob in the archive tier is cheaper and is slower. Implementation: Follow the below steps to automatically
2 min read
Microsoft Azure - Manage Azure AD Privileged Identity Management
Azure AD PIM stands for Azure Active Directory Privileged Identity Management (PIM). With Privileged Identity Management (PIM), the azure admin or user can manage, control, and monitor access to Azure Resources within the organization. Use Privileged Identity Management (PIM) to manage the lifecycle of role assignments of the users or groups and en
2 min read
Use high-level (s3) commands with the AWS CLI
Amazon Simple Storage Service (Amazon S3) is a generally utilized, versatile, and highly dependable object storage service provided by Amazon Web Services (AWS). S3 allows you to store and recover any measure of data whenever, from anyplace on the web, while the AWS Management Console Center offers an easy to understand interface for managing S3, a
6 min read
DynamoDB Dynamo: AWS CLI Commands for NoSQL Database
As we know, there are three main ways to access and manage AWS services, AWS CLI (command line interface), the AWS Management Console, and the AWS SDK(Software (software kit). Here we are working with the first tool, which is AWS CLI (command line interface) which is basically used for interacting with AWS Resources through scripting and automation
7 min read
AWS CLI SQS Commands: Key Operations and Examples
AWS Simple Queue Service (SQS) is a fully managed message queuing service that helps in decoupling and scaling microservices, distributed systems, and serverless applications, it facilitates the building of reliable communication between different parts of a system, which in turn assists in constructing fault-tolerant, distributed systems capable o
5 min read
AWS CLI Commands for S3 Object Storage
Amazon S3 stands for Simple Storage Service, the most widely adopted cloud storage solution provided by Amazon Web Services. It provides a scalable, secure, and highly durable platform for storing and retrieving any volume of data from or to anywhere on the web. This greatly helps you, whether as a developer, data analyst, or IT administrator, to i
5 min read
KMS Commands: AWS CLI for Key Management Service
AWS Key Management Service is a fully managed service that enables the user to create and control the encryption keys that encrypt their data. AWS KMS is very instrumental in securing sensitive information for data integrity in a secure cloud environment. AWS KMS integrates well with different AWS services, making it easy, therefore, to deploy encr
5 min read
Microsoft Azure - Create App Service Plan for Windows Service using CLI
Pre-requisite:- Azure An App Service Plan is a subscription model for hosting apps on Azure. It allows you to host multiple apps on a single server without paying for each app separately. This article will show you how to deploy an Azure App Service Plan with Windows service type using Azure CLI (Command Line Interface) from Azure Portal using Clou
2 min read
Pitfalls to Avoid When Using Spot VMs in GKE for Cost Reduction
Google Kubernetes Engine (GKE) offers on-demand and spot VMs for running user workloads (pods, deployments, and daemon sets), providing a low-cost solution to run specific workloads within your Kubernetes cluster. Spot VMs are unused Compute Engine instances within a cloud provider's data center available at a significant discount. Spot VMs are an
6 min read
Microsoft Azure- Backing Up, Restoring, and Cloning Microsoft Azure App Services
Microsoft is well known for developing relevant software which are using in today's time of technology to conquer the demand of users and developers to build up applications. In sequence of it Microsoft introduces Azure well known as Microsoft Azure to make quality applications. In this article, we will discuss Backing up, restoring and cloning Mic
8 min read
Microsoft Azure -Create a User in Microsoft Entra ID from Azure Portal
A user in Microsoft Entra ID is an individual who can get access to Azure identity. This Microsoft Entra ID identity can be used to access applications and resources that are protected within the organization or project. Users can be created manually or automatically, and they can be assigned to groups and roles to control their access permissions.
3 min read