Using the Azure CLI

The Azure portal gives an easy and quick way to experiment with the Azure services that are available, but requires you to perform operations in a manual way. As your application reaches maturity and as your environment becomes large, you should prefer to work in an automated and repeatable way that will reduce the risk of human error and will increase the speed at which you can make changes and provision resources.

The Azure CLI is a cross-platform, command-line utility that allows you to manage your Azure resources in an automated and scriptable way. To use the Azure CLI, download and install the latest bits from https://docs.microsoft.com/en-us/cli/azure/install-azure-cli.

You can work with the Azure CLI from any shell, such as PowerShell, the Windows command line, Base, and so on. Alternatively, you can work with the Azure Cloud Shell inside the portal.

To start working with the Azure CLI, you first need to log in. Type az login into your shell window. This will redirect your browser to a login page, where you'll need to enter your credentials.

If the login is successful, you should see the selected account and subscription details in the shell, for example:

PS C:Users	amir.dresher> az login
Note, we have launched a browser for you to login. For old experience with device code, use "az login --use-device-code"
You have logged in. Now let us find all subscriptions you have access to...
[
{
"cloudName": "AzureCloud",
"id": "bd51f004-5a88-4282-bc5c-ec1518068dfb",
"isDefault": true,
"name": "Free Trial",
"state": "Enabled",
"tenantId": "0d1731c3-13a6-470a-9906-fab677548576",
"user": {
"name": "[email protected]",
"type": "user"
}
}
]

The basic command-line structure of the Azure CLI looks like this:

az [group] [sub group] [command- create/delete/list] paramteres

For example, to display all the web applications (webapp) in your subscription, type the following command:

az webapp list 

In this case, webapp is the group and the requested command was list.

To see all the available groups, type az --help
To see the subgroups of a certain group, type az group --help.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.226.104.127