
- Azure Cli Commands Cheat Sheet Printable
- Azure Cli Commands Cheat Sheet 2019
- Azure Cli Command Reference
- Azure Cheat Sheet Pdf
-->
The Azure CLI allows you to create and manage your Azure resources on macOS, Linux, and Windows. This article details some of the most common commands to create and manage virtual machines (VMs).
Free Cheat Sheet about Azure Functions. Register to our newsletter for free and download the Cheat Sheet about Azure Functions. Boris Wilhelms summarized the most important information, most used CLI commands, and common Triggers and Bindings. Print it out and keep it on your desk, hang it up as a poster, or simply save it digitally - we are sure it will help you with your next Azure Functions project. Run Import-AzurePublishSettingsFile to make your subscriptions available to the PowerShell command-line.publishsettings files may contain multiple subscriptions, run Get-AzureSubscription to identify which subscriptions were imported. Run Select-AzureSubscription to select the subscription to use.
This article requires the Azure CLI version 2.0.4 or later. Run az --version
to find the version. If you need to upgrade, see Install Azure CLI. You can also use Cloud Shell from your browser.
Basic Azure Resource Manager commands in Azure CLI

For more detailed help with specific command line switches and options, you can use the online command help and options by typing az <command> <subcommand> --help
.
Create VMs
Azure Cli Commands Cheat Sheet Printable
Task | Azure CLI commands |
---|
Create a resource group | az group create --name myResourceGroup --location eastus |
Create a Linux VM | az vm create --resource-group myResourceGroup --name myVM --image ubuntults |
Create a Windows VM | az vm create --resource-group myResourceGroup --name myVM --image win2016datacenter |
Manage VM state
Task | Azure CLI commands |
---|
Start a VM | az vm start --resource-group myResourceGroup --name myVM |
Stop a VM | az vm stop --resource-group myResourceGroup --name myVM |
Deallocate a VM | az vm deallocate --resource-group myResourceGroup --name myVM |
Restart a VM | az vm restart --resource-group myResourceGroup --name myVM |
Redeploy a VM | az vm redeploy --resource-group myResourceGroup --name myVM |
Delete a VM | az vm delete --resource-group myResourceGroup --name myVM |
Get VM info
Task | Azure CLI commands |
---|
List VMs | az vm list |
Get information about a VM | az vm show --resource-group myResourceGroup --name myVM |
Get usage of VM resources | az vm list-usage --location eastus |
Get all available VM sizes | az vm list-sizes --location eastus |
Disks and images
Task | Azure CLI commands |
---|
Add a data disk to a VM | az vm disk attach --resource-group myResourceGroup --vm-name myVM --disk myDataDisk --size-gb 128 --new |
Remove a data disk from a VM | az vm disk detach --resource-group myResourceGroup --vm-name myVM --disk myDataDisk |
Resize a disk | az disk update --resource-group myResourceGroup --name myDataDisk --size-gb 256 |
Snapshot a disk | az snapshot create --resource-group myResourceGroup --name mySnapshot --source myDataDisk |
Create image of a VM | az image create --resource-group myResourceGroup --source myVM --name myImage |
Create VM from image | az vm create --resource-group myResourceGroup --name myNewVM --image myImage |

Next steps

For additional examples of the CLI commands, see the Create and Manage Linux VMs with the Azure CLI tutorial.

Set-up |
List all current Git configurations. |
Tell Git who you are. |
Clone an existing Git repository |
Clone an existing Git repository |
Basic Commands |
Show files that have been changed in your working directory |
Display all changes to tracked files |
Display all changes to tracked files |
List files that have been staged and ready to be committed |
Preview changes before merging |
Add all current changes to the next commit |
Add specific {file} to the next commit |
Commit all local changes in tracked files and supply a good {commit message} |
Commit all local changes in tracked files |
Change the last commit. (NOTE: Do not amend published commits.) |
History |
Show all commits, starting with the newest |
Show changes over time for a specific {file} |
Show who changed what and when in {file} |
Branches |
List all existing branches |
Switch HEAD to {branch} |
Create {new-branch} based on your current HEAD |
Create {new-branch} and switch to it |
Create a new tracking branch called {new-branch} based on a {remote-branch} |
Delete local {branch} |
Tags |
Mark the current commit with a {tag-name} |
Mark a significant changeset, such as a release, with tag 1.0.0 |
Azure Cli Commands Cheat Sheet 2019

Update |
List all currently configured remotes |
Show information about a {remote} |
Add a new remote repository named {remote} |
Connect your local repository to a remote {server} |
Download all changes from {remote} but do not merge into HEAD |
Fetch and merge changes on the remote server to your local working directory |
Download all changes from {remote} and merge into HEAD |
Azure Cli Command Reference
Publish |
Publish local changes on {remote} |
Publish changes to the master branch of your remote repository |
Publish {branch} to your remote repository |
Publish ALL branches to your remote repository |
Delete {branch} on {remote} |
Delete {branch} on your remote repository |
Publish your tags |
Merge and Rebase |
Merge a different {branch} into your active branch |
Rebase your current HEAD onto {branch}. (NOTE: Do not rebase published commits.) |
Abort a rebase |
Continue a rebase after resolving conflicts |
Use your configured merge tool to resolve conflicts. See git mergetool –tool-help |
Use your editor to manually resolve conflicts. Mark file as resolved afterwards. |
Undo |
Discard initial commit |
Discard local changes in a specific {file} |
Replace the changes in your working tree with the last content in HEAD. Changes already added to the index, as well as new files, will be kept. |
Revert to {commit-id} — producing a new commit with contrary changes |
Reset your HEAD pointer to a previous {commit-id}. This will preserve all changes as unstaged changes. |
Reset your HEAD pointer to a previous {commit-id}. This will preserve uncommitted local changes. |
Reset your HEAD pointer to a previous {commit-id}. This will discard ALL changes since that {commit-id}. |
Discard all local changes in your working directory |
Azure Cheat Sheet Pdf
Search |
Search the working directory for “myfunction()” |