AWS/Azure/OpenShift

Azure CLI commands: How to use Azure Command-line Interface

Azure CLI

Azure AD is a service that provides identity and access management capabilities in the cloud. With Pass-through Authentication, users are able to sign in to both on-premises and cloud-based applications using the same credentials. Below are some important Commands to manage Azure resources. Mastering these commands will make administering your tasks on Azure flawless. Please see the following guide Azure Active Directory integration with on-Premise AD using PTA for more information and also this guide for reasons to deploy AAD, how to set up Azure AD Tenant, how to add or delete users, and set permissions in Azure Active Directory, why do I need to deploy Azure Active Directory and how to use the built-in AAD Connect troubleshooting tool.

How to use Azure Command-line Interface

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. See the link below for more information

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

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.

Command-line Interface

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. I hope you found this blog post helpful. If you have any questions, please let me know in the comment session.

Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x