Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does the Azure CLI use the Azure Rest API

Does the Azure CLI SDK use the Azure Rest API internally? And if so any further details on how these relate to each other internally would be great.

like image 211
Steven Mark Ford Avatar asked Mar 15 '18 04:03

Steven Mark Ford


People also ask

How does Azure CLI work?

Azure CLI is a command-line tool to create and manage resources. You interact with Azure by running commands in a terminal or writing scripts to automate tasks. Azure CLI interacts with the Azure Resource Manager (ARM) service, which is the management layer to interact with resources in your account.

What is Azure CLI written in?

The Azure CLI is a cross-platform toolset written in Python that allows you to manage nearly all of your Azure resources from the command line.

What are the two primary methods for accessing the Azure CLI?

The Azure CLI for Windows can also be used from a browser through the Azure Cloud Shell or run from inside a Docker container. For Windows, the Azure CLI is installed via a MSI, which gives you access to the CLI through the Windows Command Prompt (CMD) or PowerShell.


2 Answers

Yes, you are right. Azure CLI uses Azure Rest APi.

If you use --debug, you will find the API the command use. For example:

az vm list --debug

Yes, as Johan said, Azure Power Shell/CLI, SDK all call Azure Rest API. If you use debug mode, you could see the API. More information about Azure Rest API, you could check this link.

like image 172
Shui shengbao Avatar answered Nov 15 '22 08:11

Shui shengbao


Each service in Azure exposes a set of APIs. For managing/creating/updating your resources (e.g. creating a Virtual Machine), these are REST calls. Note: Other services may use non-HTTP/REST APIs (e.g. AMQP for Azure Service Bus).

While you can use your favorite HTTP networking stack or utility (e.g. curl, postman etc.) to make HTTP/REST calls, Microsoft publishes a set of SDKs to make things easier to develop applicationsin various languages.

The Azure CLI happens to be implemented in python, and thus makes use of the Azure Python SDKs to get its work done.

There is no separate Azure CLI SDK, however.

like image 38
Johan Stenberg Avatar answered Nov 15 '22 08:11

Johan Stenberg