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;
}
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"
)
);
That is it. See updates on Sparrowhub.io