This article talks about the Azure Resource Explorer tool from Microsoft, briefly touching on Resources and Resource Groups, and finally an example of how I have used it.
Let’s start by taking a quick look at what Resources and Resource Groups are…
Resources and Resource Groups
Resources are Azure components that provide functionality, either individually or when combined.
If you build a VM in Azure then a resource of type Microsoft.Compute/virtualMachines will be created but additionally, resources for networking (Microsoft.Network/networkInterfaces and Microsoft.Network/virtualNetworks) and storage (Microsoft.Compute/disks) will be created.
Rather than the components that make up a server, if we look at servers based on an example workload, we may have web servers and an MSSQL database server.
These servers can be logically organised into resource groups. By placing those three servers in a Line of Business (LOB) resource group that provides web hosting, we can easily locate all the appropriate Resources.
Another example of how resources can be grouped could be based on team functionality rather than LOB so that MSSQL servers are in one resource group managed by DBAs and web servers are in another managed by the app platform team.
Azure Resource Explorer
Browse to the Azure Resource Manager website (https://resources.azure.com) and log in if required. The list of subscriptions you have available will be shown, select the appropriate one.
The resource groups in the subscription are automatically retrieved so choose the one which contains the resource you are after.
Here I have selected the VmTutorial resource group that was created in a previous article (Create a Linux VM in Azure).
Providers will show a list of the Azure resource providers that are used to create & manage the resources used within this resource group, for example, Microsoft.Network which provides the VNET and IP address, amongst others.
Expanding a resource provider and selecting a specific resource will show the details in JSON format.
Clicking resources will show all the resources used in the resource group in a JSON format.
There are also a couple of tabs which could be pretty useful – Powershell and Ansible. Selecting either of these tabs will display either a script or a Playbook that can be copied and used to create the resources from code.
Essentially, Azure Resource Explorer provides a visual interface allowing you to view the config of your infrastructure.
Example: ARE and MS Flow
I’ve been using Microsoft Flow (
https://emea.flow.microsoft.com/en-us/) a fair bit recently and one of the actions I needed to use was the Azure Resource Manager – “Read a resource”. This action connects to an Azure subscription and allows us to retrieve a JSON file that can be parsed for use within the flow.
Select the “Read a resource” action and then you will see the information that this action requires. This is where the Azure Resource Explorer helps remove the guesswork 🙂
Click the drop-down for Subscription and Flow will retrieve a list of available subscriptions based on the account you have logged in with – select the appropriate one from the list.
Next, select the resource group containing the resource you want to query.
Without using Azure Resource Explorer, it can be a bit of “hit and miss” as to whether you can guess/figure out the correct resource provider to use. What would be handy is if the resource providers could be loaded by default for the resources available…
Let’s pop back to Azure Resource Explorer to grab the resource provider, short resource ID and client API version so we can read into Flow details of the disk(s) used by the VM.
On the Data tab, there is an address bar that contains a URL for the GET API rest service. This URL can be used in a REST client to return the information in JSON.
This is the URL to return disk info for my Ubuntu VM (I’ve replaced my subscription with “nnnnnn“):
“https://management.azure.com/subscriptions/nnnnnn/resourceGroups/VmTutorial/providers/Microsoft.Compute/disks/UbuntuWebVM_OsDisk_1_e44eea6cf9b94233a50de718442d812a?api-version=2017-03-30″
From this URL we can easily see the required information:
provider: Microsoft.Compute
short resource id:
disks/UbuntuWebVM_OsDisk_1_e44eea6cf9b94233a50de718442d812a
client API version: 2017-03-30
With all the required details in place, we can now read the Azure resource and parse the returned JSON using the “Parse JSON” data operations action. To do this, select the “Resource information” variable made available from the “Read a resource” action in the dynamic content list.
Hop back to Azure Resource Explorer and copy the JSON information. Come back to Flow and then click the link below the Schema box to generate the schema from a sample payload. Paste the JSON previously copied and click Done.
You can now use the values parsed from the Azure resource JSON in the flow by browsing the dynamic content and selecting the required value, in this example diskSizeGB.
Leave a comment below and let me know how you use Azure Resource Explorer or any cool ways you use Azure Resources within Flow.
Leave a Reply