The first option we will consider is the Azure REST API. All actions on Azure resources are managed through ARM, and this is exposed by a set of APIs. When we perform actions in the Azure portal, we are actually making HTTP calls to the REST APIs.
Information Note
Representational State Transfer (REST) is an architectural pattern that exposes data using a defined set of standards in a text-based format using stateless protocols – that is, information between calls (the state) is not expected to be maintained. A web service that implements this pattern is said to be RESTful.
Other management options such as PowerShell, CLI, and DevOps also just wrap calls to the APIs in a more friendly way; however, you can interact with those APIs directly, as we can see in the following diagram:

Figure 17.1 – REST APIs are used by other services
Any call to the API must use the following URI and format:
https://management.azure.com/<resource-path>?<query-string>
The resource path determines the resource or resource collection we want to work on and may involve multiple segments. Often, this includes stating the subscription and resource group where any particular resource may reside. For example, to create a virtual machine we could make the following PUT request:
The query string is optional but can be used to provide additional information such as the API version or resource selection criteria.
Because the REST APIs allow complete access to the Azure platform, every request must include an access token in the request header. We obtain the access code by first making a call to https://login.microsoftonline.com/<tenant>/oauth2/v2.0.
How this is performed depends on many factors, which are included in the type of authorization flow you or the application making the calls uses. These flows are beyond the scope of this book; however, the important point to understand is that any calls to the Azure REST APIs must include an access token.
Using the REST APIs, we can directly interact with the Azure platform or we can build our own apps that use those calls to perform set functions. For example, we could build an application that allows users to perform specific tasks such as stopping and starting VMs without going via the Azure portal.
When automating deployments, we would usually use existing tools such as PowerShell or the Azure CLI, which we will cover next.
Leave a Reply