Azure Rest Api Postman Basics

Apr. 14, 2021

Absolute basics with Azure and PostMan

Getting started

Many of the articles I have found online with regards to the Azure REST API assume a fair level of familiarity with Azure which can be a good and bad thing. You see the Azure Portal makes interacting with the Azure REST API very easy as a lot of the “prerequisite” work is done in the portal as part of the process. For this blog post we will work on something quite basic, “Create a Virtual Machine”.

Jon Gallant has some great content around this and I did use some content from here, thank you Jon Gallant.

Within the Azure Portal this is very easy and only requires a few clicks, however under the hood, in order for the Azure REST API to work, there is a lot more going on. Lets dive in :smile:

API Order

  1. Have a Resource Group available or create one.
  2. Have a Virtual Network (VNET) available or create one.
  3. Create a Virtual Network Interface Card (NIC) or create one.
  4. Create a Virtual Machine.

There is a lot of association and the like that goes on in the background.

  1. Resource Group created.
  2. NIC associated to VNET.
  3. NIC associated to VM.
  4. VM created in Resource Group.

Using the API

So, what I have done, is simply create a collection within Postman that uses both collection variables and “Pre-request” scripts to make this collection “portable”.

Postman Collection

I use a set of collection variables to help with the initial API Call. Postman Api Collection With each of the call you will the variables enclosed with “{}” and path variables prefixed with “:Postman with Variables With most of the Postman queries, the “Pre-request Script” is also used, this is used to set “extra” pieces of information, for example, specifying a location for the Resource Group. Postman with pre-request script

So, go forth and play. My Postman Collection can be found here