diff --git a/src/ResourceGraph/ResourceGraph.Test/ResourceGraph.Test.csproj b/src/ResourceGraph/ResourceGraph.Test/ResourceGraph.Test.csproj
index a25fc06b78d7..1651f84553ac 100644
--- a/src/ResourceGraph/ResourceGraph.Test/ResourceGraph.Test.csproj
+++ b/src/ResourceGraph/ResourceGraph.Test/ResourceGraph.Test.csproj
@@ -11,7 +11,7 @@
-
+
diff --git a/src/ResourceGraph/ResourceGraph.Test/ScenarioTests/Common.ps1 b/src/ResourceGraph/ResourceGraph.Test/ScenarioTests/Common.ps1
index 33303f8f1d78..7699c84d9a46 100644
--- a/src/ResourceGraph/ResourceGraph.Test/ScenarioTests/Common.ps1
+++ b/src/ResourceGraph/ResourceGraph.Test/ScenarioTests/Common.ps1
@@ -29,9 +29,9 @@ Validates an object is instance of a type
#>
function Assert-IsInstance
{
- param([object] $obj, [Type] $type)
+ param([Type] $type, [object] $obj)
- Assert-AreEqual $obj.GetType() $type
+ Assert-AreEqual $type $obj.GetType()
}
<#
@@ -40,8 +40,8 @@ Validates property count of a custom object
#>
function Assert-PropertiesCount
{
- param([PSCustomObject] $obj, [int] $count)
+ param([int] $count, [PSCustomObject] $obj)
$properties = $obj.PSObject.Properties
- Assert-AreEqual $([System.Linq.Enumerable]::ToArray($properties).Count) $count
+ Assert-AreEqual $count $([System.Linq.Enumerable]::ToArray($properties).Count)
}
\ No newline at end of file
diff --git a/src/ResourceGraph/ResourceGraph.Test/ScenarioTests/ResourceGraphQueryTests.cs b/src/ResourceGraph/ResourceGraph.Test/ScenarioTests/ResourceGraphQueryTests.cs
index 3cf394aa22e6..387d38f4a410 100644
--- a/src/ResourceGraph/ResourceGraph.Test/ScenarioTests/ResourceGraphQueryTests.cs
+++ b/src/ResourceGraph/ResourceGraph.Test/ScenarioTests/ResourceGraphQueryTests.cs
@@ -53,12 +53,19 @@ public void Subscriptions()
[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
- public void InlcudeSubscriptionNames()
+ public void ManagementGroups()
{
- TestController.NewInstance.RunPowerShellTest(_logger, "Search-AzureRmGraph-IncludeSubscriptionNames");
+ TestController.NewInstance.RunPowerShellTest(_logger, "Search-AzureRmGraph-ManagementGroups");
}
- [Fact(Skip = "Fails on Linux. Equality assertion fails. Investigation needed.")]
+ [Fact]
+ [Trait(Category.AcceptanceType, Category.CheckIn)]
+ public void SkipTokenQuery()
+ {
+ TestController.NewInstance.RunPowerShellTest(_logger, "Search-AzureRmGraph-SkipTokenQuery");
+ }
+
+ [Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void QueryError()
{
@@ -67,9 +74,9 @@ public void QueryError()
[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
- public void SubscriptionQueryError()
+ public void SubscriptionAndManagementGroupQueryError()
{
- TestController.NewInstance.RunPowerShellTest(_logger, "Search-AzureRmGraph-SubscriptionQueryError");
+ TestController.NewInstance.RunPowerShellTest(_logger, "Search-AzureRmGraph-SubscriptionAndManagementGroupQueryError");
}
}
}
diff --git a/src/ResourceGraph/ResourceGraph.Test/ScenarioTests/ResourceGraphQueryTests.ps1 b/src/ResourceGraph/ResourceGraph.Test/ScenarioTests/ResourceGraphQueryTests.ps1
index 7ed82ed50b65..d63c4bb76df6 100644
--- a/src/ResourceGraph/ResourceGraph.Test/ScenarioTests/ResourceGraphQueryTests.ps1
+++ b/src/ResourceGraph/ResourceGraph.Test/ScenarioTests/ResourceGraphQueryTests.ps1
@@ -20,28 +20,28 @@ function Search-AzureRmGraph-Query
{
$queryResult = Search-AzGraph "project id, tags, properties | limit 2"
- Assert-IsInstance $queryResult Object[]
- Assert-AreEqual $queryResult.Count 2
-
- Assert-IsInstance $queryResult[0] System.Management.Automation.PSCustomObject
- Assert-IsInstance $queryResult[1] System.Management.Automation.PSCustomObject
- Assert-PropertiesCount $queryResult[0] 4
- Assert-PropertiesCount $queryResult[1] 4
-
- Assert-IsInstance $queryResult[0].id String
- Assert-IsInstance $queryResult[1].id String
- Assert-IsInstance $queryResult[0].ResourceId String
- Assert-IsInstance $queryResult[1].ResourceId String
- Assert-IsInstance $queryResult[0].tags System.Management.Automation.PSCustomObject
- Assert-IsInstance $queryResult[1].tags System.Management.Automation.PSCustomObject
- Assert-IsInstance $queryResult[0].properties System.Management.Automation.PSCustomObject
- Assert-IsInstance $queryResult[1].properties System.Management.Automation.PSCustomObject
+ 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
Assert-AreEqual $queryResult[0].id $queryResult[0].ResourceId
Assert-AreEqual $queryResult[1].id $queryResult[1].ResourceId
- Assert-PropertiesCount $queryResult[0].properties 6
- Assert-PropertiesCount $queryResult[1].properties 4
+ Assert-PropertiesCount 2 $queryResult[0].properties
+ Assert-PropertiesCount 4 $queryResult[1].properties
}
<#
@@ -53,24 +53,24 @@ function Search-AzureRmGraph-PagedQuery
# Page size was artificially set to 2 rows
$queryResult = Search-AzGraph "project id" -First 3 -Skip 2
- Assert-IsInstance $queryResult Object[]
- Assert-AreEqual $queryResult.Count 3
+ Assert-IsInstance Object[] $queryResult
+ Assert-AreEqual 3 $queryResult.Count
- Assert-IsInstance $queryResult[0] System.Management.Automation.PSCustomObject
- Assert-IsInstance $queryResult[1] System.Management.Automation.PSCustomObject
- Assert-IsInstance $queryResult[2] System.Management.Automation.PSCustomObject
+ 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-PropertiesCount $queryResult[0] 2
- Assert-PropertiesCount $queryResult[1] 2
- Assert-PropertiesCount $queryResult[2] 2
+ Assert-PropertiesCount 2 $queryResult[0]
+ Assert-PropertiesCount 2 $queryResult[1]
+ Assert-PropertiesCount 2 $queryResult[2]
- Assert-IsInstance $queryResult[0].id String
- Assert-IsInstance $queryResult[1].id String
- Assert-IsInstance $queryResult[2].id String
+ Assert-IsInstance String $queryResult[0].id
+ Assert-IsInstance String $queryResult[1].id
+ Assert-IsInstance String $queryResult[2].id
- Assert-IsInstance $queryResult[0].ResourceId String
- Assert-IsInstance $queryResult[1].ResourceId String
- Assert-IsInstance $queryResult[2].ResourceId String
+ Assert-IsInstance String $queryResult[0].ResourceId
+ Assert-IsInstance String $queryResult[1].ResourceId
+ Assert-IsInstance String $queryResult[2].ResourceId
Assert-True { $queryResult[0].id.Length -gt 0 }
Assert-True { $queryResult[1].id.Length -gt 0 }
@@ -83,45 +83,78 @@ Run query with subscriptions explicitly passed
#>
function Search-AzureRmGraph-Subscriptions
{
- $testSubId1 = "11111111-1111-1111-1111-111111111111"
- $testSubId2 = "22222222-2222-2222-2222-222222222222"
- $mockedSubscriptionId = "00000000-0000-0000-0000-000000000000"
+ $testSubId = "eaab1166-1e13-4370-a951-6ed345a48c15"
+ $nonExsitentTestSubId = "000b1166-1e13-4370-a951-6ed345a48c16"
$query = "distinct subscriptionId | order by subscriptionId asc"
- $queryResultNoSubs = Search-AzGraph $query
- $queryResultOneSub = Search-AzGraph $query -Subscription $testSubId1
- $queryResultMultipleSubs = Search-AzGraph $query -Subscription @($testSubId1, $testSubId2)
+ $queryResultTenant = Search-AzGraph $query
+ $queryResultOneSub = Search-AzGraph $query -Subscription $testSubId
+ $queryResultMultipleSubs = Search-AzGraph $query -Subscription @($testSubId, $nonExsitentTestSubId)
- Assert-IsInstance $queryResultNoSubs System.Management.Automation.PSCustomObject
- Assert-AreEqual $queryResultNoSubs.subscriptionId $mockedSubscriptionId
+ Assert-IsInstance System.Management.Automation.PSCustomObject $queryResultTenant
+ Assert-AreEqual $testSubId $queryResultTenant.subscriptionId
- Assert-IsInstance $queryResultOneSub System.Management.Automation.PSCustomObject
- Assert-AreEqual $queryResultOneSub.subscriptionId $testSubId1
+ Assert-IsInstance System.Management.Automation.PSCustomObject $queryResultOneSub
+ Assert-AreEqual $testSubId $queryResultOneSub.subscriptionId
+
+ Assert-IsInstance System.Management.Automation.PSCustomObject $queryResultMultipleSubs
+ Assert-AreEqual $testSubId $queryResultMultipleSubs.subscriptionId
+}
+
+<#
+.SYNOPSIS
+Run query with management groups explicitly passed
+#>
+function Search-AzureRmGraph-ManagementGroups
+{
+ $testSubId = "eaab1166-1e13-4370-a951-6ed345a48c15"
+ $testMgId1 = "f686d426-8d16-42db-81b7-ab578e110ccd"
+ $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 $queryResultMultipleSubs Object[]
- Assert-AreEqual $queryResultMultipleSubs.Count 2
- Assert-AreEqual $queryResultMultipleSubs[0].subscriptionId $testSubId1
- Assert-AreEqual $queryResultMultipleSubs[1].subscriptionId $testSubId2
+ Assert-IsInstance System.Management.Automation.PSCustomObject $queryResultOneMg
+ Assert-AreEqual $testSubId $queryResultOneMg.subscriptionId
+
+ Assert-IsInstance System.Management.Automation.PSCustomObject $queryResultMultipleMgs
+ Assert-AreEqual $testSubId $queryResultMultipleMgs.subscriptionId
}
<#
.SYNOPSIS
-Run query with subscriptions explicitly passed
+Run simple query with the skip token
#>
-function Search-AzureRmGraph-IncludeSubscriptionNames
+function Search-AzureRmGraph-SkipTokenQuery
{
- $mockedScopeId = "00000000-0000-0000-0000-000000000000"
- $mockedSubscriptionName = "Test Subscription"
- $mockedTenantName = "Test Tenant"
- $query = "project subscriptionId, tenantId, subscriptionDisplayName, tenantDisplayName"
-
- $queryResult = Search-AzGraph $query -Include "DisplayNames"
-
- Assert-IsInstance $queryResult System.Management.Automation.PSCustomObject
- Assert-AreEqual $queryResult.subscriptionId $mockedScopeId
- Assert-AreEqual $queryResult.tenantId $mockedScopeId
- Assert-AreEqual $queryResult.subscriptionDisplayName $mockedSubscriptionName
- Assert-AreEqual $queryResult.tenantDisplayName $mockedTenantName
+ $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
+
+ Assert-AreEqual $queryResult[0].id $queryResult[0].ResourceId
+ Assert-AreEqual $queryResult[1].id $queryResult[1].ResourceId
+ Assert-AreEqual $queryResult[2].id $queryResult[2].ResourceId
}
<#
@@ -130,23 +163,30 @@ Run malformed query
#>
function Search-AzureRmGraph-QueryError
{
- $expectedErrorId = 'InvalidQuery,' + [Microsoft.Azure.Commands.ResourceGraph.Cmdlets.SearchAzureRmGraph].FullName
- $expectedErrorDetails = '{
+ $expectedErrorId = 'BadRequest,' + [Microsoft.Azure.Commands.ResourceGraph.Cmdlets.SearchAzureRmGraph].FullName
+ $expectedErrorDetailsRegex = [regex]::escape('{
"error": {
- "code": "InvalidQuery",
- "message": "Query validation error",
+ "code": "BadRequest",
+ "message": "Please provide below info when asking for support: timestamp = 2021-03-25T') + '.{17}?' + [regex]::escape(', correlationId = ') + '.{36}?' + [regex]::escape('.",
"details": [
+ {
+ "code": "InvalidQuery",
+ "message": "Query is invalid. Please refer to the documentation for the Azure Resource Graph service and fix the error before retrying."
+ },
{
"code": "ParserFailure",
- "message": "Parser failure",
+ "message": "ParserFailure",
"line": 1,
"characterPositionInLine": 11,
"token": "",
- "expectedToken": "Ÿ"
+ "expectedToken": "Ǐ"
}
]
}
-}'
+}')
+
+ $expectedInnerCode = "InvalidQuery"
+ $expectedInnerMessage = "Query is invalid. Please refer to the documentation for the Azure Resource Graph service and fix the error before retrying."
try
{
@@ -155,43 +195,45 @@ function Search-AzureRmGraph-QueryError
}
catch [Exception]
{
- Assert-AreEqual $PSItem.FullyQualifiedErrorId $expectedErrorId
- Assert-AreEqual $PSItem.ErrorDetails.Message $expectedErrorDetails
- Assert-IsInstance $PSItem.Exception Microsoft.Azure.Management.ResourceGraph.Models.ErrorResponseException
- Assert-IsInstance $PSItem.Exception.Body Microsoft.Azure.Management.ResourceGraph.Models.ErrorResponse
+ Assert-AreEqual $expectedErrorId $PSItem.FullyQualifiedErrorId
+ Assert-Match $expectedErrorDetailsRegex $PSItem.ErrorDetails.Message
+ Assert-IsInstance Microsoft.Azure.Management.ResourceGraph.Models.ErrorResponseException $PSItem.Exception
+ Assert-IsInstance Microsoft.Azure.Management.ResourceGraph.Models.ErrorResponse $PSItem.Exception.Body
Assert-NotNull $PSItem.Exception.Body.Error.Code
Assert-NotNull $PSItem.Exception.Body.Error.Message
Assert-NotNull $PSItem.Exception.Body.Error.Details
- Assert-AreEqual $PSItem.Exception.Body.Error.Details.Count 1
+ Assert-AreEqual 2 $PSItem.Exception.Body.Error.Details.Count
+
+ Assert-AreEqual $expectedInnerCode $PSItem.Exception.Body.Error.Details[0].Code
+ Assert-AreEqual $expectedInnerMessage $PSItem.Exception.Body.Error.Details[0].Message
- Assert-NotNull $PSItem.Exception.Body.Error.Details[0].Code
- Assert-NotNull $PSItem.Exception.Body.Error.Details[0].Message
- Assert-NotNull $PSItem.Exception.Body.Error.Details[0].AdditionalProperties
- Assert-AreEqual $PSItem.Exception.Body.Error.Details[0].AdditionalProperties.Count 4
+ Assert-NotNull $PSItem.Exception.Body.Error.Details[1].Code
+ Assert-NotNull $PSItem.Exception.Body.Error.Details[1].Message
+ Assert-NotNull $PSItem.Exception.Body.Error.Details[1].AdditionalProperties
+ Assert-AreEqual 4 $PSItem.Exception.Body.Error.Details[1].AdditionalProperties.Count
}
}
<#
.SYNOPSIS
-Run query with no subscriptions
+Run query with both subscriptions and management groups present
#>
-function Search-AzureRmGraph-SubscriptionQueryError
+function Search-AzureRmGraph-SubscriptionAndManagementGroupQueryError
{
- $expectedErrorId = '400,' + [Microsoft.Azure.Commands.ResourceGraph.Cmdlets.SearchAzureRmGraph].FullName
+ $expectedErrorId = 'AmbiguousParameterSet,' + [Microsoft.Azure.Commands.ResourceGraph.Cmdlets.SearchAzureRmGraph].FullName
$expectedErrorMessage =
- 'No subscriptions were found to run query. Please try to add them implicitly as param to your request (e.g. Search-AzGraph -Query '''' -Subscription ''11111111-1111-1111-1111-111111111111'')'
+ 'Parameter set cannot be resolved using the specified named parameters. One or more parameters issued cannot be used together or an insufficient number of parameters were provided.'
try
{
- Search-AzGraph "project id, type" -Subscription @()
+ Search-AzGraph "project id, type" -Subscription 'a' -ManagementGroup 'b'
Assert-True $false # Expecting an error
}
catch [Exception]
{
- Assert-AreEqual $expectedErrorId $PSItem.FullyQualifiedErrorId
+ Assert-AreEqual $expectedErrorId $PSItem.FullyQualifiedErrorId
Assert-AreEqual $expectedErrorMessage $PSItem.Exception.Message
-
- Assert-IsInstance $PSItem.Exception System.ArgumentException
+ Assert-IsInstance System.Management.Automation.ParameterBindingException $PSItem.Exception
}
-}
+}
\ No newline at end of file
diff --git a/src/ResourceGraph/ResourceGraph.Test/SessionRecords/Microsoft.Azure.Commands.ResourceGraph.Test.ScenarioTests.ResourceGraphQueryTests/InlcudeSubscriptionNames.json b/src/ResourceGraph/ResourceGraph.Test/SessionRecords/Microsoft.Azure.Commands.ResourceGraph.Test.ScenarioTests.ResourceGraphQueryTests/InlcudeSubscriptionNames.json
deleted file mode 100644
index 2d467eea00c4..000000000000
--- a/src/ResourceGraph/ResourceGraph.Test/SessionRecords/Microsoft.Azure.Commands.ResourceGraph.Test.ScenarioTests.ResourceGraphQueryTests/InlcudeSubscriptionNames.json
+++ /dev/null
@@ -1,197 +0,0 @@
-{
- "Entries": [
- {
- "RequestUri": "/subscriptions?api-version=2016-06-01",
- "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnM/YXBpLXZlcnNpb249MjAxNi0wNi0wMQ==",
- "RequestMethod": "GET",
- "RequestBody": "",
- "RequestHeaders": {
- "x-ms-client-request-id": [
- "31537677-7032-4654-becb-372f2eeebf21"
- ],
- "accept-language": [
- "en-US"
- ],
- "User-Agent": [
- "FxVersion/4.7.3163.0",
- "OSName/Windows10Enterprise",
- "OSVersion/6.3.17134",
- "Microsoft.Azure.Internal.Subscriptions.SubscriptionClient/4.1.0"
- ]
- },
- "ResponseBody": "{\"value\": [{\"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000\", \"subscriptionId\": \"00000000-0000-0000-0000-000000000000\", \"displayName\": \"Test Subscription\", \"state\": \"Enabled\", \"authorizationSource\": \"RoleBased\"}]}",
- "ResponseHeaders": {
- "Content-Length": [
- "987"
- ],
- "Content-Type": [
- "application/json; charset=utf-8"
- ],
- "Expires": [
- "-1"
- ],
- "Pragma": [
- "no-cache"
- ],
- "x-ms-ratelimit-remaining-tenant-reads": [
- "11999"
- ],
- "x-ms-request-id": [
- "dc5b4ea5-4059-44fa-9d49-5c48f46224f4"
- ],
- "x-ms-correlation-request-id": [
- "dc5b4ea5-4059-44fa-9d49-5c48f46224f4"
- ],
- "x-ms-routing-request-id": [
- "WESTUS2:20180926T232942Z:dc5b4ea5-4059-44fa-9d49-5c48f46224f4"
- ],
- "Strict-Transport-Security": [
- "max-age=31536000; includeSubDomains"
- ],
- "X-Content-Type-Options": [
- "nosniff"
- ],
- "Cache-Control": [
- "no-cache"
- ],
- "Date": [
- "Wed, 26 Sep 2018 23:29:41 GMT"
- ]
- },
- "StatusCode": 200
- },
- {
- "RequestUri": "/tenants?api-version=2019-05-10",
- "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnM/YXBpLXZlcnNpb249MjAxNi0wNi0wMQ==",
- "RequestMethod": "GET",
- "RequestBody": "",
- "RequestHeaders": {
- "x-ms-client-request-id": [
- "31537677-7032-4654-becb-372f2eeebf21"
- ],
- "accept-language": [
- "en-US"
- ],
- "User-Agent": [
- "FxVersion/4.7.3163.0",
- "OSName/Windows10Enterprise",
- "OSVersion/6.3.17134",
- "Microsoft.Azure.Internal.Subscriptions.SubscriptionClient/4.1.0"
- ]
- },
- "ResponseBody": "{\"value\":[{\"id\":\"/tenants/00000000-0000-0000-0000-000000000000\",\"tenantId\":\"00000000-0000-0000-0000-000000000000\",\"countryCode\":\"US\",\"displayName\":\"Test Tenant\",\"domains\":[]}]}",
- "ResponseHeaders": {
- "Content-Length": [
- "987"
- ],
- "Content-Type": [
- "application/json; charset=utf-8"
- ],
- "Expires": [
- "-1"
- ],
- "Pragma": [
- "no-cache"
- ],
- "x-ms-ratelimit-remaining-tenant-reads": [
- "11999"
- ],
- "x-ms-request-id": [
- "dc5b4ea5-4059-44fa-9d49-5c48f46224f4"
- ],
- "x-ms-correlation-request-id": [
- "dc5b4ea5-4059-44fa-9d49-5c48f46224f4"
- ],
- "x-ms-routing-request-id": [
- "WESTUS2:20180926T232942Z:dc5b4ea5-4059-44fa-9d49-5c48f46224f4"
- ],
- "Strict-Transport-Security": [
- "max-age=31536000; includeSubDomains"
- ],
- "X-Content-Type-Options": [
- "nosniff"
- ],
- "Cache-Control": [
- "no-cache"
- ],
- "Date": [
- "Wed, 26 Sep 2018 23:29:41 GMT"
- ]
- },
- "StatusCode": 200
- },
- {
- "RequestUri": "/providers/Microsoft.ResourceGraph/resources?api-version=2019-04-01",
- "EncodedRequestUri": "L3Byb3ZpZGVycy9NaWNyb3NvZnQuUmVzb3VyY2VHcmFwaC9yZXNvdXJjZXM/YXBpLXZlcnNpb249MjAxOS0wNC0wMQ==",
- "RequestMethod": "POST",
- "RequestBody": "",
- "RequestHeaders": {
- "Content-Type": [
- "application/json; charset=utf-8"
- ],
- "Content-Length": [
- "200"
- ],
- "x-ms-client-request-id": [
- "734561a3-74bf-4762-a941-20d98158229c"
- ],
- "accept-language": [
- "en-US"
- ],
- "User-Agent": [
- "FxVersion/4.7.3163.0",
- "OSName/Windows10Enterprise",
- "OSVersion/6.3.17134",
- "Microsoft.Azure.Management.ResourceGraph.ResourceGraphClient/0.9.0.0"
- ]
- },
- "ResponseBody": "{\"totalRecords\":1,\"count\":1,\"data\":[{\"subscriptionId\":\"00000000-0000-0000-0000-000000000000\",\"tenantId\":\"00000000-0000-0000-0000-000000000000\",\"subscriptionDisplayName\":\"Test Subscription\",\"tenantDisplayName\":\"Test Tenant\"}],\"facets\":[],\"resultTruncated\":\"false\"}",
- "ResponseHeaders": {
- "Content-Length": [
- "179"
- ],
- "Content-Type": [
- "application/json; charset=utf-8"
- ],
- "Expires": [
- "-1"
- ],
- "Pragma": [
- "no-cache"
- ],
- "Strict-Transport-Security": [
- "max-age=31536000; includeSubDomains"
- ],
- "x-ms-ratelimit-remaining-tenant-writes": [
- "1199"
- ],
- "x-ms-request-id": [
- "e475050e-cb2f-4051-945e-0e1aed50d631"
- ],
- "x-ms-correlation-request-id": [
- "e475050e-cb2f-4051-945e-0e1aed50d631"
- ],
- "x-ms-routing-request-id": [
- "WESTUS2:20180913T223146Z:e475050e-cb2f-4051-945e-0e1aed50d631"
- ],
- "X-Content-Type-Options": [
- "nosniff"
- ],
- "Cache-Control": [
- "no-cache"
- ],
- "Date": [
- "Thu, 13 Sep 2018 22:31:46 GMT"
- ],
- "Server": [
- "Microsoft-HTTPAPI/2.0"
- ]
- },
- "StatusCode": 200
- }
- ],
- "Names": {},
- "Variables": {
- "SubscriptionId": "00000000-0000-0000-0000-000000000000"
- }
-}
\ No newline at end of file
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
new file mode 100644
index 000000000000..cab636ad715e
--- /dev/null
+++ b/src/ResourceGraph/ResourceGraph.Test/SessionRecords/Microsoft.Azure.Commands.ResourceGraph.Test.ScenarioTests.ResourceGraphQueryTests/ManagementGroups.json
@@ -0,0 +1,242 @@
+{
+ "Entries": [
+ {
+ "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}",
+ "RequestHeaders": {
+ "x-ms-client-request-id": [
+ "965b147e-ad00-4279-ace9-11593a225f69"
+ ],
+ "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": [
+ "198"
+ ]
+ },
+ "ResponseHeaders": {
+ "Cache-Control": [
+ "no-cache"
+ ],
+ "Pragma": [
+ "no-cache"
+ ],
+ "Strict-Transport-Security": [
+ "max-age=31536000; includeSubDomains"
+ ],
+ "x-ms-ratelimit-remaining-tenant-resource-requests": [
+ "14"
+ ],
+ "x-ms-user-quota-remaining": [
+ "14"
+ ],
+ "x-ms-user-quota-resets-after": [
+ "00:00:05"
+ ],
+ "Server": [
+ "Kestrel"
+ ],
+ "x-ms-ratelimit-remaining-tenant-reads": [
+ "14990"
+ ],
+ "x-ms-request-id": [
+ "cfba4a18-754e-4b0b-9c5f-a2cc433012c5"
+ ],
+ "x-ms-correlation-request-id": [
+ "cfba4a18-754e-4b0b-9c5f-a2cc433012c5"
+ ],
+ "x-ms-routing-request-id": [
+ "CENTRALUS:20210325T114648Z:cfba4a18-754e-4b0b-9c5f-a2cc433012c5"
+ ],
+ "X-Content-Type-Options": [
+ "nosniff"
+ ],
+ "Date": [
+ "Thu, 25 Mar 2021 11:46:47 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 ],\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": [
+ "fd49a4d5-ba7c-4f69-b654-34987ddda0e5"
+ ],
+ "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": [
+ "273"
+ ]
+ },
+ "ResponseHeaders": {
+ "Cache-Control": [
+ "no-cache"
+ ],
+ "Pragma": [
+ "no-cache"
+ ],
+ "Strict-Transport-Security": [
+ "max-age=31536000; includeSubDomains"
+ ],
+ "x-ms-ratelimit-remaining-tenant-resource-requests": [
+ "13"
+ ],
+ "x-ms-user-quota-remaining": [
+ "13"
+ ],
+ "x-ms-user-quota-resets-after": [
+ "00:00:05"
+ ],
+ "Server": [
+ "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"
+ ],
+ "x-ms-request-id": [
+ "4217e691-92e8-4d4b-acb2-d4eea81bdd14"
+ ],
+ "x-ms-correlation-request-id": [
+ "4217e691-92e8-4d4b-acb2-d4eea81bdd14"
+ ],
+ "x-ms-routing-request-id": [
+ "CENTRALUS:20210325T114648Z:4217e691-92e8-4d4b-acb2-d4eea81bdd14"
+ ],
+ "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
+ }
+ ],
+ "Names": {},
+ "Variables": {
+ "SubscriptionId": "eaab1166-1e13-4370-a951-6ed345a48c15"
+ }
+}
\ 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 0ebbdf769c9f..f35b873a62e4 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
@@ -1,169 +1,30 @@
{
"Entries": [
{
- "RequestUri": "/subscriptions?api-version=2016-06-01",
- "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnM/YXBpLXZlcnNpb249MjAxNi0wNi0wMQ==",
- "RequestMethod": "GET",
- "RequestBody": "",
- "RequestHeaders": {
- "x-ms-client-request-id": [
- "31537677-7032-4654-becb-372f2eeebf21"
- ],
- "accept-language": [
- "en-US"
- ],
- "User-Agent": [
- "FxVersion/4.7.3163.0",
- "OSName/Windows10Enterprise",
- "OSVersion/6.3.17134",
- "Microsoft.Azure.Internal.Subscriptions.SubscriptionClient/4.1.0"
- ]
- },
- "ResponseBody": "{\"value\": [{\"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000\", \"subscriptionId\": \"00000000-0000-0000-0000-000000000000\", \"displayName\": \"Test Subscription\", \"state\": \"Enabled\", \"authorizationSource\": \"RoleBased\"}]}",
- "ResponseHeaders": {
- "Content-Length": [
- "987"
- ],
- "Content-Type": [
- "application/json; charset=utf-8"
- ],
- "Expires": [
- "-1"
- ],
- "Pragma": [
- "no-cache"
- ],
- "x-ms-ratelimit-remaining-tenant-reads": [
- "11999"
- ],
- "x-ms-request-id": [
- "dc5b4ea5-4059-44fa-9d49-5c48f46224f4"
- ],
- "x-ms-correlation-request-id": [
- "dc5b4ea5-4059-44fa-9d49-5c48f46224f4"
- ],
- "x-ms-routing-request-id": [
- "WESTUS2:20180926T232942Z:dc5b4ea5-4059-44fa-9d49-5c48f46224f4"
- ],
- "Strict-Transport-Security": [
- "max-age=31536000; includeSubDomains"
- ],
- "X-Content-Type-Options": [
- "nosniff"
- ],
- "Cache-Control": [
- "no-cache"
- ],
- "Date": [
- "Wed, 26 Sep 2018 23:29:41 GMT"
- ]
- },
- "StatusCode": 200
- },
- {
- "RequestUri": "/providers/Microsoft.ResourceGraph/resources?api-version=2019-04-01",
- "EncodedRequestUri": "L3Byb3ZpZGVycy9NaWNyb3NvZnQuUmVzb3VyY2VHcmFwaC9yZXNvdXJjZXM/YXBpLXZlcnNpb249MjAxOS0wNC0wMQ==",
+ "RequestUri": "/providers/Microsoft.ResourceGraph/resources?api-version=2021-03-01",
+ "EncodedRequestUri": "L3Byb3ZpZGVycy9NaWNyb3NvZnQuUmVzb3VyY2VHcmFwaC9yZXNvdXJjZXM/YXBpLXZlcnNpb249MjAyMS0wMy0wMQ==",
"RequestMethod": "POST",
- "RequestBody": "{\r\n \"subscriptions\": [\r\n \"00000000-0000-0000-0000-000000000000\"\r\n ],\r\n \"query\": \"project id\",\r\n \"options\": {\r\n \"$top\": 2,\r\n \"$skip\": 2,\r\n \"resultFormat\": \"ObjectArray\" \r\n }\r\n}",
+ "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}",
"RequestHeaders": {
- "Content-Type": [
- "application/json; charset=utf-8"
- ],
- "Content-Length": [
- "155"
- ],
"x-ms-client-request-id": [
- "5c5115cb-16c3-4cc4-905f-36a1ac376e56"
+ "81bf2ad8-16bd-4a25-9f8b-0d4548118971"
],
- "accept-language": [
+ "Accept-Language": [
"en-US"
],
"User-Agent": [
- "FxVersion/4.7.3163.0",
- "OSName/Windows10Enterprise",
- "OSVersion/6.3.17134",
- "Microsoft.Azure.Management.ResourceGraph.ResourceGraphClient/2.0.0"
- ]
- },
- "ResponseBody": "{\r\n \"totalRecords\": 674,\r\n \"count\": 2,\r\n \"data\": [\r\n {\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/DEMORG/providers/Microsoft.Compute/disks/VM_OsDisk_1_0518e53ab76241a39b27aababff4a633\"\r\n },\r\n {\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/DEMORG/providers/Microsoft.Compute/virtualMachines/VM/extensions/MicrosoftMonitoringAgent\"\r\n }\r\n ],\r\n \"facets\": [],\r\n \"resultTruncated\": \"false\",\r\n \"$skipToken\": \"82aw3vQlArEastJ24LABY8oPgQLesIyAyzYs2g6/aOOOmJHSYFj39fODurJV5e2tTFFebWcfxn7n5edicA8u6HgSJe1GCEk5HjxwLkeJiye2LVZDC7TaValkJbsk9JqY4yv5c7iRiLqgO34RbHEeVfLJpa56u4RZu0K+GpQvnBRPyAhy3KbwhZWpU5Nnqnud2whGb5WKdlL8xF7wnQaUnUN2lns8WwqwM4rc0VK4BbQt/WfWWcYJivSAyB3m4Z5g73df1KiU4C+K8auvUMpLPYVxxnKC/YZz42YslVAWXXUmuGOaM2SfLHRO6o4O9DgXlUgYjeFWqIbAkmMiVEqU\"\r\n}",
- "ResponseHeaders": {
- "Cache-Control": [
- "no-cache"
+ "FxVersion/4.6.29812.02",
+ "OSName/Windows",
+ "OSVersion/Microsoft.Windows.10.0.19042.",
+ "Microsoft.Azure.Management.ResourceGraph.ResourceGraphClient/2.1.0.0"
],
- "Pragma": [
- "no-cache"
- ],
- "Strict-Transport-Security": [
- "max-age=31536000; includeSubDomains"
- ],
- "x-ms-user-quota-resets-after": [
- "00:00:05"
- ],
- "x-ms-user-quota-remaining": [
- "13"
- ],
- "x-ms-ratelimit-remaining-tenant-resource-requests": [
- "13"
- ],
- "Server": [
- "Microsoft-HTTPAPI/2.0"
- ],
- "x-ms-ratelimit-remaining-tenant-reads": [
- "11999"
- ],
- "x-ms-request-id": [
- "e27e652e-d30b-4e49-bbd3-a58a3f430d42"
- ],
- "x-ms-correlation-request-id": [
- "e27e652e-d30b-4e49-bbd3-a58a3f430d42"
- ],
- "x-ms-routing-request-id": [
- "WESTUS:20190710T225645Z:e27e652e-d30b-4e49-bbd3-a58a3f430d42"
- ],
- "X-Content-Type-Options": [
- "nosniff"
- ],
- "Date": [
- "Wed, 10 Jul 2019 22:56:45 GMT"
- ],
- "Content-Length": [
- "4542"
- ],
- "Content-Type": [
- "application/json; charset=utf-8"
- ],
- "Expires": [
- "-1"
- ]
- },
- "StatusCode": 200
- },
- {
- "RequestUri": "/providers/Microsoft.ResourceGraph/resources?api-version=2019-04-01",
- "EncodedRequestUri": "L3Byb3ZpZGVycy9NaWNyb3NvZnQuUmVzb3VyY2VHcmFwaC9yZXNvdXJjZXM/YXBpLXZlcnNpb249MjAxOS0wNC0wMQ==",
- "RequestMethod": "POST",
- "RequestBody": "{\r\n \"subscriptions\": [\r\n \"00000000-0000-0000-0000-000000000000\"\r\n ],\r\n \"query\": \"project id\",\r\n \"options\": {\r\n \"$skipToken\": \"82aw3vQlArEastJ24LABY8oPgQLesIyAyzYs2g6/aOOOmJHSYFj39fODurJV5e2tTFFebWcfxn7n5edicA8u6HgSJe1GCEk5HjxwLkeJiye2LVZDC7TaValkJbsk9JqY4yv5c7iRiLqgO34RbHEeVfLJpa56u4RZu0K+GpQvnBRPyAhy3KbwhZWpU5Nnqnud2whGb5WKdlL8xF7wnQaUnUN2lns8WwqwM4rc0VK4BbQt/WfWWcYJivSAyB3m4Z5g73df1KiU4C+K8auvUMpLPYVxxnKC/YZz42YslVAWXXUmuGOaM2SfLHRO6o4O9DgXlUgYjeFWqIbAkmMiVEqU\",\r\n \"$top\": 1,\r\n \"$skip\": 4\r\n }\r\n}",
- "RequestHeaders": {
"Content-Type": [
"application/json; charset=utf-8"
],
"Content-Length": [
- "454"
- ],
- "x-ms-client-request-id": [
- "8489bd2d-c99a-4250-8a67-1361bc38b79f"
- ],
- "accept-language": [
- "en-US"
- ],
- "User-Agent": [
- "FxVersion/4.7.3163.0",
- "OSName/Windows10Enterprise",
- "OSVersion/6.3.17134",
- "Microsoft.Azure.Management.ResourceGraph.ResourceGraphClient/0.9.0.0"
+ "153"
]
},
- "ResponseBody": "{\r\n \"totalRecords\": 674,\r\n \"count\": 1,\r\n \"data\": [\r\n {\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/DEMORG/providers/Microsoft.Compute/disks/VM_OsDisk_1_0518e53dwsdsab76241a39b27aababff4a633\"\r\n }\r\n ],\r\n \"facets\": [],\r\n \"resultTruncated\": \"false\",\r\n \"$skipToken\": \"82awdssdsddsdsOOmJHSYFj39fODurJV5e2tTFFebWcfxn7n5edicA8u6HgSJe1GCEk5HjxwLkeJiye2LVZDC7TaValkJbsk9JqY4yv5c7iRiLqgO34RbHEeVfLJpa56u4RZu0K+GpQvnBRPyAhy3KbwhZWpU5Nnqnud2whGb5WKdlL8xF7wnQaUnUN2lns8WwqwM4rc0VK4BbQt/WfWWcYJivSAyB3m4Z5g73df1KiU4C+K8auvUMpLPYVxxnKC/YZz42YslVAWXXUmuGOaM2SfLHRO6o4O9DgXlUgYjeFWqIbAkmMiVEqU\"\r\n}",
"ResponseHeaders": {
"Cache-Control": [
"no-cache"
@@ -174,38 +35,38 @@
"Strict-Transport-Security": [
"max-age=31536000; includeSubDomains"
],
- "x-ms-user-quota-resets-after": [
- "00:00:05"
+ "x-ms-ratelimit-remaining-tenant-resource-requests": [
+ "14"
],
"x-ms-user-quota-remaining": [
- "13"
+ "14"
],
- "x-ms-ratelimit-remaining-tenant-resource-requests": [
- "13"
+ "x-ms-user-quota-resets-after": [
+ "00:00:05"
],
"Server": [
- "Microsoft-HTTPAPI/2.0"
+ "Kestrel"
],
"x-ms-ratelimit-remaining-tenant-reads": [
- "11999"
+ "14990"
],
"x-ms-request-id": [
- "e27e652e-d30b-4e49-bbd3-a58a3f430d42"
+ "6b247104-a1d3-4eaa-9e8d-4631cae56423"
],
"x-ms-correlation-request-id": [
- "e27e652e-d30b-4e49-bbd3-a58a3f430d42"
+ "6b247104-a1d3-4eaa-9e8d-4631cae56423"
],
"x-ms-routing-request-id": [
- "WESTUS:20190710T225645Z:e27e652e-d30b-4e49-bbd3-a58a3f430d42"
+ "CENTRALUS:20210325T114509Z:6b247104-a1d3-4eaa-9e8d-4631cae56423"
],
"X-Content-Type-Options": [
"nosniff"
],
"Date": [
- "Wed, 10 Jul 2019 22:56:45 GMT"
+ "Thu, 25 Mar 2021 11:45:09 GMT"
],
"Content-Length": [
- "4542"
+ "688"
],
"Content-Type": [
"application/json; charset=utf-8"
@@ -214,11 +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}",
"StatusCode": 200
- }
+ }
],
"Names": {},
"Variables": {
- "SubscriptionId": "00000000-0000-0000-0000-000000000000"
+ "SubscriptionId": "eaab1166-1e13-4370-a951-6ed345a48c15"
}
}
\ 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 3f4b7d7f670a..9891d90205c3 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
@@ -1,88 +1,28 @@
{
"Entries": [
{
- "RequestUri": "/subscriptions?api-version=2016-06-01",
- "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnM/YXBpLXZlcnNpb249MjAxNi0wNi0wMQ==",
- "RequestMethod": "GET",
- "RequestBody": "",
- "RequestHeaders": {
- "x-ms-client-request-id": [
- "31537677-7032-4654-becb-372f2eeebf21"
- ],
- "accept-language": [
- "en-US"
- ],
- "User-Agent": [
- "FxVersion/4.7.3163.0",
- "OSName/Windows10Enterprise",
- "OSVersion/6.3.17134",
- "Microsoft.Azure.Internal.Subscriptions.SubscriptionClient/4.1.0"
- ]
- },
- "ResponseBody": "{\"value\": [{\"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000\", \"subscriptionId\": \"00000000-0000-0000-0000-000000000000\", \"displayName\": \"Test Subscription\", \"state\": \"Enabled\", \"authorizationSource\": \"RoleBased\"}]}",
- "ResponseHeaders": {
- "Content-Length": [
- "987"
- ],
- "Content-Type": [
- "application/json; charset=utf-8"
- ],
- "Expires": [
- "-1"
- ],
- "Pragma": [
- "no-cache"
- ],
- "x-ms-ratelimit-remaining-tenant-reads": [
- "11999"
- ],
- "x-ms-request-id": [
- "dc5b4ea5-4059-44fa-9d49-5c48f46224f4"
- ],
- "x-ms-correlation-request-id": [
- "dc5b4ea5-4059-44fa-9d49-5c48f46224f4"
- ],
- "x-ms-routing-request-id": [
- "WESTUS2:20180926T232942Z:dc5b4ea5-4059-44fa-9d49-5c48f46224f4"
- ],
- "Strict-Transport-Security": [
- "max-age=31536000; includeSubDomains"
- ],
- "X-Content-Type-Options": [
- "nosniff"
- ],
- "Cache-Control": [
- "no-cache"
- ],
- "Date": [
- "Wed, 26 Sep 2018 23:29:41 GMT"
- ]
- },
- "StatusCode": 200
- },
- {
- "RequestUri": "/providers/Microsoft.ResourceGraph/resources?api-version=2019-04-01",
- "EncodedRequestUri": "L3Byb3ZpZGVycy9NaWNyb3NvZnQuUmVzb3VyY2VHcmFwaC9yZXNvdXJjZXM/YXBpLXZlcnNpb249MjAxOS0wNC0wMQ==",
+ "RequestUri": "/providers/Microsoft.ResourceGraph/resources?api-version=2021-03-01",
+ "EncodedRequestUri": "L3Byb3ZpZGVycy9NaWNyb3NvZnQuUmVzb3VyY2VHcmFwaC9yZXNvdXJjZXM/YXBpLXZlcnNpb249MjAyMS0wMy0wMQ==",
"RequestMethod": "POST",
- "RequestBody": "{\r\n \"subscriptions\": [\r\n \"00000000-0000-0000-0000-000000000000\"\r\n ],\r\n \"query\": \"project id, tags, properties |where tags != '' | where properties != '' | limit 2\",\r\n \"options\": {\r\n \"$top\": 2,\r\n \"$skip\": 0,\r\n \"resultFormat\": \"objectArray\"\r\n }\r\n}",
+ "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}",
"RequestHeaders": {
"x-ms-client-request-id": [
- "d56a964d-df96-4e23-ad5c-9ae16d8b4c5d"
+ "47602c51-aa93-433d-92b8-2e89b7c6878a"
],
"Accept-Language": [
"en-US"
],
"User-Agent": [
- "FxVersion/4.6.27617.04",
+ "FxVersion/4.6.29812.02",
"OSName/Windows",
- "OSVersion/Microsoft.Windows.10.0.18362.",
- "Microsoft.Azure.Management.ResourceGraph.ResourceGraphClient/2.0.0.0"
+ "OSVersion/Microsoft.Windows.10.0.19042.",
+ "Microsoft.Azure.Management.ResourceGraph.ResourceGraphClient/2.1.0.0"
],
"Content-Type": [
"application/json; charset=utf-8"
],
"Content-Length": [
- "221"
+ "183"
]
},
"ResponseHeaders": {
@@ -95,38 +35,38 @@
"Strict-Transport-Security": [
"max-age=31536000; includeSubDomains"
],
- "x-ms-user-quota-resets-after": [
- "00:00:05"
+ "x-ms-ratelimit-remaining-tenant-resource-requests": [
+ "10"
],
"x-ms-user-quota-remaining": [
- "13"
+ "10"
],
- "x-ms-ratelimit-remaining-tenant-resource-requests": [
- "13"
+ "x-ms-user-quota-resets-after": [
+ "00:00:05"
],
"Server": [
- "Microsoft-HTTPAPI/2.0"
+ "Kestrel"
],
"x-ms-ratelimit-remaining-tenant-reads": [
- "11999"
+ "14994"
],
"x-ms-request-id": [
- "e27e652e-d30b-4e49-bbd3-a58a3f430d42"
+ "427a1d7f-3e50-4a97-87a8-9b84b98b91bf"
],
"x-ms-correlation-request-id": [
- "e27e652e-d30b-4e49-bbd3-a58a3f430d42"
+ "427a1d7f-3e50-4a97-87a8-9b84b98b91bf"
],
"x-ms-routing-request-id": [
- "WESTUS:20190710T225645Z:e27e652e-d30b-4e49-bbd3-a58a3f430d42"
+ "NORTHEUROPE:20210325T114533Z:427a1d7f-3e50-4a97-87a8-9b84b98b91bf"
],
"X-Content-Type-Options": [
"nosniff"
],
"Date": [
- "Wed, 10 Jul 2019 22:56:45 GMT"
+ "Thu, 25 Mar 2021 11:45:33 GMT"
],
"Content-Length": [
- "4542"
+ "740"
],
"Content-Type": [
"application/json; charset=utf-8"
@@ -135,12 +75,12 @@
"-1"
]
},
- "ResponseBody": "{\r\n \"totalRecords\": 2,\r\n \"count\": 2,\r\n \"data\": [\r\n {\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MEMVM/providers/Microsoft.Compute/virtualMachines/memvm/extensions/MicrosoftMonitoringAgent\",\r\n \"tags\": {},\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n \"type\": \"MicrosoftMonitoringAgent\",\r\n \"autoUpgradeMinorVersion\": true,\r\n \"typeHandlerVersion\": \"1.0\",\r\n \"publisher\": \"Microsoft.EnterpriseCloud.Monitoring\",\r\n \"settings\": {\r\n \"stopOnMultipleConnections\": true,\r\n \"workspaceId\": \"0f3577b5-fd56-4f52-81d3-43d1eab26618\"\r\n }\r\n }\r\n },\r\n {\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/Workerbackup/providers/Microsoft.ClassicCompute/domainNames/worker-b\",\r\n \"tags\": {},\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n \"status\": \"Created\",\r\n \"hostName\": \"worker-b.cloudapp.net\",\r\n \"label\": \"worker-b\"\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/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}",
"StatusCode": 200
}
],
"Names": {},
"Variables": {
- "SubscriptionId": "00000000-0000-0000-0000-000000000000"
+ "SubscriptionId": "eaab1166-1e13-4370-a951-6ed345a48c15"
}
}
\ 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 817ef75a1851..233b755ef239 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
@@ -1,91 +1,30 @@
{
"Entries": [
{
- "RequestUri": "/subscriptions?api-version=2016-06-01",
- "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnM/YXBpLXZlcnNpb249MjAxNi0wNi0wMQ==",
- "RequestMethod": "GET",
- "RequestBody": "",
+ "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}",
"RequestHeaders": {
"x-ms-client-request-id": [
- "31537677-7032-4654-becb-372f2eeebf21"
+ "ec427211-392d-42f3-bfa2-1a953ff4c4e1"
],
- "accept-language": [
+ "Accept-Language": [
"en-US"
],
"User-Agent": [
- "FxVersion/4.7.3163.0",
- "OSName/Windows10Enterprise",
- "OSVersion/6.3.17134",
- "Microsoft.Azure.Internal.Subscriptions.SubscriptionClient/4.1.0"
- ]
- },
- "ResponseBody": "{\"value\": [{\"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000\", \"subscriptionId\": \"00000000-0000-0000-0000-000000000000\", \"displayName\": \"Test Subscription\", \"state\": \"Enabled\", \"authorizationSource\": \"RoleBased\"}]}",
- "ResponseHeaders": {
- "Content-Length": [
- "987"
+ "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"
- ],
- "Expires": [
- "-1"
- ],
- "Pragma": [
- "no-cache"
- ],
- "x-ms-ratelimit-remaining-tenant-reads": [
- "11999"
- ],
- "x-ms-request-id": [
- "dc5b4ea5-4059-44fa-9d49-5c48f46224f4"
- ],
- "x-ms-correlation-request-id": [
- "dc5b4ea5-4059-44fa-9d49-5c48f46224f4"
- ],
- "x-ms-routing-request-id": [
- "WESTUS2:20180926T232942Z:dc5b4ea5-4059-44fa-9d49-5c48f46224f4"
- ],
- "Strict-Transport-Security": [
- "max-age=31536000; includeSubDomains"
- ],
- "X-Content-Type-Options": [
- "nosniff"
- ],
- "Cache-Control": [
- "no-cache"
- ],
- "Date": [
- "Wed, 26 Sep 2018 23:29:41 GMT"
- ]
- },
- "StatusCode": 200
- },
- {
- "RequestUri": "/providers/Microsoft.ResourceGraph/resources?api-version=2019-04-01",
- "EncodedRequestUri": "L3Byb3ZpZGVycy9NaWNyb3NvZnQuUmVzb3VyY2VHcmFwaC9yZXNvdXJjZXM/YXBpLXZlcnNpb249MjAxOC0wOS0wMS1wcmV2aWV3",
- "RequestMethod": "POST",
- "RequestBody": "{\r\n \"subscriptions\": [\r\n \"00000000-0000-0000-0000-000000000000\"\r\n ],\r\n \"query\": \"where where\",\r\n \"options\": {\r\n \"$top\": 2,\r\n \"$skip\": 0,\r\n \"resultFormat\": \"ObjectArray\" }\r\n}",
- "RequestHeaders": {
"Content-Type": [
"application/json; charset=utf-8"
],
"Content-Length": [
"156"
- ],
- "x-ms-client-request-id": [
- "ee5145ea-dfaf-42ba-a795-0e1c6eaf5955"
- ],
- "accept-language": [
- "en-US"
- ],
- "User-Agent": [
- "FxVersion/4.7.3163.0",
- "OSName/Windows10Enterprise",
- "OSVersion/6.3.17134",
- "Microsoft.Azure.Management.ResourceGraph.ResourceGraphClient/2.0.0.0"
]
},
- "ResponseBody": "{\r\n \"error\": {\r\n \"code\": \"InvalidQuery\",\r\n \"message\": \"Query validation error\",\r\n \"details\": [\r\n {\r\n \"code\": \"ParserFailure\",\r\n \"message\": \"Parser failure\",\r\n \"line\": 1,\r\n \"characterPositionInLine\": 11,\r\n \"token\": \"\",\r\n \"expectedToken\": \"Ÿ\"\r\n }\r\n ]\r\n }\r\n}",
"ResponseHeaders": {
"Cache-Control": [
"no-cache"
@@ -96,38 +35,38 @@
"Strict-Transport-Security": [
"max-age=31536000; includeSubDomains"
],
- "x-ms-user-quota-resets-after": [
- "00:00:05"
+ "x-ms-ratelimit-remaining-tenant-resource-requests": [
+ "12"
],
"x-ms-user-quota-remaining": [
- "13"
+ "12"
],
- "x-ms-ratelimit-remaining-tenant-resource-requests": [
- "13"
+ "x-ms-user-quota-resets-after": [
+ "00:00:05"
],
"Server": [
- "Microsoft-HTTPAPI/2.0"
+ "Kestrel"
],
"x-ms-ratelimit-remaining-tenant-reads": [
- "11999"
+ "14997"
],
"x-ms-request-id": [
- "e27e652e-d30b-4e49-bbd3-a58a3f430d42"
+ "30ce3d66-fd76-408f-9f26-2022e931c3d5"
],
"x-ms-correlation-request-id": [
- "e27e652e-d30b-4e49-bbd3-a58a3f430d42"
+ "30ce3d66-fd76-408f-9f26-2022e931c3d5"
],
"x-ms-routing-request-id": [
- "WESTUS:20190710T225645Z:e27e652e-d30b-4e49-bbd3-a58a3f430d42"
+ "NORTHEUROPE:20210325T114512Z:30ce3d66-fd76-408f-9f26-2022e931c3d5"
],
"X-Content-Type-Options": [
"nosniff"
],
"Date": [
- "Wed, 10 Jul 2019 22:56:45 GMT"
+ "Thu, 25 Mar 2021 11:45:12 GMT"
],
"Content-Length": [
- "4542"
+ "488"
],
"Content-Type": [
"application/json; charset=utf-8"
@@ -136,11 +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}",
"StatusCode": 400
}
],
"Names": {},
"Variables": {
- "SubscriptionId": "00000000-0000-0000-0000-000000000000"
+ "SubscriptionId": "eaab1166-1e13-4370-a951-6ed345a48c15"
}
}
\ 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
new file mode 100644
index 000000000000..50abf6b0bef3
--- /dev/null
+++ b/src/ResourceGraph/ResourceGraph.Test/SessionRecords/Microsoft.Azure.Commands.ResourceGraph.Test.ScenarioTests.ResourceGraphQueryTests/SkipTokenQuery.json
@@ -0,0 +1,86 @@
+{
+ "Entries": [
+ {
+ "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}",
+ "RequestHeaders": {
+ "x-ms-client-request-id": [
+ "a8ed2766-e017-42b6-b708-2e9f85cf4d24"
+ ],
+ "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": [
+ "315"
+ ]
+ },
+ "ResponseHeaders": {
+ "Cache-Control": [
+ "no-cache"
+ ],
+ "Pragma": [
+ "no-cache"
+ ],
+ "Strict-Transport-Security": [
+ "max-age=31536000; includeSubDomains"
+ ],
+ "x-ms-ratelimit-remaining-tenant-resource-requests": [
+ "14"
+ ],
+ "x-ms-user-quota-remaining": [
+ "14"
+ ],
+ "x-ms-user-quota-resets-after": [
+ "00:00:05"
+ ],
+ "Server": [
+ "Kestrel"
+ ],
+ "x-ms-ratelimit-remaining-tenant-reads": [
+ "14997"
+ ],
+ "x-ms-request-id": [
+ "f7ddad1b-c1b3-406c-8ce1-5df0d7ea1686"
+ ],
+ "x-ms-correlation-request-id": [
+ "f7ddad1b-c1b3-406c-8ce1-5df0d7ea1686"
+ ],
+ "x-ms-routing-request-id": [
+ "NORTHEUROPE:20210325T210647Z:f7ddad1b-c1b3-406c-8ce1-5df0d7ea1686"
+ ],
+ "X-Content-Type-Options": [
+ "nosniff"
+ ],
+ "Date": [
+ "Thu, 25 Mar 2021 21:06:47 GMT"
+ ],
+ "Content-Length": [
+ "966"
+ ],
+ "Content-Type": [
+ "application/json; charset=utf-8"
+ ],
+ "Expires": [
+ "-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}",
+ "StatusCode": 200
+ }
+ ],
+ "Names": {},
+ "Variables": {
+ "SubscriptionId": "eaab1166-1e13-4370-a951-6ed345a48c15"
+ }
+}
\ No newline at end of file
diff --git a/src/ResourceGraph/ResourceGraph.Test/SessionRecords/Microsoft.Azure.Commands.ResourceGraph.Test.ScenarioTests.ResourceGraphQueryTests/SubscriptionAndManagementGroupQueryError.json b/src/ResourceGraph/ResourceGraph.Test/SessionRecords/Microsoft.Azure.Commands.ResourceGraph.Test.ScenarioTests.ResourceGraphQueryTests/SubscriptionAndManagementGroupQueryError.json
new file mode 100644
index 000000000000..3e5c2ebefc59
--- /dev/null
+++ b/src/ResourceGraph/ResourceGraph.Test/SessionRecords/Microsoft.Azure.Commands.ResourceGraph.Test.ScenarioTests.ResourceGraphQueryTests/SubscriptionAndManagementGroupQueryError.json
@@ -0,0 +1,86 @@
+{
+ "Entries": [
+ {
+ "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}",
+ "RequestHeaders": {
+ "x-ms-client-request-id": [
+ "ec427211-392d-42f3-bfa2-1a953ff4c4e1"
+ ],
+ "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": [
+ "156"
+ ]
+ },
+ "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": [
+ "14997"
+ ],
+ "x-ms-request-id": [
+ "30ce3d66-fd76-408f-9f26-2022e931c3d5"
+ ],
+ "x-ms-correlation-request-id": [
+ "30ce3d66-fd76-408f-9f26-2022e931c3d5"
+ ],
+ "x-ms-routing-request-id": [
+ "NORTHEUROPE:20210325T114512Z:30ce3d66-fd76-408f-9f26-2022e931c3d5"
+ ],
+ "X-Content-Type-Options": [
+ "nosniff"
+ ],
+ "Date": [
+ "Thu, 25 Mar 2021 11:45:12 GMT"
+ ],
+ "Content-Length": [
+ "488"
+ ],
+ "Content-Type": [
+ "application/json; charset=utf-8"
+ ],
+ "Expires": [
+ "-1"
+ ]
+ },
+ "ResponseBody": "fake response as query never reaches the server",
+ "StatusCode": 400
+ }
+ ],
+ "Names": {},
+ "Variables": {
+ "SubscriptionId": "eaab1166-1e13-4370-a951-6ed345a48c15"
+ }
+}
\ No newline at end of file
diff --git a/src/ResourceGraph/ResourceGraph.Test/SessionRecords/Microsoft.Azure.Commands.ResourceGraph.Test.ScenarioTests.ResourceGraphQueryTests/SubscriptionQueryError.json b/src/ResourceGraph/ResourceGraph.Test/SessionRecords/Microsoft.Azure.Commands.ResourceGraph.Test.ScenarioTests.ResourceGraphQueryTests/SubscriptionQueryError.json
deleted file mode 100644
index cdd46e9e19dd..000000000000
--- a/src/ResourceGraph/ResourceGraph.Test/SessionRecords/Microsoft.Azure.Commands.ResourceGraph.Test.ScenarioTests.ResourceGraphQueryTests/SubscriptionQueryError.json
+++ /dev/null
@@ -1,80 +0,0 @@
-{
- "Entries": [
- {
- "RequestUri": "/subscriptions?api-version=2016-06-01",
- "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnM/YXBpLXZlcnNpb249MjAxNi0wNi0wMQ==",
- "RequestMethod": "GET",
- "RequestBody": "",
- "RequestHeaders": {
- "x-ms-client-request-id": [
- "31537677-7032-4654-becb-372f2eeebf21"
- ],
- "accept-language": [
- "en-US"
- ],
- "User-Agent": [
- "FxVersion/4.7.3163.0",
- "OSName/Windows10Enterprise",
- "OSVersion/6.3.17134",
- "Microsoft.Azure.Internal.Subscriptions.SubscriptionClient/4.1.0"
- ]
- },
- "ResponseBody": "{\"value\": [{\"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000\", \"subscriptionId\": \"00000000-0000-0000-0000-000000000000\", \"displayName\": \"Test Subscription\", \"state\": \"Enabled\", \"authorizationSource\": \"RoleBased\"}]}",
- "ResponseHeaders": {
- "Cache-Control": [
- "no-cache"
- ],
- "Pragma": [
- "no-cache"
- ],
- "Strict-Transport-Security": [
- "max-age=31536000; includeSubDomains"
- ],
- "x-ms-user-quota-resets-after": [
- "00:00:05"
- ],
- "x-ms-user-quota-remaining": [
- "13"
- ],
- "x-ms-ratelimit-remaining-tenant-resource-requests": [
- "13"
- ],
- "Server": [
- "Microsoft-HTTPAPI/2.0"
- ],
- "x-ms-ratelimit-remaining-tenant-reads": [
- "11999"
- ],
- "x-ms-request-id": [
- "e27e652e-d30b-4e49-bbd3-a58a3f430d42"
- ],
- "x-ms-correlation-request-id": [
- "e27e652e-d30b-4e49-bbd3-a58a3f430d42"
- ],
- "x-ms-routing-request-id": [
- "WESTUS:20190710T225645Z:e27e652e-d30b-4e49-bbd3-a58a3f430d42"
- ],
- "X-Content-Type-Options": [
- "nosniff"
- ],
- "Date": [
- "Wed, 10 Jul 2019 22:56:45 GMT"
- ],
- "Content-Length": [
- "4542"
- ],
- "Content-Type": [
- "application/json; charset=utf-8"
- ],
- "Expires": [
- "-1"
- ]
- },
- "StatusCode": 200
- }
- ],
- "Names": {},
- "Variables": {
- "SubscriptionId": "00000000-0000-0000-0000-000000000000"
- }
-}
\ 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 64d5107f1d11..687c56a15e81 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
@@ -1,157 +1,106 @@
{
"Entries": [
{
- "RequestUri": "/subscriptions?api-version=2016-06-01",
- "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnM/YXBpLXZlcnNpb249MjAxNi0wNi0wMQ==",
- "RequestMethod": "GET",
- "RequestBody": "",
+ "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}",
"RequestHeaders": {
"x-ms-client-request-id": [
- "31537677-7032-4654-becb-372f2eeebf21"
+ "5e32bfb4-c13d-4ef1-887b-b5450c598e17"
],
- "accept-language": [
+ "Accept-Language": [
"en-US"
],
"User-Agent": [
- "FxVersion/4.7.3163.0",
- "OSName/Windows10Enterprise",
- "OSVersion/6.3.17134",
- "Microsoft.Azure.Internal.Subscriptions.SubscriptionClient/4.1.0"
- ]
- },
- "ResponseBody": "{\"value\": [{\"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000\", \"subscriptionId\": \"00000000-0000-0000-0000-000000000000\", \"displayName\": \"Test Subscription\", \"state\": \"Enabled\", \"authorizationSource\": \"RoleBased\"}]}",
- "ResponseHeaders": {
- "Content-Length": [
- "987"
+ "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"
],
- "Expires": [
- "-1"
+ "Content-Length": [
+ "198"
+ ]
+ },
+ "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": [
- "11999"
+ "14995"
],
"x-ms-request-id": [
- "dc5b4ea5-4059-44fa-9d49-5c48f46224f4"
+ "1cb6e6a5-1223-4479-ad7c-b44b06d92557"
],
"x-ms-correlation-request-id": [
- "dc5b4ea5-4059-44fa-9d49-5c48f46224f4"
+ "1cb6e6a5-1223-4479-ad7c-b44b06d92557"
],
"x-ms-routing-request-id": [
- "WESTUS2:20180926T232942Z:dc5b4ea5-4059-44fa-9d49-5c48f46224f4"
- ],
- "Strict-Transport-Security": [
- "max-age=31536000; includeSubDomains"
+ "NORTHEUROPE:20210325T114518Z:1cb6e6a5-1223-4479-ad7c-b44b06d92557"
],
"X-Content-Type-Options": [
"nosniff"
],
- "Cache-Control": [
- "no-cache"
- ],
"Date": [
- "Wed, 26 Sep 2018 23:29:41 GMT"
- ]
- },
- "StatusCode": 200
- },
- {
- "RequestUri": "/providers/Microsoft.ResourceGraph/resources?api-version=2019-04-01",
- "EncodedRequestUri": "L3Byb3ZpZGVycy9NaWNyb3NvZnQuUmVzb3VyY2VHcmFwaC9yZXNvdXJjZXM/YXBpLXZlcnNpb249MjAxOS0wNC0wMQ==",
- "RequestMethod": "POST",
- "RequestBody": "{\r\n \"subscriptions\": [\r\n \"00000000-0000-0000-0000-000000000000\"\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}\r\n}",
- "RequestHeaders": {
- "Content-Type": [
- "application/json; charset=utf-8"
+ "Thu, 25 Mar 2021 11:45:18 GMT"
],
"Content-Length": [
- "155"
- ],
- "x-ms-client-request-id": [
- "5c5115cb-16c3-4cc4-905f-36a1ac376e56"
- ],
- "accept-language": [
- "en-US"
- ],
- "User-Agent": [
- "FxVersion/4.7.3163.0",
- "OSName/Windows10Enterprise",
- "OSVersion/6.3.17134",
- "Microsoft.Azure.Management.ResourceGraph.ResourceGraphClient/2.0.0"
- ]
- },
- "ResponseBody": "{\r\n \"totalRecords\": 1,\r\n \"count\": 1,\r\n \"data\": [\r\n {\r\n \"subscriptionId\": \"00000000-0000-0000-0000-000000000000\"\r\n }\r\n ],\r\n \"facets\": [],\r\n \"resultTruncated\": \"false\"\r\n}",
- "ResponseHeaders": {
- "Content-Length": [
- "179"
+ "133"
],
"Content-Type": [
"application/json; charset=utf-8"
],
"Expires": [
"-1"
- ],
- "Pragma": [
- "no-cache"
- ],
- "Strict-Transport-Security": [
- "max-age=31536000; includeSubDomains"
- ],
- "x-ms-ratelimit-remaining-tenant-writes": [
- "1198"
- ],
- "x-ms-request-id": [
- "cebbeeb1-8873-41ea-9985-6401adf2a050"
- ],
- "x-ms-correlation-request-id": [
- "cebbeeb1-8873-41ea-9985-6401adf2a050"
- ],
- "x-ms-routing-request-id": [
- "WESTUS2:20180913T223146Z:cebbeeb1-8873-41ea-9985-6401adf2a050"
- ],
- "X-Content-Type-Options": [
- "nosniff"
- ],
- "Cache-Control": [
- "no-cache"
- ],
- "Date": [
- "Thu, 13 Sep 2018 22:31:46 GMT"
- ],
- "Server": [
- "Microsoft-HTTPAPI/2.0"
]
},
+ "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=2019-04-01",
- "EncodedRequestUri": "L3Byb3ZpZGVycy9NaWNyb3NvZnQuUmVzb3VyY2VHcmFwaC9yZXNvdXJjZXM/YXBpLXZlcnNpb249MjAxOS0wNC0wMQ==",
+ "RequestUri": "/providers/Microsoft.ResourceGraph/resources?api-version=2021-03-01",
+ "EncodedRequestUri": "L3Byb3ZpZGVycy9NaWNyb3NvZnQuUmVzb3VyY2VHcmFwaC9yZXNvdXJjZXM/YXBpLXZlcnNpb249MjAyMS0wMy0wMQ==",
"RequestMethod": "POST",
- "RequestBody": "{\r\n \"subscriptions\": [\r\n \"11111111-1111-1111-1111-111111111111\"\r\n ],\r\n \"query\": \"distinct subscriptionId | order by subscriptionId asc\",\r\n \"options\": {\r\n \"$top\": 100,\r\n \"$skip\": 0\r\n }\r\n}",
+ "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}",
"RequestHeaders": {
- "Content-Type": [
- "application/json; charset=utf-8"
- ],
- "Content-Length": [
- "155"
- ],
"x-ms-client-request-id": [
- "5c5115cb-16c3-4cc4-905f-36a1ac376e56"
+ "94c0694c-30b4-4f07-845a-82c0e31df523"
],
- "accept-language": [
+ "Accept-Language": [
"en-US"
],
"User-Agent": [
- "FxVersion/4.7.3163.0",
- "OSName/Windows10Enterprise",
- "OSVersion/6.3.17134",
- "Microsoft.Azure.Management.ResourceGraph.ResourceGraphClient/2.0.0"
+ "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": [
+ "270"
]
},
"ResponseHeaders": {
@@ -164,38 +113,38 @@
"Strict-Transport-Security": [
"max-age=31536000; includeSubDomains"
],
- "x-ms-user-quota-resets-after": [
- "00:00:05"
+ "x-ms-ratelimit-remaining-tenant-resource-requests": [
+ "11"
],
"x-ms-user-quota-remaining": [
- "13"
+ "11"
],
- "x-ms-ratelimit-remaining-tenant-resource-requests": [
- "13"
+ "x-ms-user-quota-resets-after": [
+ "00:00:05"
],
"Server": [
- "Microsoft-HTTPAPI/2.0"
+ "Kestrel"
],
"x-ms-ratelimit-remaining-tenant-reads": [
- "11999"
+ "14994"
],
"x-ms-request-id": [
- "e27e652e-d30b-4e49-bbd3-a58a3f430d42"
+ "951f99da-3255-4932-88e2-ae450020f934"
],
"x-ms-correlation-request-id": [
- "e27e652e-d30b-4e49-bbd3-a58a3f430d42"
+ "951f99da-3255-4932-88e2-ae450020f934"
],
"x-ms-routing-request-id": [
- "WESTUS:20190710T225645Z:e27e652e-d30b-4e49-bbd3-a58a3f430d42"
+ "NORTHEUROPE:20210325T114518Z:951f99da-3255-4932-88e2-ae450020f934"
],
"X-Content-Type-Options": [
"nosniff"
],
"Date": [
- "Wed, 10 Jul 2019 22:56:45 GMT"
+ "Thu, 25 Mar 2021 11:45:18 GMT"
],
"Content-Length": [
- "4542"
+ "133"
],
"Content-Type": [
"application/json; charset=utf-8"
@@ -204,35 +153,34 @@
"-1"
]
},
- "ResponseBody": "{\r\n \"totalRecords\": 1,\r\n \"count\": 1,\r\n \"data\": [\r\n {\r\n \"subscriptionId\": \"11111111-1111-1111-1111-111111111111\"\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\": \"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=2019-04-01",
- "EncodedRequestUri": "L3Byb3ZpZGVycy9NaWNyb3NvZnQuUmVzb3VyY2VHcmFwaC9yZXNvdXJjZXM/YXBpLXZlcnNpb249MjAxOS0wNC0wMQ==",
+ "RequestUri": "/providers/Microsoft.ResourceGraph/resources?api-version=2021-03-01",
+ "EncodedRequestUri": "L3Byb3ZpZGVycy9NaWNyb3NvZnQuUmVzb3VyY2VHcmFwaC9yZXNvdXJjZXM/YXBpLXZlcnNpb249MjAyMS0wMy0wMQ==",
"RequestMethod": "POST",
- "RequestBody": "{\r\n \"subscriptions\": [\r\n \"11111111-1111-1111-1111-111111111111\",\r\n \"22222222-2222-2222-2222-222222222222\"\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}\r\n}",
+ "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}",
"RequestHeaders": {
- "Content-Type": [
- "application/json; charset=utf-8"
- ],
- "Content-Length": [
- "155"
- ],
"x-ms-client-request-id": [
- "5c5115cb-16c3-4cc4-905f-36a1ac376e56"
+ "6301ba41-87e9-4f01-9d85-7cdb7e395ed9"
],
- "accept-language": [
+ "Accept-Language": [
"en-US"
],
"User-Agent": [
- "FxVersion/4.7.3163.0",
- "OSName/Windows10Enterprise",
- "OSVersion/6.3.17134",
- "Microsoft.Azure.Management.ResourceGraph.ResourceGraphClient/2.0.0"
+ "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": [
+ "315"
]
},
- "ResponseBody": "{\r\n \"totalRecords\": 2,\r\n \"count\": 2,\r\n \"data\": [\r\n {\r\n \"subscriptionId\": \"11111111-1111-1111-1111-111111111111\"\r\n },\r\n {\r\n \"subscriptionId\": \"22222222-2222-2222-2222-222222222222\"\r\n }\r\n ],\r\n \"facets\": [],\r\n \"resultTruncated\": \"false\"\r\n}",
"ResponseHeaders": {
"Cache-Control": [
"no-cache"
@@ -243,38 +191,38 @@
"Strict-Transport-Security": [
"max-age=31536000; includeSubDomains"
],
- "x-ms-user-quota-resets-after": [
- "00:00:05"
+ "x-ms-ratelimit-remaining-tenant-resource-requests": [
+ "9"
],
"x-ms-user-quota-remaining": [
- "13"
+ "9"
],
- "x-ms-ratelimit-remaining-tenant-resource-requests": [
- "13"
+ "x-ms-user-quota-resets-after": [
+ "00:00:05"
],
"Server": [
- "Microsoft-HTTPAPI/2.0"
+ "Kestrel"
],
"x-ms-ratelimit-remaining-tenant-reads": [
- "11999"
+ "14993"
],
"x-ms-request-id": [
- "e27e652e-d30b-4e49-bbd3-a58a3f430d42"
+ "93c17461-535e-4c08-b8d1-04586412c499"
],
"x-ms-correlation-request-id": [
- "e27e652e-d30b-4e49-bbd3-a58a3f430d42"
+ "93c17461-535e-4c08-b8d1-04586412c499"
],
"x-ms-routing-request-id": [
- "WESTUS:20190710T225645Z:e27e652e-d30b-4e49-bbd3-a58a3f430d42"
+ "NORTHEUROPE:20210325T114518Z:93c17461-535e-4c08-b8d1-04586412c499"
],
"X-Content-Type-Options": [
"nosniff"
],
"Date": [
- "Wed, 10 Jul 2019 22:56:45 GMT"
+ "Thu, 25 Mar 2021 11:45:18 GMT"
],
"Content-Length": [
- "4542"
+ "133"
],
"Content-Type": [
"application/json; charset=utf-8"
@@ -283,11 +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}",
"StatusCode": 200
}
],
"Names": {},
"Variables": {
- "SubscriptionId": "00000000-0000-0000-0000-000000000000"
+ "SubscriptionId": "eaab1166-1e13-4370-a951-6ed345a48c15"
}
}
\ No newline at end of file
diff --git a/src/ResourceGraph/ResourceGraph.sln b/src/ResourceGraph/ResourceGraph.sln
index 83076b8aeb9e..2de806df3ce8 100644
--- a/src/ResourceGraph/ResourceGraph.sln
+++ b/src/ResourceGraph/ResourceGraph.sln
@@ -1,7 +1,6 @@
-
Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 15
-VisualStudioVersion = 15.0.28307.136
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.31105.61
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ResourceGraph", "ResourceGraph\ResourceGraph.csproj", "{CDFD4E1B-BB5F-439B-8843-E6127CD9B8AD}"
EndProject
@@ -37,6 +36,10 @@ Global
{142D7B0B-388A-4CEB-A228-7F6D423C5C2E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{142D7B0B-388A-4CEB-A228-7F6D423C5C2E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{142D7B0B-388A-4CEB-A228-7F6D423C5C2E}.Release|Any CPU.Build.0 = Release|Any CPU
+ {6BD6B80A-06AF-4B5B-9230-69CCFC6C8D64}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {6BD6B80A-06AF-4B5B-9230-69CCFC6C8D64}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {6BD6B80A-06AF-4B5B-9230-69CCFC6C8D64}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {6BD6B80A-06AF-4B5B-9230-69CCFC6C8D64}.Release|Any CPU.Build.0 = Release|Any CPU
{E628DC38-C7DE-4E2B-B9DF-36D0940EE6BA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E628DC38-C7DE-4E2B-B9DF-36D0940EE6BA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E628DC38-C7DE-4E2B-B9DF-36D0940EE6BA}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -57,10 +60,6 @@ Global
{BC80A1D0-FFA4-43D9-AA74-799F5CB54B58}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BC80A1D0-FFA4-43D9-AA74-799F5CB54B58}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BC80A1D0-FFA4-43D9-AA74-799F5CB54B58}.Release|Any CPU.Build.0 = Release|Any CPU
- {E8880B70-568E-48C5-8CB9-D577BC958FB2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {E8880B70-568E-48C5-8CB9-D577BC958FB2}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {E8880B70-568E-48C5-8CB9-D577BC958FB2}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {E8880B70-568E-48C5-8CB9-D577BC958FB2}.Release|Any CPU.Build.0 = Release|Any CPU
{9C271BA4-C9F6-4736-995F-3D606FBCFDCC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9C271BA4-C9F6-4736-995F-3D606FBCFDCC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9C271BA4-C9F6-4736-995F-3D606FBCFDCC}.Release|Any CPU.ActiveCfg = Release|Any CPU
diff --git a/src/ResourceGraph/ResourceGraph/ChangeLog.md b/src/ResourceGraph/ResourceGraph/ChangeLog.md
index 03b204575204..5e8df496e954 100644
--- a/src/ResourceGraph/ResourceGraph/ChangeLog.md
+++ b/src/ResourceGraph/ResourceGraph/ChangeLog.md
@@ -18,6 +18,9 @@
- Additional information about change #1
-->
## Upcoming Release
+* Added support for the new api version with the ability to query with management group scopes using -ManagementGroup param.
+* Deprecated parameter -Include.
+* Introduced -SkipToken param and aligned max resources returned per page with server value.
## Version 0.8.0
* Added new cmdlets to support query resource
diff --git a/src/ResourceGraph/ResourceGraph/Cmdlets/SearchAzureRmGraph.cs b/src/ResourceGraph/ResourceGraph/Cmdlets/SearchAzureRmGraph.cs
index 083e2b7e74da..403e63f69903 100644
--- a/src/ResourceGraph/ResourceGraph/Cmdlets/SearchAzureRmGraph.cs
+++ b/src/ResourceGraph/ResourceGraph/Cmdlets/SearchAzureRmGraph.cs
@@ -14,10 +14,8 @@
namespace Microsoft.Azure.Commands.ResourceGraph.Cmdlets
{
- using Microsoft.Azure.Commands.Common.Authentication;
using Microsoft.Azure.Commands.Common.Authentication.Abstractions;
using Microsoft.Azure.Commands.ResourceGraph.Utilities;
- using Microsoft.Azure.Internal.Subscriptions.Version2018_06_01;
using Microsoft.Azure.Management.ResourceGraph.Models;
using System;
using System.Collections.Generic;
@@ -28,29 +26,34 @@ namespace Microsoft.Azure.Commands.ResourceGraph.Cmdlets
/// Search-AzGraph cmdlet
///
///
- [Cmdlet(VerbsCommon.Search, ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "Graph"), OutputType(typeof(PSObject))]
+ [Cmdlet(VerbsCommon.Search, ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "Graph", DefaultParameterSetName = "SubscriptionScopedQuery"), OutputType(typeof(PSObject))]
public class SearchAzureRmGraph : ResourceGraphBaseCmdlet
{
///
- /// The synchronize root
+ /// Subscription scoped query parameter set.
///
- private static readonly object SyncRoot = new object();
+ public const string SubscriptionParameterSet = "SubscriptionScopedQuery";
///
- /// Query extension with subscription names
+ /// Tenant scoped query parameter set.
///
- private static string queryExtensionToIncludeNames = null;
+ public const string TenantParameterSet = "TenantScopedQuery";
///
/// The rows per page
///
- private const int RowsPerPage = 1000;
+ private const int MaxRowsPerPage = 1000;
///
/// Maximum number of subscriptions for request
///
private const int SubscriptionLimit = 1000;
+ ///
+ /// Maximum number of management groups for request
+ ///
+ private const int ManagementGroupLimit = 10;
+
///
/// Gets or sets the query.
/// s
@@ -65,20 +68,41 @@ public string Query
///
/// Gets or sets the subscriptions.
///
- [Parameter(Mandatory = false, HelpMessage = "Subscription(s) to run query against")]
+ [Parameter(Mandatory = false, ParameterSetName = SubscriptionParameterSet, HelpMessage = "Subscription(s) to run query against")]
public string[] Subscription
{
get;
set;
}
+ ///
+ /// Gets or sets the management groups.
+ ///
+ [Parameter(Mandatory = false, ParameterSetName = TenantParameterSet, HelpMessage = "Management group(s) to run query against")]
+ public string[] ManagementGroup
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets if query should succeed with partial scopes when total number of scopes exceeds the number allowed on server side.
+ ///
+ [Parameter(Mandatory = false, ParameterSetName = TenantParameterSet,
+ HelpMessage = "Indicates if query should succeed when only partial number of subscription underneath can be processed by server")]
+ public SwitchParameter AllowPartialScope
+ {
+ get;
+ set;
+ }
+
///
/// Gets or sets the first.
///
[Parameter(
Mandatory = false,
HelpMessage = "The maximum number of objects to return. Default value is 100.")]
- [ValidateRange(1, 5000), PSDefaultValue(Value = 100)]
+ [ValidateRange(1, 1000), PSDefaultValue(Value = 100)]
public int First
{
get;
@@ -99,11 +123,10 @@ public int Skip
}
///
- /// Gets or sets if result should be extended with subcription and tenant names.
+ /// Gets or sets the skip token.
/// s
- [Parameter(Mandatory = false, HelpMessage = "Indicates if result should be extended with subcription and tenants names")]
- [PSDefaultValue(Value = IncludeOptionsEnum.None)]
- public IncludeOptionsEnum Include
+ [Parameter(Mandatory = false, HelpMessage = "The skip token to use for getting the next page of results if applicable")]
+ public string SkipToken
{
get;
set;
@@ -114,68 +137,80 @@ public IncludeOptionsEnum Include
///
public override void ExecuteCmdlet()
{
- var subscriptions = this.GetSubscriptions().ToList();
- if (subscriptions == null || subscriptions.Count == 0)
+ var managementGroups = this.ManagementGroup?.ToList();
+ if (managementGroups != null && managementGroups.Count > ManagementGroupLimit)
{
- var exception = new ArgumentException("No subscriptions were found to run query. " +
- "Please try to add them implicitly as param to your request (e.g. Search-AzGraph -Query '' -Subscription '11111111-1111-1111-1111-111111111111')");
-
- var errorRecord = new ErrorRecord(
- exception, "400",
- ErrorCategory.InvalidArgument, null);
- this.WriteError(errorRecord);
- return;
+ managementGroups = managementGroups.Take(ManagementGroupLimit).ToList();
+ this.WriteWarning("The query included more management groups than allowed. " +
+ $"Only the first {ManagementGroupLimit} management groups were included for the results. " +
+ $"To use more than {ManagementGroupLimit} management groups, see the docs for examples: https://aka.ms/arg-error-toomanysubs");
}
- if (subscriptions.Count > SubscriptionLimit)
+ IList subscriptions = null;
+ if (managementGroups == null)
{
- subscriptions = subscriptions.Take(SubscriptionLimit).ToList();
- this.WriteWarning("The query included more subscriptions than allowed. " +
- $"Only the first {SubscriptionLimit} subscriptions were included for the results. " +
- $"To use more than {SubscriptionLimit} subscriptions, see the docs for examples: https://aka.ms/arg-error-toomanysubs");
+ subscriptions = this.GetSubscriptions().ToList();
+ if (subscriptions != null && subscriptions.Count > SubscriptionLimit)
+ {
+ subscriptions = subscriptions.Take(SubscriptionLimit).ToList();
+ this.WriteWarning("The query included more subscriptions than allowed. " +
+ $"Only the first {SubscriptionLimit} subscriptions were included for the results. " +
+ $"To use more than {SubscriptionLimit} subscriptions, see the docs for examples: https://aka.ms/arg-error-toomanysubs");
+ }
}
- var first = this.MyInvocation.BoundParameters.ContainsKey("First") ? this.First : 100;
- var skip = this.MyInvocation.BoundParameters.ContainsKey("Skip") ? this.Skip : 0;
-
var results = new List();
QueryResponse response = null;
var resultTruncated = false;
try
{
- do
+ var skipToken = this.SkipToken;
+ var isSkipTokenPassed = this.MyInvocation.BoundParameters.ContainsKey("SkipToken");
+
+ int? first = null;
+ if (this.MyInvocation.BoundParameters.ContainsKey("First"))
+ {
+ first = Math.Min(First, MaxRowsPerPage);
+ }
+ else if (!isSkipTokenPassed)
{
- var requestTop = Math.Min(first - results.Count, RowsPerPage);
- var requestSkip = skip + results.Count;
- var requestSkipToken = response?.SkipToken;
- this.WriteVerbose($"Sent top={requestTop} skip={requestSkip} skipToken={requestSkipToken}");
+ first = 100;
+ }
- var requestOptions = new QueryRequestOptions(
- top: requestTop,
- skip: requestSkip,
- skipToken: requestSkipToken,
- resultFormat: ResultFormat.ObjectArray);
+ int? skip = null;
+ if (this.MyInvocation.BoundParameters.ContainsKey("Skip"))
+ {
+ skip = this.Skip;
+ }
+ else if (!isSkipTokenPassed)
+ {
+ skip = 0;
+ }
- var queryExtenstion = (this.Include == IncludeOptionsEnum.DisplayNames && this.QueryExtensionInitizalized()) ?
- (queryExtensionToIncludeNames + (this.Query.Length != 0 ? "| " : string.Empty)) :
- string.Empty;
+ var allowPartialScopes = AllowPartialScope.IsPresent;
+ this.WriteVerbose($"Sent top={first} skip={skip} skipToken={skipToken}");
- var request = new QueryRequest(subscriptions, queryExtenstion + this.Query, options: requestOptions);
- response = this.ResourceGraphClient.ResourcesWithHttpMessagesAsync(request)
- .Result
- .Body;
+ var requestOptions = new QueryRequestOptions(
+ top: first,
+ skip: skip,
+ skipToken: skipToken,
+ resultFormat: ResultFormat.ObjectArray,
+ allowPartialScopes: allowPartialScopes);
- if (response.ResultTruncated == ResultTruncated.True)
- {
- resultTruncated = true;
- }
+ var request = new QueryRequest(this.Query, subscriptions, managementGroups, options: requestOptions);
+ response = this.ResourceGraphClient.ResourcesWithHttpMessagesAsync(request)
+ .Result
+ .Body;
- var requestResults = response.Data.ToPsObjects();
- results.AddRange(requestResults);
- this.WriteVerbose($"Received results: {requestResults.Count}");
+ if (response.ResultTruncated == ResultTruncated.True)
+ {
+ resultTruncated = true;
}
- while (results.Count < first && response.SkipToken != null);
+
+ var requestResults = response.Data.ToPsObjects();
+ results.AddRange(requestResults);
+ this.WriteVerbose($"Received results: {requestResults.Count}");
if (resultTruncated && results.Count < first)
{
@@ -230,61 +265,7 @@ private IEnumerable GetSubscriptions()
return accountSubscriptions;
}
- return SubscriptionCache.GetSubscriptions(this.DefaultContext);
- }
-
- ///
- /// Ensure that this.queryExtensionToIncludeNames is initialized
- ///
- ///
- private bool QueryExtensionInitizalized()
- {
- if (queryExtensionToIncludeNames == null)
- {
- lock (SyncRoot)
- {
- if (queryExtensionToIncludeNames == null)
- {
- this.InitializeQueryExtension();
- }
- }
- }
-
- return queryExtensionToIncludeNames != null && queryExtensionToIncludeNames.Length > 0;
- }
-
- ///
- /// Initialize this.queryExtensionToIncludeNames
- ///
- private void InitializeQueryExtension()
- {
- queryExtensionToIncludeNames = string.Empty;
-
- // Query extension with subscription names
- var subscriptionList = this.DefaultContext.Account.GetSubscriptions(this.DefaultProfile);
- if (subscriptionList != null && subscriptionList.Count != 0)
- {
- queryExtensionToIncludeNames =
- $"extend subscriptionDisplayName=case({string.Join(",", subscriptionList.Select(sub => $"subscriptionId=='{sub.Id}', '{sub.Name}'"))},'')";
- }
-
- // Query extension with tenant names
- using (var subscriptionsClient =
- AzureSession.Instance.ClientFactory.CreateArmClient(
- this.DefaultContext, AzureEnvironment.Endpoint.ResourceManager))
- {
- var tenantList = subscriptionsClient.Tenants.List().ToList();
- if (tenantList != null && tenantList.Count != 0)
- {
- if (queryExtensionToIncludeNames.Length > 0)
- {
- queryExtensionToIncludeNames += "| ";
- }
-
- queryExtensionToIncludeNames +=
- $"extend tenantDisplayName=case({string.Join(",", tenantList.Select(tenant => $"tenantId=='{tenant.TenantId}', '{tenant.DisplayName}'"))},'')";
- }
- }
+ return null;
}
}
}
diff --git a/src/ResourceGraph/ResourceGraph/ResourceGraph.csproj b/src/ResourceGraph/ResourceGraph/ResourceGraph.csproj
index fe10b6eb8e2b..94d7f3c74bff 100644
--- a/src/ResourceGraph/ResourceGraph/ResourceGraph.csproj
+++ b/src/ResourceGraph/ResourceGraph/ResourceGraph.csproj
@@ -11,7 +11,7 @@
-
+
\ No newline at end of file
diff --git a/src/ResourceGraph/ResourceGraph/Utilities/IncludeValidValuesEnum.cs b/src/ResourceGraph/ResourceGraph/Utilities/IncludeValidValuesEnum.cs
deleted file mode 100644
index fd3552696237..000000000000
--- a/src/ResourceGraph/ResourceGraph/Utilities/IncludeValidValuesEnum.cs
+++ /dev/null
@@ -1,22 +0,0 @@
-// ----------------------------------------------------------------------------------
-//
-// 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.Utilities
-{
- public enum IncludeOptionsEnum
- {
- None,
- DisplayNames
- }
-}
diff --git a/src/ResourceGraph/ResourceGraph/Utilities/SubscriptionCache.cs b/src/ResourceGraph/ResourceGraph/Utilities/SubscriptionCache.cs
deleted file mode 100644
index 8056bde9ca48..000000000000
--- a/src/ResourceGraph/ResourceGraph/Utilities/SubscriptionCache.cs
+++ /dev/null
@@ -1,72 +0,0 @@
-// ----------------------------------------------------------------------------------
-//
-// 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.Utilities
-{
- using System.Collections.Generic;
- using System.Linq;
- using Microsoft.Azure.Commands.Common.Authentication;
- using Microsoft.Azure.Commands.Common.Authentication.Abstractions;
- using Microsoft.Azure.Internal.Subscriptions.Version2018_06_01;
-
- ///
- /// Subscriptions cache
- ///
- public static class SubscriptionCache
- {
- ///
- /// The synchronize root
- ///
- private static readonly object SyncRoot = new object();
-
- ///
- /// The subscriptions
- ///
- private static List _subscriptions;
-
- ///
- /// Gets the subscriptions.
- ///
- /// The azure context.
- ///
- public static List GetSubscriptions(IAzureContext azureContext)
- {
- if (_subscriptions == null)
- {
- lock (SyncRoot)
- {
- if (_subscriptions == null)
- {
- var subscriptionsClient =
- AzureSession.Instance.ClientFactory.CreateArmClient(
- azureContext, AzureEnvironment.Endpoint.ResourceManager);
-
- var subscriptionList = new List();
- var page = subscriptionsClient.Subscriptions.List();
- subscriptionList.AddRange(page.ToList().Select(s => s.SubscriptionId));
- while (!string.IsNullOrEmpty(page.NextPageLink))
- {
- page = subscriptionsClient.Subscriptions.ListNext(page.NextPageLink);
- subscriptionList.AddRange(page.ToList().Select(s => s.SubscriptionId));
- }
-
- _subscriptions = subscriptionList;
- }
- }
- }
-
- return _subscriptions;
- }
- }
-}
diff --git a/src/ResourceGraph/ResourceGraph/help/Search-AzGraph.md b/src/ResourceGraph/ResourceGraph/help/Search-AzGraph.md
index 9b36fdb5432a..023dbbcf0c84 100644
--- a/src/ResourceGraph/ResourceGraph/help/Search-AzGraph.md
+++ b/src/ResourceGraph/ResourceGraph/help/Search-AzGraph.md
@@ -1,4 +1,4 @@
----
+---
external help file: Microsoft.Azure.PowerShell.Cmdlets.ResourceGraph.dll-Help.xml
Module Name: Az.ResourceGraph
online version: https://docs.microsoft.com/powershell/module/az.resourcegraph/search-azgraph
@@ -12,9 +12,16 @@ Queries the resources managed by Azure Resource Manager.
## SYNTAX
+### SubscriptionScopedQuery (Default)
```
Search-AzGraph [-Query] [-Subscription ] [-First ] [-Skip ]
- [-DefaultProfile ] []
+ [-SkipToken ] [-DefaultProfile ] []
+```
+
+### TenantScopedQuery
+```
+Search-AzGraph [-Query] [-ManagementGroup ] [-AllowPartialScope] [-First ]
+ [-Skip ] [-SkipToken ] [-DefaultProfile ] []
```
## DESCRIPTION
@@ -57,27 +64,56 @@ A complex query on resources featuring field selection, filtering and summarizin
### Example 3
```powershell
-PS C:\> Search-AzGraph -Include DisplayName -Query 'where type =~ "Microsoft.Compute/virtualMachines"| where properties.storageProfile.osDisk.managedDisk == "" | project name, resourceGroup, subscriptionDisplayName'
+PS C:\> Search-AzGraph -Query 'project id, name' -SkipToken 'skiptokenvaluefromthepreviousquery=='
-name resourceGroup subscriptionDisplayName
----- ------------- -----------------------
-ContosoVM RG-Contoso Contoso Production Subscription
+id : /subscriptions/1ef51df4-f8a9-4b69-9919-1ef51df4eff6/resourceGroups/Service-INT-b/providers/Microsoft.Compute/virtualMachineScaleSets/nt2
+name : nt2
+
+id : /subscriptions/1ef51df4-f8a9-4b69-9919-1ef51df4eff6/resourceGroups/Service-INT-b/providers/Microsoft.EventGrid/topics/egtopic-2
+name : egtopic-2
```
-A query featuring all virtual machines which are not using Managed Disks and includes subscription display names.
+
+A query with the skip token passed from the previous query results
### Example 4
```powershell
-PS C:\> Search-AzGraph -Include DisplayName -Query 'summarize count() by tenantDisplayName, subscriptionDisplayName'
+PS C:\> Search-AzGraph -Query 'project id, name, type, location, tags' -First 2 -ManagementGroup 'MyManagementGroupId' -AllowPartialScope
+
-tenantDisplayName subscriptionDisplayName count_
------------------ ----------------------- ------
-ContosoTenant Contoso Production Subscription 118
+id : /subscriptions/1ef51df4-f8a9-4b69-9919-1ef51df4eff6/resourceGroups/Service-INT-a/providers/Microsoft.Compute/virtualMachineScaleSets/nt
+name : nt
+type : microsoft.compute/virtualmachinescalesets
+location : eastus
+tags : @{resourceType=Service Fabric; clusterName=gov-art-int-nt-a}
+
+id : /subscriptions/1ef51df4-f8a9-4b69-9919-1ef51df4eff6/resourceGroups/Service-INT-a/providers/Microsoft.EventGrid/topics/egtopic-1
+name : egtopic-1
+type : microsoft.eventgrid/topics
+location : westus2
+tags :
```
-A query displaying the count of resources by tenant and subscription display names.
+
+A query scoped to the management group that allows the query to succeed with partial scope result if MyManagementGroupId has more than N subscriptions underneath.
+N is max number of subscriptions that can be processed by server.
## PARAMETERS
+### -AllowPartialScope
+Indicates if query should succeed when only partial number of subscriptions underneath can be processed by server
+
+```yaml
+Type: System.Management.Automation.SwitchParameter
+Parameter Sets: TenantScopedQuery
+Aliases:
+
+Required: False
+Position: Named
+Default value: None
+Accept pipeline input: False
+Accept wildcard characters: False
+```
+
### -DefaultProfile
The credentials, account, tenant, and subscription used for communication with Azure.
@@ -93,6 +129,21 @@ Accept pipeline input: False
Accept wildcard characters: False
```
+### -ManagementGroup
+Management group(s) to run query against.
+
+```yaml
+Type: System.String[]
+Parameter Sets: TenantScopedQuery
+Aliases:
+
+Required: False
+Position: Named
+Default value: None
+Accept pipeline input: False
+Accept wildcard characters: False
+```
+
### -Query
Resource Graph query.
@@ -108,12 +159,27 @@ Accept pipeline input: False
Accept wildcard characters: False
```
+### -SkipToken
+The skip token to use for getting the next page of results if applicable.
+
+```yaml
+Type: System.String
+Parameter Sets: (All)
+Aliases:
+
+Required: False
+Position: Named
+Default value: None
+Accept pipeline input: False
+Accept wildcard characters: False
+```
+
### -Subscription
Subscription(s) to run query against.
```yaml
Type: System.String[]
-Parameter Sets: (All)
+Parameter Sets: SubscriptionScopedQuery
Aliases:
Required: False
@@ -139,7 +205,7 @@ Accept wildcard characters: False
```
### -First
-The maximum number of objects to return. Allowed values: 1-5000.
+The maximum number of objects to return. Allowed values: 1-1000.
Default value is 100.
```yaml
@@ -155,7 +221,7 @@ Accept wildcard characters: False
```
### CommonParameters
-This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).
+This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
## INPUTS