Open gabrielvachon opened 9 months ago
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @venu-l.
My guess: this may be caused by different API versions used by both products. But I'll leave the conclusion to Resource Graph team to make.
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @venu-l.
My guess: this may be caused by different API versions used by both products. But I'll leave the conclusion to Resource Graph team to make.
Seems like they both use the same API.
When running Search-AzGraph -Query <query> -Debug
, the URI points to https://management.azure.com/providers/Microsoft.ResourceGraph/resources?api-version=2021-03-01
. While the request I retrieved from the inspector shares the same URI.
Debug :
DEBUG: ============================ HTTP REQUEST ============================
HTTP Method:
POST
Absolute Uri:
https://management.azure.com/providers/Microsoft.ResourceGraph/resources?api-version=2021-03-01
Headers:
Accept-Language : en-US
x-ms-client-request-id : f60ffc8d-ecae-49c9-acd1-c4255a18711f
Body:
{
"subscriptions": [...],
"query": "authorizationresources\n| where type =~ 'microsoft.authorization/roleassignments'\n| extend roleDefinitionId = tostring(properties.roleDefinitionId)\n| join kind=inner authorizationresources on $left.roleDefinitionId == $right.id\n| project id, name, roleDefinitionId, properties=properties1, roleName=tostring(properties1.roleName)\n| where roleName == 'Owner'",
"options": {
"$top": 100,
"$skip": 0,
"resultFormat": "objectArray",
"allowPartialScopes": false
}
}
Can you share correlation ID + timestamp for a query run from PowerShell and for a query run from Portal so we can investigate on our side?
PowerShell :
Portal :
I had to switch from using Search-AzGraph to a straight Invoke-RestMethod using the 2022-10-01 API version. otherwise, it was way out using the Search-AzGraph function which uses:
Absolute Uri: https://management.azure.com/providers/Microsoft.ResourceGraph/resources?api-version=2021-03-01
Would be great if we could specify the API version.
Description
I wrote a KQL query on the Azure Resource Graph Explorer and tried to get the same results with the Search-AzGraph command. However, on some queries I got less results (or none) when I queried from PowerShell.
Issue script & Debug output
Environment data
Module versions
Error output