Skip to content

Commit cc484e5

Browse files
author
makharch
committed
Fixed null subscriptions exception, added change log
1 parent 914fa40 commit cc484e5

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

src/ResourceGraph/ResourceGraph/ChangeLog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
- Additional information about change #1
1919
-->
2020
## Upcoming Release
21+
* Fixed the output print issue for `Search-AzGraph`. Fixed the issue when Search-AzGraph fails when no subscriptions are stored in the context.
2122

2223
## Version 0.10.0
2324
* Changed output of `Search-AzGraph` to PSResourceGraphResponse which wrapped previous output under Data property.

src/ResourceGraph/ResourceGraph/Cmdlets/SearchAzureRmGraph.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ public override void ExecuteCmdlet()
150150
IList<string> subscriptions = null;
151151
if (managementGroups == null)
152152
{
153-
subscriptions = this.GetSubscriptions().ToList();
153+
subscriptions = this.GetSubscriptions()?.ToList();
154154
if (subscriptions != null && subscriptions.Count > SubscriptionLimit)
155155
{
156156
subscriptions = subscriptions.Take(SubscriptionLimit).ToList();
@@ -262,7 +262,7 @@ private IEnumerable<string> GetSubscriptions()
262262
}
263263

264264
var accountSubscriptions = this.DefaultContext.Account.GetSubscriptions();
265-
if (accountSubscriptions.Length > 0)
265+
if (accountSubscriptions?.Length > 0)
266266
{
267267
return accountSubscriptions;
268268
}

src/ResourceGraph/ResourceGraph/help/Search-AzGraph.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@ A complex query on resources featuring field selection, filtering and summarizin
6464

6565
### Example 3
6666
```powershell
67-
PS C:\> Search-AzGraph -Query 'project id, name' -SkipToken 'skiptokenvaluefromthepreviousquery=='
67+
PS C:\> $response = (Search-AzGraph -Query 'project id, name' -First 1000)
68+
PS C:\> Search-AzGraph -Query 'project id, name' -SkipToken $response.SkipToken
6869
6970
7071
id : /subscriptions/1ef51df4-f8a9-4b69-9919-1ef51df4eff6/resourceGroups/Service-INT-b/providers/Microsoft.Compute/virtualMachineScaleSets/nt2
@@ -74,7 +75,7 @@ id : /subscriptions/1ef51df4-f8a9-4b69-9919-1ef51df4eff6/resourceGroups/
7475
name : egtopic-2
7576
```
7677

77-
A query with the skip token passed from the previous query results
78+
A query with the skip token passed from the previous query results. Please note that keeping id in the results is mandatory to get back a skip token.
7879

7980
### Example 4
8081
```powershell

0 commit comments

Comments
 (0)