Using Azure CLI for managing Azure resources: Difference between revisions

From PUBLIC-WIKI
Jump to navigation Jump to search
Eyales (talk | contribs)
No edit summary
Eyales (talk | contribs)
No edit summary
Line 17: Line 17:
* Run the command below to verify the currently selected Azure subscription:
* Run the command below to verify the currently selected Azure subscription:
: '''az account show'''
: '''az account show'''
== Resource group related commands ==
* Create a new Azure resource group:
: '''az group create --name MyResourceGroup --location MyLocation'''
: Note 1: Replace MyResourceGroup with your own relevant group name
: Note 2: Replace MyLocation with the target location, from the list below:
: https://azure.microsoft.com/en-us/global-infrastructure/locations/
* List information about a resource group:
: '''az group show --name MyResourceGroup --output table'''
: Note: Replace MyResourceGroup with your own relevant group name

Revision as of 11:03, 18 February 2019

Installing Azure CLI

  • Login to the machine using privileged account.
  • Download the latest build of Azure CLI.
  • Windows download instruction and location:
https://docs.microsoft.com/en-us/cli/azure/install-azure-cli-windows?view=azure-cli-latest
  • Linux download instruction and location:
https://docs.microsoft.com/en-us/cli/azure/install-azure-cli-linux?view=azure-cli-latest

Common Azure CLI commands

  • Login to an Azure account, from command prompt:
az login
  • List available subscriptions:
az account list --output table
  • Change the context to a specific Azure subscription:
az account set --subscription "My Subscription"
Note: Replace “My Subscription” with the relevant subscription name
  • Run the command below to verify the currently selected Azure subscription:
az account show

Resource group related commands

  • Create a new Azure resource group:
az group create --name MyResourceGroup --location MyLocation
Note 1: Replace MyResourceGroup with your own relevant group name
Note 2: Replace MyLocation with the target location, from the list below:
https://azure.microsoft.com/en-us/global-infrastructure/locations/
  • List information about a resource group:
az group show --name MyResourceGroup --output table
Note: Replace MyResourceGroup with your own relevant group name