Make changes to Azure App Service setting using Postman

I wrote an article here “How to disable/enable HTTP/2, Azure App Service” that showed how to change an Azure App Service setting Resource Explorer.  You can also do this from Postman, which I wrote about here “Using Postman to call Azure REST APIs” .

The most challenging aspect of doing this is getting the Bearer token which is required so the request you are making from Postman is authenticated.  In the article I already mentioned “Using Postman to call Azure REST APIs”, I show you how to get this token using Fiddler, you can also get it from an F12 Network trace log as well, Figure 1.

image

Figure 1, how to get bearer token from F12

In this article I will retrieve the Bearer token using the ARMClient which is hosted on GitHub here and requires choco to install it.  Both are easy to install so I will not go into that much here.

image

Figure 2, how to install the ARMClient

Then to get the Bearer token, I enter the following command and it is now in my clipboard, Figure 3.

armclient token <subscriptionId>

image

Figure 3, how to get a Bearer token, install the ARMClient

Yes, ok, I got “There is no login token.  Please login to acquire a token”, so I logged in, using “ARMCLIENT LOGIN” and then re-executed the token request…Figure 4.

armclient login

image

Figure 4, how to get a Bearer token, install the ARMClient

Now, to change, for example the “http20Enabled” attribute, first try a GET with the required headers, Figure 5.  I used a URL similar to this:

https: //management.azure.com/subscriptions/<subscriptionId>/resourceGroups/
           <resourceGroup>/providers/Microsoft.Web/sites/<appName>/config/
           web?api-version=2016-08-01

I executed a GET request to make sure the request was working, Figure 5.

image

Figure 5, how update Azure App Service attributes using ARMClient Postman

Then, to update the Azure App Service attribute, do the following:

  • Use the same URL as you did with the GET method
  • Select the PUT verb
  • Copy the contents from the Body of the GET response
  • Paste the Body into the PUT request
  • Add the Authentication header
  • Update the attribute you want to modify
  • Press Send

Should look something similar to Figure 6.

image

Figure 6, how update Azure App Service attributes using ARMClient Postman

Once successful, run the GET request again to retrieve the attributes and confirm the modification was performed.