DEV Community

Alexey Melezhik
Alexey Melezhik

Posted on

Sparrow plugin to search / check resources in Azure resource group

Ever thought how to check if some resources exists in Azure resource group? This tasks is very common for those who deal with an Azure infrastructure automation.

Here is azure-resource-group plugin for the rescue:

Load resource list


# list all databases in RG_001102:

my %state = task-run "get resources list", "azure-resource-list", %(
  group     => "RG_001102"
  pattern  => "'servers/databases'"
);

for %state<list> -> $d {
  say $d.perl;
}
Enter fullscreen mode Exit fullscreen mode

Validate if specific resources exist in a resource group


# Check if there is any storage account in RG_001102:

task-run "get resources list", "azure-resource-list", %(
  group     => "RG_001102"
  list => (
    "Microsoft.Storage/storageAccounts"
  )         
);
Enter fullscreen mode Exit fullscreen mode

That is it. See updates on Sparrowhub.io

Top comments (0)