Using Azure Logic Apps, I demonstrate how to get Azure resource groups and their containing Azure resource and enter them into a SharePoint List. Although grouping of resource groups and their resources is possible in the Azure Portal, displaying the same information in a SharePoint list could be useful in a dashboard friendly scenario where it can be viewed by people who don’t have access to the Azure portal.
High Level Logic
- Trigger Logic by a daily Recurrence
- Get List of Azure resource groups
- Delete all existing list items of Azure resources in its SharePoint List
- Loop through each Azure resource group
- Loop through each Azure Resource Group
- Save Azure resource group and resource as a SharePoint list item
- Loop through each Azure Resource Group
As a result, I can see a daily refresh of Azure Resource Groups and its resources the following SharePoint List.
Implementation Walk-through
- Trigger Logic App Daily
- Get List of Azure resource groups
- Get list items from the SharePoint list containing Azure Resources. This is to clean up existing data to re-enter latest resources.
- Loop through each list item from previous step, retrieve the list item ID and delete from the SharePoint List by this item ID.
- For the retrieve list of Azure resource groups from step 2), loo through each resource group and retrieve the list of its Azure resources. This can be a web app, virtual machine, virtual network, etc. To get the Tag value to be used in a future step, I used the Data Operation Compose to hold the Tags value.
- In a nested loop, enumerate through each Azure resource and create a new list item into the SharePoint List. I populate property values retrieved into its respective SharePoint List properties.
Final Remarks
If a SharePoint list isn’t your target destination of this information, then one can extend this logic App to simply email this information, enter into a database or other content management system. From there you can use this data and for further tracking, analysis, manipulation and governance as you see fit.