Remove Phoenix function GetDbAccountAllowedStatus (#2472)

* Scale the number of test accounts used for SQL tests to one per shard.

* Set PLAYWRIGHT_SHARD_INDEX environment variable in CI workflow.

* Add log statement for the shared index and selected account.

* Remove console log.

* Fix order of accounts so that shard index maps to same account index.

* Try to fix the SQL account scope in ci.yml

* Get tokens for all accounts and use the shard index to pick which one.

* Set tokens without loop.

* Handcode the token use in tests.

* Fix database creation.

* Add debug for rbac token issues.

* Common function for retrieving NoSQL token.

* Disable eslint rule for noconsole temporarily.

* Move getNoSqlRbacToken to separate file.

* Fix ref to new function.

* mock Resource Graph API — fires on auto-subscription selection to populate account dropdown

* Code tidy-up.

* Fix build errors.

* Remove deprecated getDbAccountAllowedStatus from PhoenixClient

The getDbAccountAllowedStatus endpoint is no longer available. All callers
now assume a Forbidden result, meaning isPhoenixNotebooks and
isPhoenixFeatures are always false.

- Remove getDbAccountAllowedStatus() from PhoenixClient
- Simplify getPhoenixStatus() in useNotebook to set both flags to false
- Remove IDbAccountAllow interface from DataModels
- Remove PhoenixDBAccountAllowed and CheckPhoenixStatus telemetry actions
- Clean up unused imports

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Revert removal of enum values, to be safe.

---------

Co-authored-by: Bikram Choudhury <bchoudhury@microsoft.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
jawelton74
2026-05-04 07:24:04 -07:00
committed by GitHub
parent 4e8410cd66
commit a36467f4ea
3 changed files with 6 additions and 85 deletions
-6
View File
@@ -600,12 +600,6 @@ export interface IContainerData {
forwardingId: string; forwardingId: string;
} }
export interface IDbAccountAllow {
status: number;
message?: string;
type?: string;
}
export interface IResponse<T> { export interface IResponse<T> {
status: number; status: number;
data: T; data: T;
+5 -32
View File
@@ -1,15 +1,13 @@
import { isPublicInternetAccessAllowed } from "Common/DatabaseAccountUtility";
import { PhoenixClient } from "Phoenix/PhoenixClient";
import { cloneDeep } from "lodash"; import { cloneDeep } from "lodash";
import create, { UseStore } from "zustand"; import create, { UseStore } from "zustand";
import { AuthType } from "../../AuthType"; import { AuthType } from "../../AuthType";
import * as Constants from "../../Common/Constants"; import * as Constants from "../../Common/Constants";
import { ConnectionStatusType, HttpStatusCodes } from "../../Common/Constants"; import { ConnectionStatusType } from "../../Common/Constants";
import { getErrorMessage } from "../../Common/ErrorHandlingUtils"; import { getErrorMessage } from "../../Common/ErrorHandlingUtils";
import * as Logger from "../../Common/Logger"; import * as Logger from "../../Common/Logger";
import { configContext } from "../../ConfigContext"; import { configContext } from "../../ConfigContext";
import * as DataModels from "../../Contracts/DataModels"; import * as DataModels from "../../Contracts/DataModels";
import { ContainerConnectionInfo, ContainerInfo, PhoenixErrorType } from "../../Contracts/DataModels"; import { ContainerConnectionInfo, ContainerInfo } from "../../Contracts/DataModels";
import { IPinnedRepo } from "../../Juno/JunoClient"; import { IPinnedRepo } from "../../Juno/JunoClient";
import { Action, ActionModifiers } from "../../Shared/Telemetry/TelemetryConstants"; import { Action, ActionModifiers } from "../../Shared/Telemetry/TelemetryConstants";
import * as TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor"; import * as TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
@@ -309,34 +307,9 @@ export const useNotebook: UseStore<NotebookState> = create((set, get) => ({
setContainerStatus: (containerStatus: ContainerInfo) => set({ containerStatus }), setContainerStatus: (containerStatus: ContainerInfo) => set({ containerStatus }),
getPhoenixStatus: async () => { getPhoenixStatus: async () => {
if (get().isPhoenixNotebooks === undefined || get().isPhoenixFeatures === undefined) { if (get().isPhoenixNotebooks === undefined || get().isPhoenixFeatures === undefined) {
const startKey = TelemetryProcessor.traceStart(Action.CheckPhoenixStatus, { // getDbAccountAllowedStatus has been deprecated; Phoenix features are no longer available.
dataExplorerArea: "Notebook", set({ isPhoenixNotebooks: false });
}); set({ isPhoenixFeatures: false });
let isPhoenixNotebooks = false;
let isPhoenixFeatures = false;
const isPublicInternetAllowed = isPublicInternetAccessAllowed();
const phoenixClient = new PhoenixClient(userContext?.databaseAccount?.id);
const dbAccountAllowedInfo = await phoenixClient.getDbAccountAllowedStatus();
if (dbAccountAllowedInfo.status === HttpStatusCodes.OK) {
if (dbAccountAllowedInfo?.type === PhoenixErrorType.PhoenixFlightFallback) {
isPhoenixNotebooks = isPublicInternetAllowed && userContext.features.phoenixNotebooks === true;
isPhoenixFeatures =
isPublicInternetAllowed &&
// phoenix needs to be enabled for Postgres and VCoreMongo accounts since the PSQL and mongo shell requires phoenix containers
(userContext.features.phoenixFeatures === true ||
userContext.apiType === "Postgres" ||
userContext.apiType === "VCoreMongo");
} else {
isPhoenixNotebooks = isPhoenixFeatures = isPublicInternetAllowed;
}
} else {
isPhoenixNotebooks = isPhoenixFeatures = false;
}
set({ isPhoenixNotebooks: isPhoenixNotebooks });
set({ isPhoenixFeatures: isPhoenixFeatures });
TelemetryProcessor.traceSuccess(Action.CheckPhoenixStatus, { isPhoenixNotebooks, isPhoenixFeatures }, startKey);
} }
}, },
setIsPhoenixNotebooks: (isPhoenixNotebooks: boolean) => set({ isPhoenixNotebooks: isPhoenixNotebooks }), setIsPhoenixNotebooks: (isPhoenixNotebooks: boolean) => set({ isPhoenixNotebooks: isPhoenixNotebooks }),
+1 -47
View File
@@ -12,13 +12,12 @@ import {
HttpStatusCodes, HttpStatusCodes,
Notebook, Notebook,
} from "../Common/Constants"; } from "../Common/Constants";
import { getErrorMessage, getErrorStack } from "../Common/ErrorHandlingUtils"; import { getErrorMessage } from "../Common/ErrorHandlingUtils";
import * as Logger from "../Common/Logger"; import * as Logger from "../Common/Logger";
import { import {
ContainerConnectionInfo, ContainerConnectionInfo,
ContainerInfo, ContainerInfo,
IContainerData, IContainerData,
IDbAccountAllow,
IMaxAllocationTimeExceeded, IMaxAllocationTimeExceeded,
IPhoenixConnectionInfoResult, IPhoenixConnectionInfoResult,
IPhoenixError, IPhoenixError,
@@ -196,51 +195,6 @@ export class PhoenixClient {
} }
} }
public async getDbAccountAllowedStatus(): Promise<IDbAccountAllow> {
const startKey = TelemetryProcessor.traceStart(Action.PhoenixDBAccountAllowed, {
dataExplorerArea: Areas.Notebook,
});
let responseJson;
try {
const response = await window.fetch(`${this.getPhoenixControlPlanePathPrefix()}`, {
method: "GET",
headers: PhoenixClient.getHeaders(),
});
responseJson = await response?.json();
if (response.status !== HttpStatusCodes.OK) {
throw new Error(`Received status code: ${response?.status}`);
}
TelemetryProcessor.traceSuccess(
Action.PhoenixDBAccountAllowed,
{
dataExplorerArea: Areas.Notebook,
},
startKey,
);
return {
status: response.status,
message: responseJson?.message,
type: responseJson?.type,
};
} catch (error) {
TelemetryProcessor.traceFailure(
Action.PhoenixDBAccountAllowed,
{
dataExplorerArea: Areas.Notebook,
error: getErrorMessage(error),
errorStack: getErrorStack(error),
},
startKey,
);
Logger.logError(getErrorMessage(error), "PhoenixClient/IsDbAcountWhitelisted");
return {
status: HttpStatusCodes.Forbidden,
message: responseJson?.message,
type: responseJson?.type,
};
}
}
private getPhoenixControlPlanePathPrefix(): string { private getPhoenixControlPlanePathPrefix(): string {
if (!this.armResourceId) { if (!this.armResourceId) {
throw new Error("The Phoenix client was not initialized properly: missing ARM resource id"); throw new Error("The Phoenix client was not initialized properly: missing ARM resource id");