&nnbsp;
Azure Storage Account RestAPI provides HTTP PUT call to create a new Azure Storage account using Postman. It is simple 2 step process in Postman to create storage account.

  1. Get access_token to authenticate the user
  2. Create storage account in Azure.

Steps:

>> First we will create a Azure Service Principal so that this can be used for authentication when create storage account request is submitted. Follow this link to create Service Principal who will have access to subscription level. You can as well select “Storage Account Contributor” Role instead of “Contributor“. Once Service Principal is created, Open Postman to create a collection and requests to add a new Storage Account.

>> Create GET OAuth2 token request to get access_token.  Place this URL – https://login.microsoftonline.com/{directoryId}/oauth2/token

Replace the {directoryId} with your account directory ID. You can get this directory ID from AAD –> Properties as shown below

>> Add parameters in Body as  shown in the screen shot and assign them the values which you noted while creating the Service Principal. Values for grant_type and resource will exactly same as shown in the screen shot above.

>>Create a Global variable “access_token” and paste the below statements in Tests tab as shown

var data = JSON.parse(responseBody);
postman.setGlobalVariable("access_token", data.access_token);

 

>>Click Send, it will save the “access_token” value returned in the response.

>>Authentication process is completed. Now add PUT request to create storage account. Create 3 environment variables – subscriptionId, resourceGroupName and accountName and assign the values. “accountName” will be the name of  the storage account you want to create.

https://management.azure.com/subscriptions/{{subscriptionId}}/resourceGroups/{{resourceGroupName}}/providers/Microsoft.Storage/storageAccounts/{{accountName}} ?api-version=2018-02-01

>>On Authorization tab, select “Bearer Token” under Type drop-down and then provide the global variable name “access_token” as its value.

>>Now place the below JSON code in Body tab

{
  "sku": {
    "name": "Standard_GRS"
  },
  "kind": "StorageV2",
  "location": "australiaeast"
}

 

>>Click on Send button and successful requests to create a new account return a 202 status code with an empty response body. The storage account is created asynchronously. 

>> If you Send the same request again after few minutes, it will provide the response something like below

The storage account is created. If you want more details about different possible options then check this link- https://docs.microsoft.com/en-us/rest/api/storagerp/storage-sample-create-account

 
 
 





&nnbsp;