0
votes

I can able to fetch the resource details using the Azure CLI command. However, is there a way to fetch the specific resource details using Azure API Management URL? I have listed out the Azure API Management link to get the tag details. I need Azure API Management to get the resource details via API. Please help me.

CLI command (Get-AzResource -Tag @{ "ApplicationID"="XXX"})

Output Name : sample-dev-func ResourceGroupName : example-rg ResourceType : Microsoft.Web/sites Location : eastus ResourceId : /subscriptions/xxxxxxx/resourceGroups/xxxxx/providers/Microsoft.Web/sites/resourceName etc..,

Azure Management API

https://management.azure.com/subscriptions/{subscriptionId}/tagNames?api-version=2021-04-01

1

1 Answers

0
votes

However, is there a way to fetch the specific resource details using Azure API Management URL?

Yes. You can use Resources - List REST API to get the list of resources. This API supports filtering by tag name/value.

From the same link:

Resources can be filtered by tag names and values. For example, to filter for a tag name and value, use $filter=tagName eq 'tag1' and tagValue eq 'Value1'. Note that when resources are filtered by tag name and value, the original tags for each resource will not be returned in the results. Any list of additional properties queried via $expand may also not be compatible when filtering by tag names/values.

For tag names only, resources can be filtered by prefix using the following syntax: $filter=startswith(tagName, 'depart'). This query will return all resources with a tag name prefixed by the phrase depart (i.e.department, departureDate, departureTime, etc.)

Tip: Azure CLI essentially is a wrapper of Azure REST API. If you want to see the actual request sent by the CLI command and the response received, simply execute your CLI command with --verbose switch. You will get all the details.