Vital Azure Commands and Usage

Below are some important Commands to manage Azure resources. Mastering these commands will make administering your tasks on Azure flawless. For more commands not discussed here, take a look at the Microsoft documentation: https://docs.microsoft.com/en-us/cli/azure/reference-index?view=azure-cli-latest

az account listGet a list of subscriptions for the logged-in account.
az account list –output tableThe table format prints output as an ASCII table, making it easy to read and scan.
az group list List resource groups.
az group list –output tableThe table format prints output as an ASCII table, making it easy to read and scan.
az resource list
List resources.
az resource list –output tableThe table format prints output as an ASCII table, making it easy to read and scan.

These commands can be run with optional parameters to list the output formats for Azure CLI commands as we have seen above. Here are the various output format available at the time of this writing.

– TSV output format
– YAML output format
– Table output format and
– JSON output format

See the link below for more information https://docs.microsoft.com/en-us/cli/azure/format-output-azure-cli?view=azure-cli-latest

Filtering only resources related to an application

az resource list \
    --resource-group learn-1c01caa9-34c5-4e85-bd3e-e27861f2910b \
    --resource-type Microsoft.Web/sites

How to Stop an application in a resource group

az webapp stop \
    --resource-group learn-1c01caa9-34c5-4e85-bd3e-e27861f2910b \
    --name <web app name>
@Azure:~$ az webapp stop --resource-group learn-1c01caa9-34c5-4e85-bd3e-e27861f2910b     --name firsttestazur

Accessing the URL of the stopped app will display the following errors.

How to Start a WebApp in an Azure Resource Group via Azure CLI

le@Azure:~$ az webapp stop     --resource-group learn-1c01caa9-34c5-4e85-bd3e-e27861f2910b     --name firsttestazur 

Now the website will be reachable again.