From 937e438d9d487a3bd6d987f608fed1755a8d484c Mon Sep 17 00:00:00 2001 From: makharch Date: Tue, 20 Apr 2021 04:47:03 -0700 Subject: [PATCH 1/3] Changed output to a custom class with Data and SkipToken properties --- .../ScenarioTests/ResourceGraphQueryTests.ps1 | 174 ++++++++++-------- .../ManagementGroups.json | 120 +++--------- .../PagedQuery.json | 28 +-- .../Query.json | 28 +-- .../QueryError.json | 26 +-- .../SkipTokenQuery.json | 24 +-- .../Subscriptions.json | 70 +++---- .../Cmdlets/SearchAzureRmGraph.cs | 12 +- .../Models/PSResourceGraphResponse.cs | 30 +++ .../ResourceGraph/ResourceGraph.format.ps1xml | 25 +++ .../ResourceGraph/help/Search-AzGraph.md | 2 +- 11 files changed, 265 insertions(+), 274 deletions(-) create mode 100644 src/ResourceGraph/ResourceGraph/Models/PSResourceGraphResponse.cs diff --git a/src/ResourceGraph/ResourceGraph.Test/ScenarioTests/ResourceGraphQueryTests.ps1 b/src/ResourceGraph/ResourceGraph.Test/ScenarioTests/ResourceGraphQueryTests.ps1 index d63c4bb76df6..baa48a3dfb79 100644 --- a/src/ResourceGraph/ResourceGraph.Test/ScenarioTests/ResourceGraphQueryTests.ps1 +++ b/src/ResourceGraph/ResourceGraph.Test/ScenarioTests/ResourceGraphQueryTests.ps1 @@ -18,30 +18,32 @@ Run simple query #> function Search-AzureRmGraph-Query { - $queryResult = Search-AzGraph "project id, tags, properties | limit 2" - - Assert-IsInstance Object[] $queryResult - Assert-AreEqual 2 $queryResult.Count - - Assert-IsInstance System.Management.Automation.PSCustomObject $queryResult[0] - Assert-IsInstance System.Management.Automation.PSCustomObject $queryResult[1] - Assert-PropertiesCount 4 $queryResult[0] - Assert-PropertiesCount 4 $queryResult[1] - - Assert-IsInstance String $queryResult[0].id - Assert-IsInstance String $queryResult[1].id - Assert-IsInstance String $queryResult[0].ResourceId - Assert-IsInstance String $queryResult[1].ResourceId - Assert-IsInstance System.Management.Automation.PSCustomObject $queryResult[0].tags - Assert-IsInstance System.Management.Automation.PSCustomObject $queryResult[1].tags - Assert-IsInstance System.Management.Automation.PSCustomObject $queryResult[0].properties - Assert-IsInstance System.Management.Automation.PSCustomObject $queryResult[1].properties + $queryResult = Search-AzGraph 'Resources | where tags != "" | project id, tags, properties | limit 2' + + Assert-IsInstance Microsoft.Azure.Commands.ResourceGraph.Models.PSResourceGraphResponse $queryResult + Assert-Null $queryResult.SkipToken + Assert-IsInstance System.Collections.Generic.List[PSObject] $queryResult.Data + Assert-AreEqual 2 $queryResult.Data.Count + + Assert-IsInstance System.Management.Automation.PSCustomObject $queryResult.Data[0] + Assert-IsInstance System.Management.Automation.PSCustomObject $queryResult.Data[1] + Assert-PropertiesCount 4 $queryResult.Data[0] + Assert-PropertiesCount 4 $queryResult.Data[1] + + Assert-IsInstance String $queryResult.Data[0].id + Assert-IsInstance String $queryResult.Data[1].id + Assert-IsInstance String $queryResult.Data[0].ResourceId + Assert-IsInstance String $queryResult.Data[1].ResourceId + Assert-IsInstance System.Management.Automation.PSCustomObject $queryResult.Data[0].tags + Assert-IsInstance System.Management.Automation.PSCustomObject $queryResult.Data[1].tags + Assert-IsInstance System.Management.Automation.PSCustomObject $queryResult.Data[0].properties + Assert-IsInstance System.Management.Automation.PSCustomObject $queryResult.Data[1].properties - Assert-AreEqual $queryResult[0].id $queryResult[0].ResourceId - Assert-AreEqual $queryResult[1].id $queryResult[1].ResourceId + Assert-AreEqual $queryResult.Data[0].id $queryResult.Data[0].ResourceId + Assert-AreEqual $queryResult.Data[1].id $queryResult.Data[1].ResourceId - Assert-PropertiesCount 2 $queryResult[0].properties - Assert-PropertiesCount 4 $queryResult[1].properties + Assert-PropertiesCount 7 $queryResult.Data[0].properties + Assert-PropertiesCount 7 $queryResult.Data[1].properties } <# @@ -52,29 +54,31 @@ function Search-AzureRmGraph-PagedQuery { # Page size was artificially set to 2 rows $queryResult = Search-AzGraph "project id" -First 3 -Skip 2 - - Assert-IsInstance Object[] $queryResult - Assert-AreEqual 3 $queryResult.Count - Assert-IsInstance System.Management.Automation.PSCustomObject $queryResult[0] - Assert-IsInstance System.Management.Automation.PSCustomObject $queryResult[1] - Assert-IsInstance System.Management.Automation.PSCustomObject $queryResult[2] + Assert-IsInstance Microsoft.Azure.Commands.ResourceGraph.Models.PSResourceGraphResponse $queryResult + Assert-IsInstance System.String $queryResult.SkipToken + Assert-IsInstance System.Collections.Generic.List[PSObject] $queryResult.Data + Assert-AreEqual 3 $queryResult.Data.Count + + Assert-IsInstance System.Management.Automation.PSCustomObject $queryResult.Data[0] + Assert-IsInstance System.Management.Automation.PSCustomObject $queryResult.Data[1] + Assert-IsInstance System.Management.Automation.PSCustomObject $queryResult.Data[2] - Assert-PropertiesCount 2 $queryResult[0] - Assert-PropertiesCount 2 $queryResult[1] - Assert-PropertiesCount 2 $queryResult[2] + Assert-PropertiesCount 2 $queryResult.Data[0] + Assert-PropertiesCount 2 $queryResult.Data[1] + Assert-PropertiesCount 2 $queryResult.Data[2] - Assert-IsInstance String $queryResult[0].id - Assert-IsInstance String $queryResult[1].id - Assert-IsInstance String $queryResult[2].id + Assert-IsInstance String $queryResult.Data[0].id + Assert-IsInstance String $queryResult.Data[1].id + Assert-IsInstance String $queryResult.Data[2].id - Assert-IsInstance String $queryResult[0].ResourceId - Assert-IsInstance String $queryResult[1].ResourceId - Assert-IsInstance String $queryResult[2].ResourceId + Assert-IsInstance String $queryResult.Data[0].ResourceId + Assert-IsInstance String $queryResult.Data[1].ResourceId + Assert-IsInstance String $queryResult.Data[2].ResourceId - Assert-True { $queryResult[0].id.Length -gt 0 } - Assert-True { $queryResult[1].id.Length -gt 0 } - Assert-True { $queryResult[2].id.Length -gt 0 } + Assert-True { $queryResult.Data[0].id.Length -gt 0 } + Assert-True { $queryResult.Data[1].id.Length -gt 0 } + Assert-True { $queryResult.Data[2].id.Length -gt 0 } } <# @@ -83,22 +87,28 @@ Run query with subscriptions explicitly passed #> function Search-AzureRmGraph-Subscriptions { - $testSubId = "eaab1166-1e13-4370-a951-6ed345a48c15" + $testSubId = "82506e98-9fdb-41f5-ab67-031005041a26" $nonExsitentTestSubId = "000b1166-1e13-4370-a951-6ed345a48c16" $query = "distinct subscriptionId | order by subscriptionId asc" - $queryResultTenant = Search-AzGraph $query + $queryResultSubsFromContext = Search-AzGraph $query $queryResultOneSub = Search-AzGraph $query -Subscription $testSubId $queryResultMultipleSubs = Search-AzGraph $query -Subscription @($testSubId, $nonExsitentTestSubId) - - Assert-IsInstance System.Management.Automation.PSCustomObject $queryResultTenant - Assert-AreEqual $testSubId $queryResultTenant.subscriptionId - Assert-IsInstance System.Management.Automation.PSCustomObject $queryResultOneSub - Assert-AreEqual $testSubId $queryResultOneSub.subscriptionId - - Assert-IsInstance System.Management.Automation.PSCustomObject $queryResultMultipleSubs - Assert-AreEqual $testSubId $queryResultMultipleSubs.subscriptionId + Assert-IsInstance Microsoft.Azure.Commands.ResourceGraph.Models.PSResourceGraphResponse $queryResultSubsFromContext + Assert-Null $queryResultSubsFromContext.SkipToken + Assert-IsInstance System.Collections.Generic.List[PSObject] $queryResultSubsFromContext.Data + Assert-AreEqual $testSubId $queryResultSubsFromContext.Data.subscriptionId + + Assert-IsInstance Microsoft.Azure.Commands.ResourceGraph.Models.PSResourceGraphResponse $queryResultOneSub + Assert-Null $queryResultOneSub.SkipToken + Assert-IsInstance System.Collections.Generic.List[PSObject] $queryResultOneSub.Data + Assert-AreEqual $testSubId $queryResultOneSub.Data.subscriptionId + + Assert-IsInstance Microsoft.Azure.Commands.ResourceGraph.Models.PSResourceGraphResponse $queryResultMultipleSubs + Assert-Null $queryResultMultipleSubs.SkipToken + Assert-IsInstance System.Collections.Generic.List[PSObject] $queryResultMultipleSubs.Data + Assert-AreEqual $testSubId $queryResultMultipleSubs.Data.subscriptionId } <# @@ -107,24 +117,24 @@ Run query with management groups explicitly passed #> function Search-AzureRmGraph-ManagementGroups { - $testSubId = "eaab1166-1e13-4370-a951-6ed345a48c15" - $testMgId1 = "f686d426-8d16-42db-81b7-ab578e110ccd" + $testSubId = "82506e98-9fdb-41f5-ab67-031005041a26" + $testMgId1 = "72f988bf-86f1-41af-91ab-2d7cd011db47" $testMgId2 = "makharchMg" $nonExistentTestMgId = "nonExistentMg" $query = "distinct subscriptionId | order by subscriptionId asc" - $queryResultTenant = Search-AzGraph $query $queryResultOneMg = Search-AzGraph $query -ManagementGroup $testMgId1 $queryResultMultipleMgs = Search-AzGraph $query -ManagementGroup @($testMgId1, $testMgId2, $nonExistentTestMgId) -AllowPartialScope - Assert-IsInstance System.Management.Automation.PSCustomObject $queryResultTenant - Assert-AreEqual $testSubId $queryResultTenant.subscriptionId + Assert-IsInstance Microsoft.Azure.Commands.ResourceGraph.Models.PSResourceGraphResponse $queryResultOneMg + Assert-Null $queryResultOneMg.SkipToken + Assert-IsInstance System.Collections.Generic.List[PSObject] $queryResultOneMg.Data + Assert-AreEqual $testSubId $queryResultOneMg.Data.subscriptionId - Assert-IsInstance System.Management.Automation.PSCustomObject $queryResultOneMg - Assert-AreEqual $testSubId $queryResultOneMg.subscriptionId - - Assert-IsInstance System.Management.Automation.PSCustomObject $queryResultMultipleMgs - Assert-AreEqual $testSubId $queryResultMultipleMgs.subscriptionId + Assert-IsInstance Microsoft.Azure.Commands.ResourceGraph.Models.PSResourceGraphResponse $queryResultMultipleMgs + Assert-Null $queryResultMultipleMgs.SkipToken + Assert-IsInstance System.Collections.Generic.List[PSObject] $queryResultMultipleMgs.Data + Assert-AreEqual $testSubId $queryResultMultipleMgs.Data.subscriptionId } <# @@ -133,28 +143,30 @@ Run simple query with the skip token #> function Search-AzureRmGraph-SkipTokenQuery { - $queryResult = Search-AzGraph "project id, properties" -SkipToken "ew0KICAiJGlkIjogIjEiLA0KICAiTWF4Um93cyI6IDMsDQogICJSb3dzVG9Ta2lwIjogNiwNCiAgIkt1c3RvQ2x1c3RlclVybCI6ICJodHRwczovL2FybXRvcG9sb2d5Lmt1c3RvLndpbmRvd3MubmV0Ig0KfQ==" - - Assert-IsInstance Object[] $queryResult - Assert-AreEqual 3 $queryResult.Count - - Assert-IsInstance System.Management.Automation.PSCustomObject $queryResult[0] - Assert-IsInstance System.Management.Automation.PSCustomObject $queryResult[1] - Assert-IsInstance System.Management.Automation.PSCustomObject $queryResult[2] - - Assert-IsInstance String $queryResult[0].id - Assert-IsInstance String $queryResult[1].id - Assert-IsInstance String $queryResult[2].id - Assert-IsInstance String $queryResult[0].ResourceId - Assert-IsInstance String $queryResult[1].ResourceId - Assert-IsInstance String $queryResult[2].ResourceId - Assert-IsInstance System.Management.Automation.PSCustomObject $queryResult[0].properties - Assert-IsInstance System.Management.Automation.PSCustomObject $queryResult[1].properties - Assert-IsInstance System.Management.Automation.PSCustomObject $queryResult[2].properties + $queryResult = Search-AzGraph "project id, properties" -SkipToken "ew0KICAiJGlkIjogIjEiLA0KICAiTWF4Um93cyI6IDMsDQogICJSb3dzVG9Ta2lwIjogMywNCiAgIkt1c3RvQ2x1c3RlclVybCI6ICJodHRwczovL2FyZy1ldXMtc2l4LXNmLmFyZy5jb3JlLndpbmRvd3MubmV0Ig0KfQ==" + + Assert-IsInstance Microsoft.Azure.Commands.ResourceGraph.Models.PSResourceGraphResponse $queryResult + Assert-IsInstance System.String $queryResult.SkipToken + Assert-IsInstance System.Collections.Generic.List[PSObject] $queryResult.Data + Assert-AreEqual 3 $queryResult.Data.Count + + Assert-IsInstance System.Management.Automation.PSCustomObject $queryResult.Data[0] + Assert-IsInstance System.Management.Automation.PSCustomObject $queryResult.Data[1] + Assert-IsInstance System.Management.Automation.PSCustomObject $queryResult.Data[2] + + Assert-IsInstance String $queryResult.Data[0].id + Assert-IsInstance String $queryResult.Data[1].id + Assert-IsInstance String $queryResult.Data[2].id + Assert-IsInstance String $queryResult.Data[0].ResourceId + Assert-IsInstance String $queryResult.Data[1].ResourceId + Assert-IsInstance String $queryResult.Data[2].ResourceId + Assert-IsInstance System.Management.Automation.PSCustomObject $queryResult.Data[0].properties + Assert-IsInstance System.Management.Automation.PSCustomObject $queryResult.Data[1].properties + Assert-IsInstance System.Management.Automation.PSCustomObject $queryResult.Data[2].properties - Assert-AreEqual $queryResult[0].id $queryResult[0].ResourceId - Assert-AreEqual $queryResult[1].id $queryResult[1].ResourceId - Assert-AreEqual $queryResult[2].id $queryResult[2].ResourceId + Assert-AreEqual $queryResult.Data[0].id $queryResult.Data[0].ResourceId + Assert-AreEqual $queryResult.Data[1].id $queryResult.Data[1].ResourceId + Assert-AreEqual $queryResult.Data[2].id $queryResult.Data[2].ResourceId } <# diff --git a/src/ResourceGraph/ResourceGraph.Test/SessionRecords/Microsoft.Azure.Commands.ResourceGraph.Test.ScenarioTests.ResourceGraphQueryTests/ManagementGroups.json b/src/ResourceGraph/ResourceGraph.Test/SessionRecords/Microsoft.Azure.Commands.ResourceGraph.Test.ScenarioTests.ResourceGraphQueryTests/ManagementGroups.json index cab636ad715e..e1e192e1d1ed 100644 --- a/src/ResourceGraph/ResourceGraph.Test/SessionRecords/Microsoft.Azure.Commands.ResourceGraph.Test.ScenarioTests.ResourceGraphQueryTests/ManagementGroups.json +++ b/src/ResourceGraph/ResourceGraph.Test/SessionRecords/Microsoft.Azure.Commands.ResourceGraph.Test.ScenarioTests.ResourceGraphQueryTests/ManagementGroups.json @@ -4,16 +4,16 @@ "RequestUri": "/providers/Microsoft.ResourceGraph/resources?api-version=2021-03-01", "EncodedRequestUri": "L3Byb3ZpZGVycy9NaWNyb3NvZnQuUmVzb3VyY2VHcmFwaC9yZXNvdXJjZXM/YXBpLXZlcnNpb249MjAyMS0wMy0wMQ==", "RequestMethod": "POST", - "RequestBody": "{\r\n \"query\": \"distinct subscriptionId | order by subscriptionId asc\",\r\n \"options\": {\r\n \"$top\": 100,\r\n \"$skip\": 0,\r\n \"resultFormat\": \"objectArray\",\r\n \"allowPartialScopes\": false\r\n }\r\n}", + "RequestBody": "{\r\n \"managementGroups\": [\r\n \"72f988bf-86f1-41af-91ab-2d7cd011db47\"\r\n ],\r\n \"query\": \"distinct subscriptionId | order by subscriptionId asc\",\r\n \"options\": {\r\n \"$top\": 100,\r\n \"$skip\": 0,\r\n \"resultFormat\": \"objectArray\",\r\n \"allowPartialScopes\": false\r\n }\r\n}", "RequestHeaders": { "x-ms-client-request-id": [ - "965b147e-ad00-4279-ace9-11593a225f69" + "4a1b4e9d-9fb6-4cf7-a10d-da0908e033cc" ], "Accept-Language": [ "en-US" ], "User-Agent": [ - "FxVersion/4.6.29812.02", + "FxVersion/4.6.29916.01", "OSName/Windows", "OSVersion/Microsoft.Windows.10.0.19042.", "Microsoft.Azure.Management.ResourceGraph.ResourceGraphClient/2.1.0.0" @@ -22,7 +22,7 @@ "application/json; charset=utf-8" ], "Content-Length": [ - "198" + "273" ] }, "ResponseHeaders": { @@ -48,22 +48,22 @@ "Kestrel" ], "x-ms-ratelimit-remaining-tenant-reads": [ - "14990" + "11999" ], "x-ms-request-id": [ - "cfba4a18-754e-4b0b-9c5f-a2cc433012c5" + "46f17fd3-9ce2-42b4-bae8-ac0e51770869" ], "x-ms-correlation-request-id": [ - "cfba4a18-754e-4b0b-9c5f-a2cc433012c5" + "46f17fd3-9ce2-42b4-bae8-ac0e51770869" ], "x-ms-routing-request-id": [ - "CENTRALUS:20210325T114648Z:cfba4a18-754e-4b0b-9c5f-a2cc433012c5" + "WESTUS:20210420T113452Z:46f17fd3-9ce2-42b4-bae8-ac0e51770869" ], "X-Content-Type-Options": [ "nosniff" ], "Date": [ - "Thu, 25 Mar 2021 11:46:47 GMT" + "Tue, 20 Apr 2021 11:34:52 GMT" ], "Content-Length": [ "133" @@ -75,23 +75,23 @@ "-1" ] }, - "ResponseBody": "{\r\n \"totalRecords\": 1,\r\n \"count\": 1,\r\n \"data\": [\r\n {\r\n \"subscriptionId\": \"eaab1166-1e13-4370-a951-6ed345a48c15\"\r\n }\r\n ],\r\n \"facets\": [],\r\n \"resultTruncated\": \"false\"\r\n}", + "ResponseBody": "{\r\n \"totalRecords\": 1,\r\n \"count\": 1,\r\n \"data\": [\r\n {\r\n \"subscriptionId\": \"82506e98-9fdb-41f5-ab67-031005041a26\"\r\n }\r\n ],\r\n \"facets\": [],\r\n \"resultTruncated\": \"false\"\r\n}", "StatusCode": 200 }, { "RequestUri": "/providers/Microsoft.ResourceGraph/resources?api-version=2021-03-01", "EncodedRequestUri": "L3Byb3ZpZGVycy9NaWNyb3NvZnQuUmVzb3VyY2VHcmFwaC9yZXNvdXJjZXM/YXBpLXZlcnNpb249MjAyMS0wMy0wMQ==", "RequestMethod": "POST", - "RequestBody": "{\r\n \"managementGroups\": [\r\n \"f686d426-8d16-42db-81b7-ab578e110ccd\"\r\n ],\r\n \"query\": \"distinct subscriptionId | order by subscriptionId asc\",\r\n \"options\": {\r\n \"$top\": 100,\r\n \"$skip\": 0,\r\n \"resultFormat\": \"objectArray\",\r\n \"allowPartialScopes\": false\r\n }\r\n}", + "RequestBody": "{\r\n \"managementGroups\": [\r\n \"72f988bf-86f1-41af-91ab-2d7cd011db47\",\r\n \"makharchMg\",\r\n \"nonExistentMg\"\r\n ],\r\n \"query\": \"distinct subscriptionId | order by subscriptionId asc\",\r\n \"options\": {\r\n \"$top\": 100,\r\n \"$skip\": 0,\r\n \"resultFormat\": \"objectArray\",\r\n \"allowPartialScopes\": true\r\n }\r\n}", "RequestHeaders": { "x-ms-client-request-id": [ - "fd49a4d5-ba7c-4f69-b654-34987ddda0e5" + "14102565-79ee-492b-b615-1df7437e1c73" ], "Accept-Language": [ "en-US" ], "User-Agent": [ - "FxVersion/4.6.29812.02", + "FxVersion/4.6.29916.01", "OSName/Windows", "OSVersion/Microsoft.Windows.10.0.19042.", "Microsoft.Azure.Management.ResourceGraph.ResourceGraphClient/2.1.0.0" @@ -100,7 +100,7 @@ "application/json; charset=utf-8" ], "Content-Length": [ - "273" + "313" ] }, "ResponseHeaders": { @@ -126,100 +126,22 @@ "Kestrel" ], "x-ms-ratelimit-remaining-tenant-reads": [ - "14989" - ], - "x-ms-request-id": [ - "5dbdd9e8-18e9-44b5-834f-0e0f8a6db46c" - ], - "x-ms-correlation-request-id": [ - "5dbdd9e8-18e9-44b5-834f-0e0f8a6db46c" - ], - "x-ms-routing-request-id": [ - "CENTRALUS:20210325T114648Z:5dbdd9e8-18e9-44b5-834f-0e0f8a6db46c" - ], - "X-Content-Type-Options": [ - "nosniff" - ], - "Date": [ - "Thu, 25 Mar 2021 11:46:48 GMT" - ], - "Content-Length": [ - "133" - ], - "Content-Type": [ - "application/json; charset=utf-8" - ], - "Expires": [ - "-1" - ] - }, - "ResponseBody": "{\r\n \"totalRecords\": 1,\r\n \"count\": 1,\r\n \"data\": [\r\n {\r\n \"subscriptionId\": \"eaab1166-1e13-4370-a951-6ed345a48c15\"\r\n }\r\n ],\r\n \"facets\": [],\r\n \"resultTruncated\": \"false\"\r\n}", - "StatusCode": 200 - }, - { - "RequestUri": "/providers/Microsoft.ResourceGraph/resources?api-version=2021-03-01", - "EncodedRequestUri": "L3Byb3ZpZGVycy9NaWNyb3NvZnQuUmVzb3VyY2VHcmFwaC9yZXNvdXJjZXM/YXBpLXZlcnNpb249MjAyMS0wMy0wMQ==", - "RequestMethod": "POST", - "RequestBody": "{\r\n \"managementGroups\": [\r\n \"f686d426-8d16-42db-81b7-ab578e110ccd\",\r\n \"makharchMg\",\r\n \"nonExistentMg\"\r\n ],\r\n \"query\": \"distinct subscriptionId | order by subscriptionId asc\",\r\n \"options\": {\r\n \"$top\": 100,\r\n \"$skip\": 0,\r\n \"resultFormat\": \"objectArray\",\r\n \"allowPartialScopes\": true\r\n }\r\n}", - "RequestHeaders": { - "x-ms-client-request-id": [ - "dce2920f-498d-4079-b950-d00d6ddfccca" - ], - "Accept-Language": [ - "en-US" - ], - "User-Agent": [ - "FxVersion/4.6.29812.02", - "OSName/Windows", - "OSVersion/Microsoft.Windows.10.0.19042.", - "Microsoft.Azure.Management.ResourceGraph.ResourceGraphClient/2.1.0.0" - ], - "Content-Type": [ - "application/json; charset=utf-8" - ], - "Content-Length": [ - "313" - ] - }, - "ResponseHeaders": { - "Cache-Control": [ - "no-cache" - ], - "Pragma": [ - "no-cache" - ], - "Strict-Transport-Security": [ - "max-age=31536000; includeSubDomains" - ], - "x-ms-ratelimit-remaining-tenant-resource-requests": [ - "12" - ], - "x-ms-user-quota-remaining": [ - "12" - ], - "x-ms-user-quota-resets-after": [ - "00:00:05" - ], - "Server": [ - "Kestrel" - ], - "x-ms-ratelimit-remaining-tenant-reads": [ - "14988" + "11998" ], "x-ms-request-id": [ - "4217e691-92e8-4d4b-acb2-d4eea81bdd14" + "792c7e08-7c43-4e31-86ea-6e8a4d01ebd5" ], "x-ms-correlation-request-id": [ - "4217e691-92e8-4d4b-acb2-d4eea81bdd14" + "792c7e08-7c43-4e31-86ea-6e8a4d01ebd5" ], "x-ms-routing-request-id": [ - "CENTRALUS:20210325T114648Z:4217e691-92e8-4d4b-acb2-d4eea81bdd14" + "WESTUS:20210420T113452Z:792c7e08-7c43-4e31-86ea-6e8a4d01ebd5" ], "X-Content-Type-Options": [ "nosniff" ], "Date": [ - "Thu, 25 Mar 2021 11:46:48 GMT" + "Tue, 20 Apr 2021 11:34:52 GMT" ], "Content-Length": [ "133" @@ -231,12 +153,12 @@ "-1" ] }, - "ResponseBody": "{\r\n \"totalRecords\": 1,\r\n \"count\": 1,\r\n \"data\": [\r\n {\r\n \"subscriptionId\": \"eaab1166-1e13-4370-a951-6ed345a48c15\"\r\n }\r\n ],\r\n \"facets\": [],\r\n \"resultTruncated\": \"false\"\r\n}", + "ResponseBody": "{\r\n \"totalRecords\": 1,\r\n \"count\": 1,\r\n \"data\": [\r\n {\r\n \"subscriptionId\": \"82506e98-9fdb-41f5-ab67-031005041a26\"\r\n }\r\n ],\r\n \"facets\": [],\r\n \"resultTruncated\": \"false\"\r\n}", "StatusCode": 200 } ], "Names": {}, "Variables": { - "SubscriptionId": "eaab1166-1e13-4370-a951-6ed345a48c15" + "SubscriptionId": "82506e98-9fdb-41f5-ab67-031005041a26" } } \ No newline at end of file diff --git a/src/ResourceGraph/ResourceGraph.Test/SessionRecords/Microsoft.Azure.Commands.ResourceGraph.Test.ScenarioTests.ResourceGraphQueryTests/PagedQuery.json b/src/ResourceGraph/ResourceGraph.Test/SessionRecords/Microsoft.Azure.Commands.ResourceGraph.Test.ScenarioTests.ResourceGraphQueryTests/PagedQuery.json index f35b873a62e4..cef3a043b2e2 100644 --- a/src/ResourceGraph/ResourceGraph.Test/SessionRecords/Microsoft.Azure.Commands.ResourceGraph.Test.ScenarioTests.ResourceGraphQueryTests/PagedQuery.json +++ b/src/ResourceGraph/ResourceGraph.Test/SessionRecords/Microsoft.Azure.Commands.ResourceGraph.Test.ScenarioTests.ResourceGraphQueryTests/PagedQuery.json @@ -4,16 +4,16 @@ "RequestUri": "/providers/Microsoft.ResourceGraph/resources?api-version=2021-03-01", "EncodedRequestUri": "L3Byb3ZpZGVycy9NaWNyb3NvZnQuUmVzb3VyY2VHcmFwaC9yZXNvdXJjZXM/YXBpLXZlcnNpb249MjAyMS0wMy0wMQ==", "RequestMethod": "POST", - "RequestBody": "{\r\n \"query\": \"project id\",\r\n \"options\": {\r\n \"$top\": 3,\r\n \"$skip\": 2,\r\n \"resultFormat\": \"objectArray\",\r\n \"allowPartialScopes\": false\r\n }\r\n}", + "RequestBody": "{\r\n \"subscriptions\": [\r\n \"82506e98-9fdb-41f5-ab67-031005041a26\"\r\n ],\r\n \"query\": \"project id\",\r\n \"options\": {\r\n \"$top\": 3,\r\n \"$skip\": 2,\r\n \"resultFormat\": \"objectArray\",\r\n \"allowPartialScopes\": false\r\n }\r\n}", "RequestHeaders": { "x-ms-client-request-id": [ - "81bf2ad8-16bd-4a25-9f8b-0d4548118971" + "796c9af2-3dc1-49ae-8087-ef071fb47553" ], "Accept-Language": [ "en-US" ], "User-Agent": [ - "FxVersion/4.6.29812.02", + "FxVersion/4.6.29916.01", "OSName/Windows", "OSVersion/Microsoft.Windows.10.0.19042.", "Microsoft.Azure.Management.ResourceGraph.ResourceGraphClient/2.1.0.0" @@ -22,7 +22,7 @@ "application/json; charset=utf-8" ], "Content-Length": [ - "153" + "225" ] }, "ResponseHeaders": { @@ -32,6 +32,9 @@ "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-tenant-reads": [ + "11999" + ], "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], @@ -47,26 +50,23 @@ "Server": [ "Kestrel" ], - "x-ms-ratelimit-remaining-tenant-reads": [ - "14990" - ], "x-ms-request-id": [ - "6b247104-a1d3-4eaa-9e8d-4631cae56423" + "a6b66435-26b7-4164-bef6-a723596037a0" ], "x-ms-correlation-request-id": [ - "6b247104-a1d3-4eaa-9e8d-4631cae56423" + "a6b66435-26b7-4164-bef6-a723596037a0" ], "x-ms-routing-request-id": [ - "CENTRALUS:20210325T114509Z:6b247104-a1d3-4eaa-9e8d-4631cae56423" + "WESTUS:20210420T113224Z:a6b66435-26b7-4164-bef6-a723596037a0" ], "X-Content-Type-Options": [ "nosniff" ], "Date": [ - "Thu, 25 Mar 2021 11:45:09 GMT" + "Tue, 20 Apr 2021 11:32:24 GMT" ], "Content-Length": [ - "688" + "797" ], "Content-Type": [ "application/json; charset=utf-8" @@ -75,12 +75,12 @@ "-1" ] }, - "ResponseBody": "{\r\n \"totalRecords\": 71,\r\n \"count\": 3,\r\n \"data\": [\r\n {\r\n \"id\": \"/subscriptions/eaab1166-1e13-4370-a951-6ed345a48c15/resourceGroups/lakshmia-test/providers/Providers.Test/statefulResources/0JH-JSRBLS\"\r\n },\r\n {\r\n \"id\": \"/subscriptions/eaab1166-1e13-4370-a951-6ed345a48c15/resourceGroups/lakshmia-test/providers/Providers.Test/statefulResources/0JH-SRPariv\"\r\n },\r\n {\r\n \"id\": \"/subscriptions/eaab1166-1e13-4370-a951-6ed345a48c15/resourceGroups/lakshmia-test/providers/Providers.Test/statefulResources/0JH-SRParivar\"\r\n }\r\n ],\r\n \"facets\": [],\r\n \"resultTruncated\": \"false\",\r\n \"$skipToken\": \"ew0KICAiJGlkIjogIjEiLA0KICAiTWF4Um93cyI6IDMsDQogICJSb3dzVG9Ta2lwIjogNSwNCiAgIkt1c3RvQ2x1c3RlclVybCI6ICJodHRwczovL2FybXRvcG9sb2d5Lmt1c3RvLndpbmRvd3MubmV0Ig0KfQ==\"\r\n}", + "ResponseBody": "{\r\n \"totalRecords\": 244,\r\n \"count\": 3,\r\n \"data\": [\r\n {\r\n \"id\": \"/subscriptions/82506e98-9fdb-41f5-ab67-031005041a26/resourceGroups/AzureResourcesCacheNotifications-Df-a/providers/Microsoft.Network/networkSecurityGroups/nsgSubnet-0\"\r\n },\r\n {\r\n \"id\": \"/subscriptions/82506e98-9fdb-41f5-ab67-031005041a26/resourceGroups/AzureResourcesCacheNotifications-Df-a/providers/Microsoft.Network/publicIPAddresses/LBIP-gov-art-df-nt-a\"\r\n },\r\n {\r\n \"id\": \"/subscriptions/82506e98-9fdb-41f5-ab67-031005041a26/resourceGroups/AzureResourcesCacheNotifications-Df-a/providers/Microsoft.Network/virtualNetworks/VNet-gov-art-df-nt-a\"\r\n }\r\n ],\r\n \"facets\": [],\r\n \"resultTruncated\": \"false\",\r\n \"$skipToken\": \"ew0KICAiJGlkIjogIjEiLA0KICAiTWF4Um93cyI6IDMsDQogICJSb3dzVG9Ta2lwIjogNSwNCiAgIkt1c3RvQ2x1c3RlclVybCI6ICJodHRwczovL2FyZy1uZXUtb25lLXNmLmFyZy5jb3JlLndpbmRvd3MubmV0Ig0KfQ==\"\r\n}", "StatusCode": 200 } ], "Names": {}, "Variables": { - "SubscriptionId": "eaab1166-1e13-4370-a951-6ed345a48c15" + "SubscriptionId": "82506e98-9fdb-41f5-ab67-031005041a26" } } \ No newline at end of file diff --git a/src/ResourceGraph/ResourceGraph.Test/SessionRecords/Microsoft.Azure.Commands.ResourceGraph.Test.ScenarioTests.ResourceGraphQueryTests/Query.json b/src/ResourceGraph/ResourceGraph.Test/SessionRecords/Microsoft.Azure.Commands.ResourceGraph.Test.ScenarioTests.ResourceGraphQueryTests/Query.json index 9891d90205c3..759602fbba18 100644 --- a/src/ResourceGraph/ResourceGraph.Test/SessionRecords/Microsoft.Azure.Commands.ResourceGraph.Test.ScenarioTests.ResourceGraphQueryTests/Query.json +++ b/src/ResourceGraph/ResourceGraph.Test/SessionRecords/Microsoft.Azure.Commands.ResourceGraph.Test.ScenarioTests.ResourceGraphQueryTests/Query.json @@ -4,16 +4,16 @@ "RequestUri": "/providers/Microsoft.ResourceGraph/resources?api-version=2021-03-01", "EncodedRequestUri": "L3Byb3ZpZGVycy9NaWNyb3NvZnQuUmVzb3VyY2VHcmFwaC9yZXNvdXJjZXM/YXBpLXZlcnNpb249MjAyMS0wMy0wMQ==", "RequestMethod": "POST", - "RequestBody": "{\r\n \"query\": \"project id, tags, properties | limit 2\",\r\n \"options\": {\r\n \"$top\": 100,\r\n \"$skip\": 0,\r\n \"resultFormat\": \"objectArray\",\r\n \"allowPartialScopes\": false\r\n }\r\n}", + "RequestBody": "{\r\n \"subscriptions\": [\r\n \"82506e98-9fdb-41f5-ab67-031005041a26\"\r\n ],\r\n \"query\": \"Resources | where tags != \\\"\\\" | project id, tags, properties | limit 2\",\r\n \"options\": {\r\n \"$top\": 100,\r\n \"$skip\": 0,\r\n \"resultFormat\": \"objectArray\",\r\n \"allowPartialScopes\": false\r\n }\r\n}", "RequestHeaders": { "x-ms-client-request-id": [ - "47602c51-aa93-433d-92b8-2e89b7c6878a" + "d30d2e76-c7fa-4169-b348-f01b023fde13" ], "Accept-Language": [ "en-US" ], "User-Agent": [ - "FxVersion/4.6.29812.02", + "FxVersion/4.6.29916.01", "OSName/Windows", "OSVersion/Microsoft.Windows.10.0.19042.", "Microsoft.Azure.Management.ResourceGraph.ResourceGraphClient/2.1.0.0" @@ -22,7 +22,7 @@ "application/json; charset=utf-8" ], "Content-Length": [ - "183" + "288" ] }, "ResponseHeaders": { @@ -36,10 +36,10 @@ "max-age=31536000; includeSubDomains" ], "x-ms-ratelimit-remaining-tenant-resource-requests": [ - "10" + "14" ], "x-ms-user-quota-remaining": [ - "10" + "14" ], "x-ms-user-quota-resets-after": [ "00:00:05" @@ -48,25 +48,25 @@ "Kestrel" ], "x-ms-ratelimit-remaining-tenant-reads": [ - "14994" + "11997" ], "x-ms-request-id": [ - "427a1d7f-3e50-4a97-87a8-9b84b98b91bf" + "2b289c00-81af-4d04-a814-acbb8698a9d1" ], "x-ms-correlation-request-id": [ - "427a1d7f-3e50-4a97-87a8-9b84b98b91bf" + "2b289c00-81af-4d04-a814-acbb8698a9d1" ], "x-ms-routing-request-id": [ - "NORTHEUROPE:20210325T114533Z:427a1d7f-3e50-4a97-87a8-9b84b98b91bf" + "WESTCENTRALUS:20210420T113301Z:2b289c00-81af-4d04-a814-acbb8698a9d1" ], "X-Content-Type-Options": [ "nosniff" ], "Date": [ - "Thu, 25 Mar 2021 11:45:33 GMT" + "Tue, 20 Apr 2021 11:33:00 GMT" ], "Content-Length": [ - "740" + "1083" ], "Content-Type": [ "application/json; charset=utf-8" @@ -75,12 +75,12 @@ "-1" ] }, - "ResponseBody": "{\r\n \"totalRecords\": 2,\r\n \"count\": 2,\r\n \"data\": [\r\n {\r\n \"id\": \"/subscriptions/eaab1166-1e13-4370-a951-6ed345a48c15/resourceGroups/lakshmia-test/providers/Providers.Test/statefulResources/0JH-JSRBLS\",\r\n \"tags\": {\r\n \"makharchsdktest\": \"makharchsdk\"\r\n },\r\n \"properties\": {\r\n \"prop1\": \"val1\",\r\n \"prop2\": {\r\n \"prop2.key1\": \"val2\"\r\n }\r\n }\r\n },\r\n {\r\n \"id\": \"/subscriptions/eaab1166-1e13-4370-a951-6ed345a48c15/resourceGroups/zarttestrgDelete200/providers/Microsoft.DataFactory/factories/zarttest201904260844a356\",\r\n \"tags\": {},\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n \"createTime\": \"2019-04-26T08:45:33.127Z\",\r\n \"version\": \"2018-06-01\",\r\n \"factoryStatistics\": {\r\n \"totalResourceCount\": 0,\r\n \"maxAllowedResourceCount\": 0,\r\n \"factorySizeInGbUnits\": 0,\r\n \"maxAllowedFactorySizeInGbUnits\": 0\r\n }\r\n }\r\n }\r\n ],\r\n \"facets\": [],\r\n \"resultTruncated\": \"false\"\r\n}", + "ResponseBody": "{\r\n \"totalRecords\": 2,\r\n \"count\": 2,\r\n \"data\": [\r\n {\r\n \"id\": \"/subscriptions/82506e98-9fdb-41f5-ab67-031005041a26/resourceGroups/AzureResourcesTopologyDfStorage/providers/Microsoft.ServiceBus/namespaces/twofsnservicebusdf\",\r\n \"tags\": {},\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n \"status\": \"Active\",\r\n \"zoneRedundant\": true,\r\n \"serviceBusEndpoint\": \"https://twofsnservicebusdf.servicebus.windows.net:443/\",\r\n \"createdAt\": \"2021-03-12T21:20:01.667Z\",\r\n \"updatedAt\": \"2021-04-20T10:55:34.69Z\",\r\n \"metricId\": \"82506e98-9fdb-41f5-ab67-031005041a26:twofsnservicebusdf\"\r\n }\r\n },\r\n {\r\n \"id\": \"/subscriptions/82506e98-9fdb-41f5-ab67-031005041a26/resourceGroups/AzureResourcesTopologyDfStorage/providers/Microsoft.ServiceBus/namespaces/threemponeservicebusdf\",\r\n \"tags\": {},\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n \"status\": \"Active\",\r\n \"zoneRedundant\": true,\r\n \"serviceBusEndpoint\": \"https://threemponeservicebusdf.servicebus.windows.net:443/\",\r\n \"createdAt\": \"2020-12-23T02:50:43.14Z\",\r\n \"updatedAt\": \"2021-04-20T06:32:36.617Z\",\r\n \"metricId\": \"82506e98-9fdb-41f5-ab67-031005041a26:threemponeservicebusdf\"\r\n }\r\n }\r\n ],\r\n \"facets\": [],\r\n \"resultTruncated\": \"false\"\r\n}", "StatusCode": 200 } ], "Names": {}, "Variables": { - "SubscriptionId": "eaab1166-1e13-4370-a951-6ed345a48c15" + "SubscriptionId": "82506e98-9fdb-41f5-ab67-031005041a26" } } \ No newline at end of file diff --git a/src/ResourceGraph/ResourceGraph.Test/SessionRecords/Microsoft.Azure.Commands.ResourceGraph.Test.ScenarioTests.ResourceGraphQueryTests/QueryError.json b/src/ResourceGraph/ResourceGraph.Test/SessionRecords/Microsoft.Azure.Commands.ResourceGraph.Test.ScenarioTests.ResourceGraphQueryTests/QueryError.json index 233b755ef239..0b85c397b6d7 100644 --- a/src/ResourceGraph/ResourceGraph.Test/SessionRecords/Microsoft.Azure.Commands.ResourceGraph.Test.ScenarioTests.ResourceGraphQueryTests/QueryError.json +++ b/src/ResourceGraph/ResourceGraph.Test/SessionRecords/Microsoft.Azure.Commands.ResourceGraph.Test.ScenarioTests.ResourceGraphQueryTests/QueryError.json @@ -4,16 +4,16 @@ "RequestUri": "/providers/Microsoft.ResourceGraph/resources?api-version=2021-03-01", "EncodedRequestUri": "L3Byb3ZpZGVycy9NaWNyb3NvZnQuUmVzb3VyY2VHcmFwaC9yZXNvdXJjZXM/YXBpLXZlcnNpb249MjAyMS0wMy0wMQ==", "RequestMethod": "POST", - "RequestBody": "{\r\n \"query\": \"where where\",\r\n \"options\": {\r\n \"$top\": 100,\r\n \"$skip\": 0,\r\n \"resultFormat\": \"objectArray\",\r\n \"allowPartialScopes\": false\r\n }\r\n}", + "RequestBody": "{\r\n \"subscriptions\": [\r\n \"82506e98-9fdb-41f5-ab67-031005041a26\"\r\n ],\r\n \"query\": \"where where\",\r\n \"options\": {\r\n \"$top\": 100,\r\n \"$skip\": 0,\r\n \"resultFormat\": \"objectArray\",\r\n \"allowPartialScopes\": false\r\n }\r\n}", "RequestHeaders": { "x-ms-client-request-id": [ - "ec427211-392d-42f3-bfa2-1a953ff4c4e1" + "094db9b4-1c57-4864-aceb-45d14a21b21d" ], "Accept-Language": [ "en-US" ], "User-Agent": [ - "FxVersion/4.6.29812.02", + "FxVersion/4.6.29916.01", "OSName/Windows", "OSVersion/Microsoft.Windows.10.0.19042.", "Microsoft.Azure.Management.ResourceGraph.ResourceGraphClient/2.1.0.0" @@ -22,7 +22,7 @@ "application/json; charset=utf-8" ], "Content-Length": [ - "156" + "228" ] }, "ResponseHeaders": { @@ -36,10 +36,10 @@ "max-age=31536000; includeSubDomains" ], "x-ms-ratelimit-remaining-tenant-resource-requests": [ - "12" + "13" ], "x-ms-user-quota-remaining": [ - "12" + "13" ], "x-ms-user-quota-resets-after": [ "00:00:05" @@ -48,22 +48,22 @@ "Kestrel" ], "x-ms-ratelimit-remaining-tenant-reads": [ - "14997" + "11999" ], "x-ms-request-id": [ - "30ce3d66-fd76-408f-9f26-2022e931c3d5" + "10bb6673-0db9-4d4e-ba67-0360354f6422" ], "x-ms-correlation-request-id": [ - "30ce3d66-fd76-408f-9f26-2022e931c3d5" + "10bb6673-0db9-4d4e-ba67-0360354f6422" ], "x-ms-routing-request-id": [ - "NORTHEUROPE:20210325T114512Z:30ce3d66-fd76-408f-9f26-2022e931c3d5" + "WESTUS:20210420T113225Z:10bb6673-0db9-4d4e-ba67-0360354f6422" ], "X-Content-Type-Options": [ "nosniff" ], "Date": [ - "Thu, 25 Mar 2021 11:45:12 GMT" + "Tue, 20 Apr 2021 11:32:24 GMT" ], "Content-Length": [ "488" @@ -75,12 +75,12 @@ "-1" ] }, - "ResponseBody": "{\r\n \"error\": {\r\n \"code\": \"BadRequest\",\r\n \"message\": \"Please provide below info when asking for support: timestamp = 2021-03-25T11:45:12.9331797Z, correlationId = 30ce3d66-fd76-408f-9f26-2022e931c3d5.\",\r\n \"details\": [\r\n {\r\n \"code\": \"InvalidQuery\",\r\n \"message\": \"Query is invalid. Please refer to the documentation for the Azure Resource Graph service and fix the error before retrying.\"\r\n },\r\n {\r\n \"code\": \"ParserFailure\",\r\n \"message\": \"ParserFailure\",\r\n \"line\": 1,\r\n \"characterPositionInLine\": 11,\r\n \"token\": \"\",\r\n \"expectedToken\": \"Ǐ\"\r\n }\r\n ]\r\n }\r\n}", + "ResponseBody": "{\r\n \"error\": {\r\n \"code\": \"BadRequest\",\r\n \"message\": \"Please provide below info when asking for support: timestamp = 2021-04-20T11:32:25.4089191Z, correlationId = 10bb6673-0db9-4d4e-ba67-0360354f6422.\",\r\n \"details\": [\r\n {\r\n \"code\": \"InvalidQuery\",\r\n \"message\": \"Query is invalid. Please refer to the documentation for the Azure Resource Graph service and fix the error before retrying.\"\r\n },\r\n {\r\n \"code\": \"ParserFailure\",\r\n \"message\": \"ParserFailure\",\r\n \"line\": 1,\r\n \"characterPositionInLine\": 11,\r\n \"token\": \"\",\r\n \"expectedToken\": \"Ǐ\"\r\n }\r\n ]\r\n }\r\n}", "StatusCode": 400 } ], "Names": {}, "Variables": { - "SubscriptionId": "eaab1166-1e13-4370-a951-6ed345a48c15" + "SubscriptionId": "82506e98-9fdb-41f5-ab67-031005041a26" } } \ No newline at end of file diff --git a/src/ResourceGraph/ResourceGraph.Test/SessionRecords/Microsoft.Azure.Commands.ResourceGraph.Test.ScenarioTests.ResourceGraphQueryTests/SkipTokenQuery.json b/src/ResourceGraph/ResourceGraph.Test/SessionRecords/Microsoft.Azure.Commands.ResourceGraph.Test.ScenarioTests.ResourceGraphQueryTests/SkipTokenQuery.json index 50abf6b0bef3..ea4e1ea6f77a 100644 --- a/src/ResourceGraph/ResourceGraph.Test/SessionRecords/Microsoft.Azure.Commands.ResourceGraph.Test.ScenarioTests.ResourceGraphQueryTests/SkipTokenQuery.json +++ b/src/ResourceGraph/ResourceGraph.Test/SessionRecords/Microsoft.Azure.Commands.ResourceGraph.Test.ScenarioTests.ResourceGraphQueryTests/SkipTokenQuery.json @@ -4,16 +4,16 @@ "RequestUri": "/providers/Microsoft.ResourceGraph/resources?api-version=2021-03-01", "EncodedRequestUri": "L3Byb3ZpZGVycy9NaWNyb3NvZnQuUmVzb3VyY2VHcmFwaC9yZXNvdXJjZXM/YXBpLXZlcnNpb249MjAyMS0wMy0wMQ==", "RequestMethod": "POST", - "RequestBody": "{\r\n \"query\": \"project id, properties\",\r\n \"options\": {\r\n \"$skipToken\": \"ew0KICAiJGlkIjogIjEiLA0KICAiTWF4Um93cyI6IDMsDQogICJSb3dzVG9Ta2lwIjogNiwNCiAgIkt1c3RvQ2x1c3RlclVybCI6ICJodHRwczovL2FybXRvcG9sb2d5Lmt1c3RvLndpbmRvd3MubmV0Ig0KfQ==\",\r\n \"resultFormat\": \"objectArray\",\r\n \"allowPartialScopes\": false\r\n }\r\n}", + "RequestBody": "{\r\n \"subscriptions\": [\r\n \"82506e98-9fdb-41f5-ab67-031005041a26\"\r\n ],\r\n \"query\": \"project id, properties\",\r\n \"options\": {\r\n \"$skipToken\": \"ew0KICAiJGlkIjogIjEiLA0KICAiTWF4Um93cyI6IDMsDQogICJSb3dzVG9Ta2lwIjogMywNCiAgIkt1c3RvQ2x1c3RlclVybCI6ICJodHRwczovL2FyZy1ldXMtc2l4LXNmLmFyZy5jb3JlLndpbmRvd3MubmV0Ig0KfQ==\",\r\n \"resultFormat\": \"objectArray\",\r\n \"allowPartialScopes\": false\r\n }\r\n}", "RequestHeaders": { "x-ms-client-request-id": [ - "a8ed2766-e017-42b6-b708-2e9f85cf4d24" + "2d9c6d18-ec18-4fb7-b1f1-32792ce06217" ], "Accept-Language": [ "en-US" ], "User-Agent": [ - "FxVersion/4.6.29812.02", + "FxVersion/4.6.29916.01", "OSName/Windows", "OSVersion/Microsoft.Windows.10.0.19042.", "Microsoft.Azure.Management.ResourceGraph.ResourceGraphClient/2.1.0.0" @@ -22,7 +22,7 @@ "application/json; charset=utf-8" ], "Content-Length": [ - "315" + "395" ] }, "ResponseHeaders": { @@ -48,25 +48,25 @@ "Kestrel" ], "x-ms-ratelimit-remaining-tenant-reads": [ - "14997" + "11999" ], "x-ms-request-id": [ - "f7ddad1b-c1b3-406c-8ce1-5df0d7ea1686" + "1a211d48-ebab-46f8-8947-f2da8e877987" ], "x-ms-correlation-request-id": [ - "f7ddad1b-c1b3-406c-8ce1-5df0d7ea1686" + "1a211d48-ebab-46f8-8947-f2da8e877987" ], "x-ms-routing-request-id": [ - "NORTHEUROPE:20210325T210647Z:f7ddad1b-c1b3-406c-8ce1-5df0d7ea1686" + "WESTUS:20210420T113213Z:1a211d48-ebab-46f8-8947-f2da8e877987" ], "X-Content-Type-Options": [ "nosniff" ], "Date": [ - "Thu, 25 Mar 2021 21:06:47 GMT" + "Tue, 20 Apr 2021 11:32:12 GMT" ], "Content-Length": [ - "966" + "7388" ], "Content-Type": [ "application/json; charset=utf-8" @@ -75,12 +75,12 @@ "-1" ] }, - "ResponseBody": "{\r\n \"totalRecords\": 71,\r\n \"count\": 3,\r\n \"data\": [\r\n {\r\n \"id\": \"/subscriptions/eaab1166-1e13-4370-a951-6ed345a48c15/resourceGroups/lakshmia-test/providers/Providers.Test/statefulResources/0JH-SitaRam\",\r\n \"properties\": {\r\n \"prop1\": \"val1\",\r\n \"prop2\": {\r\n \"prop2.key1\": \"val2\"\r\n }\r\n }\r\n },\r\n {\r\n \"id\": \"/subscriptions/eaab1166-1e13-4370-a951-6ed345a48c15/resourceGroups/lakshmia-test/providers/Providers.Test/statefulResources/0JH-SitaRamP\",\r\n \"properties\": {\r\n \"prop1\": \"val1\",\r\n \"prop2\": {\r\n \"prop2.key1\": \"val2\"\r\n },\r\n \"prop3\": {\r\n \"prop4\": {\r\n \"prop5\": {\r\n \"prop6\": \"prop6Value\"\r\n }\r\n }\r\n }\r\n }\r\n },\r\n {\r\n \"id\": \"/subscriptions/eaab1166-1e13-4370-a951-6ed345a48c15/resourceGroups/lakshmia-test/providers/Providers.Test/statefulResources/0JSR-JH\",\r\n \"properties\": {\r\n \"prop1\": \"val1\",\r\n \"prop2\": {\r\n \"prop2.key1\": \"val2\"\r\n },\r\n \"prop3\": {\r\n \"prop4\": {\r\n \"prop5\": {\r\n \"prop6\": \"prop6Value\"\r\n }\r\n }\r\n }\r\n }\r\n }\r\n ],\r\n \"facets\": [],\r\n \"resultTruncated\": \"false\",\r\n \"$skipToken\": \"ew0KICAiJGlkIjogIjEiLA0KICAiTWF4Um93cyI6IDMsDQogICJSb3dzVG9Ta2lwIjogOSwNCiAgIkt1c3RvQ2x1c3RlclVybCI6ICJodHRwczovL2FybXRvcG9sb2d5Lmt1c3RvLndpbmRvd3MubmV0Ig0KfQ==\"\r\n}", + "ResponseBody": "{\r\n \"totalRecords\": 244,\r\n \"count\": 3,\r\n \"data\": [\r\n {\r\n \"id\": \"/subscriptions/82506e98-9fdb-41f5-ab67-031005041a26/resourceGroups/AzureResourcesCacheNotifications-Df-a/providers/Microsoft.Network/publicIPAddresses/LBIP-gov-art-df-nt-a\",\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n \"idleTimeoutInMinutes\": 4,\r\n \"resourceGuid\": \"9c7b1246-f23f-4838-a60b-ba15712d3109\",\r\n \"publicIPAllocationMethod\": \"Static\",\r\n \"publicIPAddressVersion\": \"IPv4\",\r\n \"ipConfiguration\": {\r\n \"id\": \"/subscriptions/82506e98-9fdb-41f5-ab67-031005041a26/resourceGroups/AzureResourcesCacheNotifications-Df-a/providers/Microsoft.Network/loadBalancers/LB-gov-art-df-nt-a-nt/frontendIPConfigurations/LoadBalancerIPConfig\"\r\n },\r\n \"dnsSettings\": {\r\n \"domainNameLabel\": \"gov-art-df-nt-a\",\r\n \"fqdn\": \"gov-art-df-nt-a.eastus.cloudapp.azure.com\"\r\n },\r\n \"ipAddress\": \"20.42.26.73\",\r\n \"ipTags\": []\r\n }\r\n },\r\n {\r\n \"id\": \"/subscriptions/82506e98-9fdb-41f5-ab67-031005041a26/resourceGroups/AzureResourcesCacheNotifications-Df-a/providers/Microsoft.Network/virtualNetworks/VNet-gov-art-df-nt-a\",\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n \"resourceGuid\": \"d36001e0-93f5-4f6c-b9ee-49d521abbc01\",\r\n \"virtualNetworkPeerings\": [],\r\n \"enableDdosProtection\": false,\r\n \"subnets\": [\r\n {\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n \"ipConfigurations\": [\r\n {\r\n \"id\": \"/subscriptions/82506e98-9fdb-41f5-ab67-031005041a26/resourceGroups/AzureResourcesCacheNotifications-Df-a/providers/Microsoft.Compute/virtualMachineScaleSets/nt/virtualMachines/0/networkInterfaces/NIC-gov-art-df-nt-a/ipConfigurations/NIC-gov-art-df-nt-a\"\r\n },\r\n {\r\n \"id\": \"/subscriptions/82506e98-9fdb-41f5-ab67-031005041a26/resourceGroups/AzureResourcesCacheNotifications-Df-a/providers/Microsoft.Compute/virtualMachineScaleSets/nt/virtualMachines/1/networkInterfaces/NIC-gov-art-df-nt-a/ipConfigurations/NIC-gov-art-df-nt-a\"\r\n },\r\n {\r\n \"id\": \"/subscriptions/82506e98-9fdb-41f5-ab67-031005041a26/resourceGroups/AzureResourcesCacheNotifications-Df-a/providers/Microsoft.Compute/virtualMachineScaleSets/nt/virtualMachines/2/networkInterfaces/NIC-gov-art-df-nt-a/ipConfigurations/NIC-gov-art-df-nt-a\"\r\n },\r\n {\r\n \"id\": \"/subscriptions/82506e98-9fdb-41f5-ab67-031005041a26/resourceGroups/AzureResourcesCacheNotifications-Df-a/providers/Microsoft.Compute/virtualMachineScaleSets/nt/virtualMachines/3/networkInterfaces/NIC-gov-art-df-nt-a/ipConfigurations/NIC-gov-art-df-nt-a\"\r\n },\r\n {\r\n \"id\": \"/subscriptions/82506e98-9fdb-41f5-ab67-031005041a26/resourceGroups/AzureResourcesCacheNotifications-Df-a/providers/Microsoft.Compute/virtualMachineScaleSets/nt/virtualMachines/4/networkInterfaces/NIC-gov-art-df-nt-a/ipConfigurations/NIC-gov-art-df-nt-a\"\r\n }\r\n ],\r\n \"privateLinkServiceNetworkPolicies\": \"Enabled\",\r\n \"privateEndpointNetworkPolicies\": \"Enabled\",\r\n \"addressPrefix\": \"10.0.0.0/24\",\r\n \"networkSecurityGroup\": {\r\n \"id\": \"/subscriptions/82506e98-9fdb-41f5-ab67-031005041a26/resourceGroups/AzureResourcesCacheNotifications-Df-a/providers/Microsoft.Network/networkSecurityGroups/nsgSubnet-0\"\r\n },\r\n \"delegations\": [],\r\n \"serviceEndpoints\": [\r\n {\r\n \"provisioningState\": \"Succeeded\",\r\n \"locations\": [\r\n \"*\"\r\n ],\r\n \"service\": \"Microsoft.AzureCosmosDB\"\r\n },\r\n {\r\n \"provisioningState\": \"Succeeded\",\r\n \"locations\": [\r\n \"*\"\r\n ],\r\n \"service\": \"Microsoft.KeyVault\"\r\n },\r\n {\r\n \"provisioningState\": \"Succeeded\",\r\n \"locations\": [\r\n \"eastus\",\r\n \"westus\"\r\n ],\r\n \"service\": \"Microsoft.Storage\"\r\n },\r\n {\r\n \"provisioningState\": \"Succeeded\",\r\n \"locations\": [\r\n \"*\"\r\n ],\r\n \"service\": \"Microsoft.ServiceBus\"\r\n }\r\n ]\r\n },\r\n \"id\": \"/subscriptions/82506e98-9fdb-41f5-ab67-031005041a26/resourceGroups/AzureResourcesCacheNotifications-Df-a/providers/Microsoft.Network/virtualNetworks/VNet-gov-art-df-nt-a/subnets/Subnet\",\r\n \"name\": \"Subnet\",\r\n \"type\": \"Microsoft.Network/virtualNetworks/subnets\",\r\n \"etag\": \"W/\\\"8f5339fa-e1a8-442a-a671-e2f4d1b871f6\\\"\"\r\n }\r\n ],\r\n \"addressSpace\": {\r\n \"addressPrefixes\": [\r\n \"10.0.0.0/16\"\r\n ]\r\n }\r\n }\r\n },\r\n {\r\n \"id\": \"/subscriptions/82506e98-9fdb-41f5-ab67-031005041a26/resourceGroups/AzureResourcesCacheNotifications-Df-a/providers/Microsoft.ServiceFabric/clusters/gov-art-df-nt-a\",\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n \"clusterEndpoint\": \"https://eastus.servicefabric.azure.com/runtime/clusters/f0157222-1d05-41a8-b1d5-5a7efec95ed8\",\r\n \"diagnosticsStorageAccountConfig\": {\r\n \"storageAccountName\": \"sflogsgovartdfnta\",\r\n \"tableEndpoint\": \"https://sflogsgovartdfnta.table.core.windows.net/\",\r\n \"protectedAccountKeyName2\": \"\",\r\n \"protectedAccountKeyName\": \"StorageAccountKey1\",\r\n \"secondaryAccessKey\": \"\",\r\n \"primaryAccessKey\": \"\",\r\n \"queueEndpoint\": \"https://sflogsgovartdfnta.queue.core.windows.net/\",\r\n \"blobEndpoint\": \"https://sflogsgovartdfnta.blob.core.windows.net/\"\r\n },\r\n \"clientCertificateCommonNames\": [],\r\n \"clientCertificateThumbprints\": [],\r\n \"availableClusterVersions\": [\r\n {\r\n \"environment\": \"Windows\",\r\n \"supportExpiryUtc\": \"2021-07-31T00:00:00Z\",\r\n \"codeVersion\": \"7.1.510.9590\"\r\n },\r\n {\r\n \"environment\": \"Windows\",\r\n \"supportExpiryUtc\": \"2021-11-30T00:00:00Z\",\r\n \"codeVersion\": \"7.2.413.9590\"\r\n },\r\n {\r\n \"environment\": \"Windows\",\r\n \"supportExpiryUtc\": \"2021-11-30T00:00:00Z\",\r\n \"codeVersion\": \"7.2.432.9590\"\r\n },\r\n {\r\n \"environment\": \"Windows\",\r\n \"supportExpiryUtc\": \"2021-11-30T00:00:00Z\",\r\n \"codeVersion\": \"7.2.433.9590\"\r\n },\r\n {\r\n \"environment\": \"Windows\",\r\n \"supportExpiryUtc\": \"2021-11-30T00:00:00Z\",\r\n \"codeVersion\": \"7.2.445.9590\"\r\n },\r\n {\r\n \"environment\": \"Windows\",\r\n \"supportExpiryUtc\": \"2021-11-30T00:00:00Z\",\r\n \"codeVersion\": \"7.2.457.9590\"\r\n },\r\n {\r\n \"environment\": \"Windows\",\r\n \"supportExpiryUtc\": \"2021-11-30T00:00:00Z\",\r\n \"codeVersion\": \"7.2.477.9590\"\r\n },\r\n {\r\n \"environment\": \"Windows\",\r\n \"supportExpiryUtc\": \"9999-12-31T23:59:59.9999999Z\",\r\n \"codeVersion\": \"8.0.514.9590\"\r\n }\r\n ],\r\n \"managementEndpoint\": \"https://arg-df-nt-a.arg-df.core.windows.net:19080\",\r\n \"clusterCodeVersion\": \"8.0.514.9590\",\r\n \"reliabilityLevel\": \"Silver\",\r\n \"certificateCommonNames\": {\r\n \"x509StoreName\": \"My\",\r\n \"commonNames\": [\r\n {\r\n \"certificateCommonName\": \"gov-art-df-nt-a.eastus.cloudapp.azure.com\",\r\n \"certificateIssuerThumbprint\": \"1b45ec255e0668375043ed5fe78a09ff1655844d,d7fe717b5ff3593764f4d90654d86e8362ec26c8,3ac7c3cac8de0dd392c02789c8be97474f456960,96ea05926e2e42cc207e358668be2c316857fb5e,38b8c60edafdf2a6c50bf5ee00279c788b6fa3b1,552ad1ecd94323d64de4670a55a57d2442b021b1,41bebdcf792c2c890749bf7ac802e33f518cf575,3486b1880c3b6b677f02ee782a7ee66217efc03b\"\r\n },\r\n {\r\n \"certificateCommonName\": \"arg-df-nt-a.arg-df.core.windows.net\",\r\n \"certificateIssuerThumbprint\": \"1b45ec255e0668375043ed5fe78a09ff1655844d,d7fe717b5ff3593764f4d90654d86e8362ec26c8,3ac7c3cac8de0dd392c02789c8be97474f456960,96ea05926e2e42cc207e358668be2c316857fb5e,38b8c60edafdf2a6c50bf5ee00279c788b6fa3b1,552ad1ecd94323d64de4670a55a57d2442b021b1,41bebdcf792c2c890749bf7ac802e33f518cf575,3486b1880c3b6b677f02ee782a7ee66217efc03b\"\r\n }\r\n ]\r\n },\r\n \"clusterState\": \"Ready\",\r\n \"azureActiveDirectory\": {\r\n \"tenantId\": \"72f988bf-86f1-41af-91ab-2d7cd011db47\",\r\n \"clusterApplication\": \"c440fe38-5870-4510-9fbd-ae72edb3192e\",\r\n \"clientApplication\": \"7e72ceff-fc78-4ad8-9548-f5ed079b5844\"\r\n },\r\n \"fabricSettings\": [\r\n {\r\n \"name\": \"Security\",\r\n \"parameters\": [\r\n {\r\n \"name\": \"ClusterProtectionLevel\",\r\n \"value\": \"EncryptAndSign\"\r\n }\r\n ]\r\n },\r\n {\r\n \"name\": \"ClusterManager\",\r\n \"parameters\": [\r\n {\r\n \"name\": \"EnableDefaultServicesUpgrade\",\r\n \"value\": \"true\"\r\n }\r\n ]\r\n }\r\n ],\r\n \"addonFeatures\": [],\r\n \"clusterId\": \"f0157222-1d05-41a8-b1d5-5a7efec95ed8\",\r\n \"upgradeMode\": \"Automatic\",\r\n \"nodeTypes\": [\r\n {\r\n \"name\": \"nt\",\r\n \"durabilityLevel\": \"Silver\",\r\n \"clientConnectionEndpointPort\": 19000,\r\n \"httpGatewayEndpointPort\": 19080,\r\n \"applicationPorts\": {\r\n \"startPort\": 20000,\r\n \"endPort\": 30000\r\n },\r\n \"vmInstanceCount\": 5,\r\n \"ephemeralPorts\": {\r\n \"startPort\": 49152,\r\n \"endPort\": 65534\r\n },\r\n \"isPrimary\": true\r\n }\r\n ],\r\n \"vmImage\": \"Windows\",\r\n \"eventStoreServiceEnabled\": true\r\n }\r\n }\r\n ],\r\n \"facets\": [],\r\n \"resultTruncated\": \"false\",\r\n \"$skipToken\": \"ew0KICAiJGlkIjogIjEiLA0KICAiTWF4Um93cyI6IDMsDQogICJSb3dzVG9Ta2lwIjogNiwNCiAgIkt1c3RvQ2x1c3RlclVybCI6ICJodHRwczovL2FyZy1ldXMtc2l4LXNmLmFyZy5jb3JlLndpbmRvd3MubmV0Ig0KfQ==\"\r\n}", "StatusCode": 200 } ], "Names": {}, "Variables": { - "SubscriptionId": "eaab1166-1e13-4370-a951-6ed345a48c15" + "SubscriptionId": "82506e98-9fdb-41f5-ab67-031005041a26" } } \ No newline at end of file diff --git a/src/ResourceGraph/ResourceGraph.Test/SessionRecords/Microsoft.Azure.Commands.ResourceGraph.Test.ScenarioTests.ResourceGraphQueryTests/Subscriptions.json b/src/ResourceGraph/ResourceGraph.Test/SessionRecords/Microsoft.Azure.Commands.ResourceGraph.Test.ScenarioTests.ResourceGraphQueryTests/Subscriptions.json index 687c56a15e81..1e14b1bc49bd 100644 --- a/src/ResourceGraph/ResourceGraph.Test/SessionRecords/Microsoft.Azure.Commands.ResourceGraph.Test.ScenarioTests.ResourceGraphQueryTests/Subscriptions.json +++ b/src/ResourceGraph/ResourceGraph.Test/SessionRecords/Microsoft.Azure.Commands.ResourceGraph.Test.ScenarioTests.ResourceGraphQueryTests/Subscriptions.json @@ -4,16 +4,16 @@ "RequestUri": "/providers/Microsoft.ResourceGraph/resources?api-version=2021-03-01", "EncodedRequestUri": "L3Byb3ZpZGVycy9NaWNyb3NvZnQuUmVzb3VyY2VHcmFwaC9yZXNvdXJjZXM/YXBpLXZlcnNpb249MjAyMS0wMy0wMQ==", "RequestMethod": "POST", - "RequestBody": "{\r\n \"query\": \"distinct subscriptionId | order by subscriptionId asc\",\r\n \"options\": {\r\n \"$top\": 100,\r\n \"$skip\": 0,\r\n \"resultFormat\": \"objectArray\",\r\n \"allowPartialScopes\": false\r\n }\r\n}", + "RequestBody": "{\r\n \"subscriptions\": [\r\n \"82506e98-9fdb-41f5-ab67-031005041a26\"\r\n ],\r\n \"query\": \"distinct subscriptionId | order by subscriptionId asc\",\r\n \"options\": {\r\n \"$top\": 100,\r\n \"$skip\": 0,\r\n \"resultFormat\": \"objectArray\",\r\n \"allowPartialScopes\": false\r\n }\r\n}", "RequestHeaders": { "x-ms-client-request-id": [ - "5e32bfb4-c13d-4ef1-887b-b5450c598e17" + "16b4b546-ff0b-4d64-a116-178c8b5a1156" ], "Accept-Language": [ "en-US" ], "User-Agent": [ - "FxVersion/4.6.29812.02", + "FxVersion/4.6.29916.01", "OSName/Windows", "OSVersion/Microsoft.Windows.10.0.19042.", "Microsoft.Azure.Management.ResourceGraph.ResourceGraphClient/2.1.0.0" @@ -22,7 +22,7 @@ "application/json; charset=utf-8" ], "Content-Length": [ - "198" + "270" ] }, "ResponseHeaders": { @@ -36,10 +36,10 @@ "max-age=31536000; includeSubDomains" ], "x-ms-ratelimit-remaining-tenant-resource-requests": [ - "12" + "14" ], "x-ms-user-quota-remaining": [ - "12" + "14" ], "x-ms-user-quota-resets-after": [ "00:00:05" @@ -48,22 +48,22 @@ "Kestrel" ], "x-ms-ratelimit-remaining-tenant-reads": [ - "14995" + "11998" ], "x-ms-request-id": [ - "1cb6e6a5-1223-4479-ad7c-b44b06d92557" + "1a16c9fb-d105-41b5-85ff-e5ad9a16eba3" ], "x-ms-correlation-request-id": [ - "1cb6e6a5-1223-4479-ad7c-b44b06d92557" + "1a16c9fb-d105-41b5-85ff-e5ad9a16eba3" ], "x-ms-routing-request-id": [ - "NORTHEUROPE:20210325T114518Z:1cb6e6a5-1223-4479-ad7c-b44b06d92557" + "WESTUS:20210420T113545Z:1a16c9fb-d105-41b5-85ff-e5ad9a16eba3" ], "X-Content-Type-Options": [ "nosniff" ], "Date": [ - "Thu, 25 Mar 2021 11:45:18 GMT" + "Tue, 20 Apr 2021 11:35:44 GMT" ], "Content-Length": [ "133" @@ -75,23 +75,23 @@ "-1" ] }, - "ResponseBody": "{\r\n \"totalRecords\": 1,\r\n \"count\": 1,\r\n \"data\": [\r\n {\r\n \"subscriptionId\": \"eaab1166-1e13-4370-a951-6ed345a48c15\"\r\n }\r\n ],\r\n \"facets\": [],\r\n \"resultTruncated\": \"false\"\r\n}", + "ResponseBody": "{\r\n \"totalRecords\": 1,\r\n \"count\": 1,\r\n \"data\": [\r\n {\r\n \"subscriptionId\": \"82506e98-9fdb-41f5-ab67-031005041a26\"\r\n }\r\n ],\r\n \"facets\": [],\r\n \"resultTruncated\": \"false\"\r\n}", "StatusCode": 200 }, { "RequestUri": "/providers/Microsoft.ResourceGraph/resources?api-version=2021-03-01", "EncodedRequestUri": "L3Byb3ZpZGVycy9NaWNyb3NvZnQuUmVzb3VyY2VHcmFwaC9yZXNvdXJjZXM/YXBpLXZlcnNpb249MjAyMS0wMy0wMQ==", "RequestMethod": "POST", - "RequestBody": "{\r\n \"subscriptions\": [\r\n \"eaab1166-1e13-4370-a951-6ed345a48c15\"\r\n ],\r\n \"query\": \"distinct subscriptionId | order by subscriptionId asc\",\r\n \"options\": {\r\n \"$top\": 100,\r\n \"$skip\": 0,\r\n \"resultFormat\": \"objectArray\",\r\n \"allowPartialScopes\": false\r\n }\r\n}", + "RequestBody": "{\r\n \"subscriptions\": [\r\n \"82506e98-9fdb-41f5-ab67-031005041a26\"\r\n ],\r\n \"query\": \"distinct subscriptionId | order by subscriptionId asc\",\r\n \"options\": {\r\n \"$top\": 100,\r\n \"$skip\": 0,\r\n \"resultFormat\": \"objectArray\",\r\n \"allowPartialScopes\": false\r\n }\r\n}", "RequestHeaders": { "x-ms-client-request-id": [ - "94c0694c-30b4-4f07-845a-82c0e31df523" + "56e2730b-025a-4cc2-b199-3cd9f6bbb78b" ], "Accept-Language": [ "en-US" ], "User-Agent": [ - "FxVersion/4.6.29812.02", + "FxVersion/4.6.29916.01", "OSName/Windows", "OSVersion/Microsoft.Windows.10.0.19042.", "Microsoft.Azure.Management.ResourceGraph.ResourceGraphClient/2.1.0.0" @@ -114,10 +114,10 @@ "max-age=31536000; includeSubDomains" ], "x-ms-ratelimit-remaining-tenant-resource-requests": [ - "11" + "13" ], "x-ms-user-quota-remaining": [ - "11" + "13" ], "x-ms-user-quota-resets-after": [ "00:00:05" @@ -126,22 +126,22 @@ "Kestrel" ], "x-ms-ratelimit-remaining-tenant-reads": [ - "14994" + "11997" ], "x-ms-request-id": [ - "951f99da-3255-4932-88e2-ae450020f934" + "63717316-38e3-4f67-8c60-40938714df16" ], "x-ms-correlation-request-id": [ - "951f99da-3255-4932-88e2-ae450020f934" + "63717316-38e3-4f67-8c60-40938714df16" ], "x-ms-routing-request-id": [ - "NORTHEUROPE:20210325T114518Z:951f99da-3255-4932-88e2-ae450020f934" + "WESTUS:20210420T113545Z:63717316-38e3-4f67-8c60-40938714df16" ], "X-Content-Type-Options": [ "nosniff" ], "Date": [ - "Thu, 25 Mar 2021 11:45:18 GMT" + "Tue, 20 Apr 2021 11:35:44 GMT" ], "Content-Length": [ "133" @@ -153,23 +153,23 @@ "-1" ] }, - "ResponseBody": "{\r\n \"totalRecords\": 1,\r\n \"count\": 1,\r\n \"data\": [\r\n {\r\n \"subscriptionId\": \"eaab1166-1e13-4370-a951-6ed345a48c15\"\r\n }\r\n ],\r\n \"facets\": [],\r\n \"resultTruncated\": \"false\"\r\n}", + "ResponseBody": "{\r\n \"totalRecords\": 1,\r\n \"count\": 1,\r\n \"data\": [\r\n {\r\n \"subscriptionId\": \"82506e98-9fdb-41f5-ab67-031005041a26\"\r\n }\r\n ],\r\n \"facets\": [],\r\n \"resultTruncated\": \"false\"\r\n}", "StatusCode": 200 }, { "RequestUri": "/providers/Microsoft.ResourceGraph/resources?api-version=2021-03-01", "EncodedRequestUri": "L3Byb3ZpZGVycy9NaWNyb3NvZnQuUmVzb3VyY2VHcmFwaC9yZXNvdXJjZXM/YXBpLXZlcnNpb249MjAyMS0wMy0wMQ==", "RequestMethod": "POST", - "RequestBody": "{\r\n \"subscriptions\": [\r\n \"eaab1166-1e13-4370-a951-6ed345a48c15\",\r\n \"000b1166-1e13-4370-a951-6ed345a48c16\"\r\n ],\r\n \"query\": \"distinct subscriptionId | order by subscriptionId asc\",\r\n \"options\": {\r\n \"$top\": 100,\r\n \"$skip\": 0,\r\n \"resultFormat\": \"objectArray\",\r\n \"allowPartialScopes\": false\r\n }\r\n}", + "RequestBody": "{\r\n \"subscriptions\": [\r\n \"82506e98-9fdb-41f5-ab67-031005041a26\",\r\n \"000b1166-1e13-4370-a951-6ed345a48c16\"\r\n ],\r\n \"query\": \"distinct subscriptionId | order by subscriptionId asc\",\r\n \"options\": {\r\n \"$top\": 100,\r\n \"$skip\": 0,\r\n \"resultFormat\": \"objectArray\",\r\n \"allowPartialScopes\": false\r\n }\r\n}", "RequestHeaders": { "x-ms-client-request-id": [ - "6301ba41-87e9-4f01-9d85-7cdb7e395ed9" + "d237888d-0950-4b15-ba9f-35abbd395743" ], "Accept-Language": [ "en-US" ], "User-Agent": [ - "FxVersion/4.6.29812.02", + "FxVersion/4.6.29916.01", "OSName/Windows", "OSVersion/Microsoft.Windows.10.0.19042.", "Microsoft.Azure.Management.ResourceGraph.ResourceGraphClient/2.1.0.0" @@ -192,10 +192,10 @@ "max-age=31536000; includeSubDomains" ], "x-ms-ratelimit-remaining-tenant-resource-requests": [ - "9" + "12" ], "x-ms-user-quota-remaining": [ - "9" + "12" ], "x-ms-user-quota-resets-after": [ "00:00:05" @@ -204,22 +204,22 @@ "Kestrel" ], "x-ms-ratelimit-remaining-tenant-reads": [ - "14993" + "11996" ], "x-ms-request-id": [ - "93c17461-535e-4c08-b8d1-04586412c499" + "849554bf-aabd-441d-9bbe-b79445740b4e" ], "x-ms-correlation-request-id": [ - "93c17461-535e-4c08-b8d1-04586412c499" + "849554bf-aabd-441d-9bbe-b79445740b4e" ], "x-ms-routing-request-id": [ - "NORTHEUROPE:20210325T114518Z:93c17461-535e-4c08-b8d1-04586412c499" + "WESTUS:20210420T113545Z:849554bf-aabd-441d-9bbe-b79445740b4e" ], "X-Content-Type-Options": [ "nosniff" ], "Date": [ - "Thu, 25 Mar 2021 11:45:18 GMT" + "Tue, 20 Apr 2021 11:35:45 GMT" ], "Content-Length": [ "133" @@ -231,12 +231,12 @@ "-1" ] }, - "ResponseBody": "{\r\n \"totalRecords\": 1,\r\n \"count\": 1,\r\n \"data\": [\r\n {\r\n \"subscriptionId\": \"eaab1166-1e13-4370-a951-6ed345a48c15\"\r\n }\r\n ],\r\n \"facets\": [],\r\n \"resultTruncated\": \"false\"\r\n}", + "ResponseBody": "{\r\n \"totalRecords\": 1,\r\n \"count\": 1,\r\n \"data\": [\r\n {\r\n \"subscriptionId\": \"82506e98-9fdb-41f5-ab67-031005041a26\"\r\n }\r\n ],\r\n \"facets\": [],\r\n \"resultTruncated\": \"false\"\r\n}", "StatusCode": 200 } ], "Names": {}, "Variables": { - "SubscriptionId": "eaab1166-1e13-4370-a951-6ed345a48c15" + "SubscriptionId": "82506e98-9fdb-41f5-ab67-031005041a26" } } \ No newline at end of file diff --git a/src/ResourceGraph/ResourceGraph/Cmdlets/SearchAzureRmGraph.cs b/src/ResourceGraph/ResourceGraph/Cmdlets/SearchAzureRmGraph.cs index 403e63f69903..674d722d56da 100644 --- a/src/ResourceGraph/ResourceGraph/Cmdlets/SearchAzureRmGraph.cs +++ b/src/ResourceGraph/ResourceGraph/Cmdlets/SearchAzureRmGraph.cs @@ -15,6 +15,7 @@ namespace Microsoft.Azure.Commands.ResourceGraph.Cmdlets { using Microsoft.Azure.Commands.Common.Authentication.Abstractions; + using Microsoft.Azure.Commands.ResourceGraph.Models; using Microsoft.Azure.Commands.ResourceGraph.Utilities; using Microsoft.Azure.Management.ResourceGraph.Models; using System; @@ -26,7 +27,7 @@ namespace Microsoft.Azure.Commands.ResourceGraph.Cmdlets /// Search-AzGraph cmdlet /// /// - [Cmdlet(VerbsCommon.Search, ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "Graph", DefaultParameterSetName = "SubscriptionScopedQuery"), OutputType(typeof(PSObject))] + [Cmdlet(VerbsCommon.Search, ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "Graph", DefaultParameterSetName = "SubscriptionScopedQuery"), OutputType(typeof(PSResourceGraphResponse))] public class SearchAzureRmGraph : ResourceGraphBaseCmdlet { /// @@ -159,7 +160,7 @@ public override void ExecuteCmdlet() } } - var results = new List(); + var psResourceGraphResponse = new PSResourceGraphResponse(); QueryResponse response = null; var resultTruncated = false; @@ -209,10 +210,11 @@ public override void ExecuteCmdlet() } var requestResults = response.Data.ToPsObjects(); - results.AddRange(requestResults); + psResourceGraphResponse.Data = requestResults; + psResourceGraphResponse.SkipToken = response.SkipToken; this.WriteVerbose($"Received results: {requestResults.Count}"); - if (resultTruncated && results.Count < first) + if (resultTruncated && psResourceGraphResponse.Data.Count < first) { this.WriteWarning("Unable to paginate the results of the query. " + "Some resources may be missing from the results. " + @@ -245,7 +247,7 @@ public override void ExecuteCmdlet() return; } - this.WriteObject(results, true); + this.WriteObject(psResourceGraphResponse); } /// diff --git a/src/ResourceGraph/ResourceGraph/Models/PSResourceGraphResponse.cs b/src/ResourceGraph/ResourceGraph/Models/PSResourceGraphResponse.cs new file mode 100644 index 000000000000..96e81b15eb35 --- /dev/null +++ b/src/ResourceGraph/ResourceGraph/Models/PSResourceGraphResponse.cs @@ -0,0 +1,30 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +namespace Microsoft.Azure.Commands.ResourceGraph.Models +{ + using System.Collections.Generic; + using System.Management.Automation; + using Microsoft.WindowsAzure.Commands.Common.Attributes; + + public class PSResourceGraphResponse + { + [Ps1Xml(Target = ViewControl.List)] + public string SkipToken { get; set; } + + [Ps1Xml(Target = ViewControl.List)] + public IList Data { get; set; } + + } +} diff --git a/src/ResourceGraph/ResourceGraph/ResourceGraph.format.ps1xml b/src/ResourceGraph/ResourceGraph/ResourceGraph.format.ps1xml index a117267d4956..c37333a6aec6 100644 --- a/src/ResourceGraph/ResourceGraph/ResourceGraph.format.ps1xml +++ b/src/ResourceGraph/ResourceGraph/ResourceGraph.format.ps1xml @@ -1,5 +1,30 @@ + + Microsoft.Azure.Commands.ResourceGraph.Models.PSResourceGraphResponse + + Microsoft.Azure.Commands.ResourceGraph.Models.PSResourceGraphResponse + + + + + + + SkipToken + + + $_.SkipToken -ne $null + + + + + Data + + + + + + diff --git a/src/ResourceGraph/ResourceGraph/help/Search-AzGraph.md b/src/ResourceGraph/ResourceGraph/help/Search-AzGraph.md index 023dbbcf0c84..cd4d771d943f 100644 --- a/src/ResourceGraph/ResourceGraph/help/Search-AzGraph.md +++ b/src/ResourceGraph/ResourceGraph/help/Search-AzGraph.md @@ -229,7 +229,7 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## OUTPUTS -### System.Management.Automation.PSObject +### Microsoft.Azure.Commands.ResourceGraph.Models.PSResourceGraphResponse ## NOTES From 2fa5b44e4b9707b003ba8dbdc2b1baa400f85e9c Mon Sep 17 00:00:00 2001 From: makharch Date: Tue, 20 Apr 2021 04:49:06 -0700 Subject: [PATCH 2/3] updated change log --- src/ResourceGraph/ResourceGraph/ChangeLog.md | 1 + 1 file changed, 1 insertion(+) diff --git a/src/ResourceGraph/ResourceGraph/ChangeLog.md b/src/ResourceGraph/ResourceGraph/ChangeLog.md index 4cd1d1f89004..858c00b591cc 100644 --- a/src/ResourceGraph/ResourceGraph/ChangeLog.md +++ b/src/ResourceGraph/ResourceGraph/ChangeLog.md @@ -18,6 +18,7 @@ - Additional information about change #1 --> ## Upcoming Release +* Output has changed to a PSResourceGraphResponse class. Previous output is now under Data property. ## Version 0.9.0 * Added support for the new api version with the ability to query with management group scopes using -ManagementGroup param. From 8e9b75e36d8300eaf27464dd2edd4c8ef728b228 Mon Sep 17 00:00:00 2001 From: Yabo Hu Date: Sun, 25 Apr 2021 11:01:54 +0800 Subject: [PATCH 3/3] Update src/ResourceGraph/ResourceGraph/ChangeLog.md --- src/ResourceGraph/ResourceGraph/ChangeLog.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ResourceGraph/ResourceGraph/ChangeLog.md b/src/ResourceGraph/ResourceGraph/ChangeLog.md index 858c00b591cc..92b7c4e41191 100644 --- a/src/ResourceGraph/ResourceGraph/ChangeLog.md +++ b/src/ResourceGraph/ResourceGraph/ChangeLog.md @@ -18,7 +18,7 @@ - Additional information about change #1 --> ## Upcoming Release -* Output has changed to a PSResourceGraphResponse class. Previous output is now under Data property. +* Changed output of `Search-AzGraph` to PSResourceGraphResponse which wrapped previous output under Data property. ## Version 0.9.0 * Added support for the new api version with the ability to query with management group scopes using -ManagementGroup param.