Logic apps : Azure Resource Manager Connector - how to specify $expand parameter

芹沢 基樹 111 Reputation points
2020-12-29T08:33:44.31+00:00

I am trying to get VM information in a resource group by using "List resources by resource group (Preview)" action.

Logic Apps parameters

Filter: "resourcetype eq 'Microsoft.Compute/virtualMachines'"

Expand: "HardwareProfile"

Filter parameter seems working since it returns VMs, however, Expand parameter does not work. it does not return any hardware profile of VMs.
How should I specify Expand parameter to retrieve hardware profile like VM size?
Is there any reference manual of $expand parameter?

Azure Logic Apps
Azure Logic Apps
An Azure service that automates the access and use of data across clouds without writing code.
0 comments No comments
{count} votes

Answer accepted by question author
  1. MayankBargali-MSFT 70,991 Reputation points Moderator
    2020-12-29T10:12:01.013+00:00

    Hi @芹沢 基樹

    As per the document of Resources - List By Resource Group I don't see $expand parameter accepting the value as 'HardwareProfile'.
    $expand accepts Comma-separated list of additional properties to be included in the response. Valid values include createdTime, changedTime and provisioningState.
    For example, $expand=createdTime,changedTime.

    I do see another API Resources-Get By ID where you provide the resource ID details and it returns the resource details including the hardware profile details.

    "hardwareProfile": {
    "vmSize": "Standard_B1s"
    }

    You can use the Read a resource action in your logic app providing the detail:
    Short Resource ID will be virtualMachines/yourVirtualMachineName

    51808-image.png

    Logic App Input/Response:

    51908-image.png

    You can modify the above according to your needs rather than hardcoding the values.

    Please let me know if you have any queries or concerns.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.