다음을 통해 공유


Using ARM Client to explore Azure Resources

 

Introduction

There is a tool called ARMClient using which you can examine your Azure Resources. This tool is available in chocolatey .

PROs and CONs

There are PROs and CONs to using this tool. The PRO is regardless of PS, CLI, ARM you can query Azure for the resources and properties using RAW calls into it. So you won’t be faced with the variations and nuances of some resources not being available in one method and available only in another. The CON is be prepared to use RAWly formatted queries (it is not a GUI) and receive raw JSON.

Sample Demos

Once you have it installed fire up your ARMClient. Establish your connection.You can just type :

ARMCLIENT LOGIN

This should pop up a login dialog, where you will enter your credentials to get a session connected.

From then on you can start PUTting, GETting, and do various other operations.

Listing your subscriptions

GETting your subscriptions.

clip_image002[5]

Now for subsequent queries as a convenience use the SET command to set a variable SUB to use in further queries.

C:\WINDOWS\system32>set SUB=/subscriptions/<SubscriptionID>

Eg. clip_image003[5]

Listing your resources using GET

The below call to resourceGroups will list all of your resources for the specific subscription

armclient GET %SUB%/resourceGroups?api-version=2014-04-01

clip_image005[5]

GETting the properties of a specific resource

Now to GET the properties of a specific resource do a GET on the resource. Below I am GET-ting the properties of the resource “payasyougodeleteme” which is of type WebSite by using

armclient GET %SUB%/resourceGroups/PayAsYouGoDeleteMe/providers/Microsoft.Web/sites?api-version=2014-04-01

clip_image007[5]

LIST the WebSite Configuration properties

List the WebSite’s Config properties with the following GET call.

armclient GET %SUB%/resourceGroups/payasyougodeleteme/providers/Microsoft.Web/sites/payasyougodeletesite/config/web?api-version=2014-11-01

SNAGHTML59edcf0

Now CHANGE a few of the Configuration properties.

1. phpVersion to 5.6

2. pythonVersion to 3.4 and

3. websocketsEnabled to true

using the property fragment in JSON as parameter

clip_image010[5]

Use the above as input (either as a referred file by using the @(FileName) OR inline ) in the call  to the PUT itself as shown below. Here I have used the inline input method.

armclient PUT %SUB%/resourceGroups/payasyougodeleteme/providers/Microsoft.Web/sites/payasyougodeletesite/config/web?api-version=2014-11-01 "{ "properties": { "phpVersion": "5.6","pythonVersion":"3.4","webSocketsEnabled":"true" } }”

clip_image012[5]

This returns the JSON shown above, with the new property values set as submitted by the PUT call.

CONCLUSION

Tools such as ARM Client and ARM Explorer are powerful tools to work directly against the underlying resources without regard to the limitations of PS, CLI or ARM. They operate directly against the actual objects in Azure without intermediaries like PS, CLI etc.,..