From e9f83a8efd8957426bde073c2cedeb730943390e Mon Sep 17 00:00:00 2001 From: Asier Isayas Date: Mon, 8 Jul 2024 16:30:14 -0400 Subject: [PATCH] Set AllowPartialScopes flag to true (#1900) * add partial scopes flag * add partial scopes flag * add partial scopes flag --------- Co-authored-by: Asier Isayas --- src/Contracts/AzureResourceGraph.ts | 3 ++- src/hooks/useSubscriptions.tsx | 18 +++++++----------- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/src/Contracts/AzureResourceGraph.ts b/src/Contracts/AzureResourceGraph.ts index 52120dec5..18eeed5a8 100644 --- a/src/Contracts/AzureResourceGraph.ts +++ b/src/Contracts/AzureResourceGraph.ts @@ -1,7 +1,8 @@ export interface QueryRequestOptions { $skipToken?: string; $top?: number; - subscriptions: string[]; + $allowPartialScopes: boolean; + subscriptions?: string[]; } export interface QueryResponse { diff --git a/src/hooks/useSubscriptions.tsx b/src/hooks/useSubscriptions.tsx index a8e4addf5..ca80a87f5 100644 --- a/src/hooks/useSubscriptions.tsx +++ b/src/hooks/useSubscriptions.tsx @@ -51,17 +51,13 @@ export async function fetchSubscriptionsFromGraph(accessToken: string): Promise< do { const body = { query: subscriptionsQuery, - ...(skipToken - ? { - options: { - $skipToken: skipToken, - } as QueryRequestOptions, - } - : { - options: { - $top: 150, - } as QueryRequestOptions, - }), + options: { + $allowPartialScopes: true, + $top: 150, + ...(skipToken && { + $skipToken: skipToken, + }), + } as QueryRequestOptions, }; const response = await fetch(managementResourceGraphAPIURL, {