Revert enableAADDataPlane feature flag behavior
This commit is contained in:
parent
5a16eec29d
commit
37ebe7577b
|
@ -18,10 +18,11 @@ const _global = typeof self === "undefined" ? window : self;
|
|||
export const tokenProvider = async (requestInfo: Cosmos.RequestInfo) => {
|
||||
const { verb, resourceId, resourceType, headers } = requestInfo;
|
||||
|
||||
const aadDataPlaneFeatureEnabled =
|
||||
userContext.features.enableAadDataPlane && userContext.databaseAccount.properties.disableLocalAuth;
|
||||
const dataPlaneRBACOptionEnabled = userContext.dataPlaneRbacEnabled && userContext.apiType === "SQL";
|
||||
if (aadDataPlaneFeatureEnabled || (!userContext.features.enableAadDataPlane && dataPlaneRBACOptionEnabled)) {
|
||||
if (
|
||||
userContext.features.enableAadDataPlane ||
|
||||
(!userContext.features.enableAadDataPlane && dataPlaneRBACOptionEnabled)
|
||||
) {
|
||||
Logger.logInfo(
|
||||
`AAD Data Plane Feature flag set to ${userContext.features.enableAadDataPlane} for account with disable local auth ${userContext.databaseAccount.properties.disableLocalAuth} `,
|
||||
"Explorer/tokenProvider",
|
||||
|
|
|
@ -27,7 +27,7 @@ import {
|
|||
} from "Shared/StorageUtility";
|
||||
import * as StringUtility from "Shared/StringUtility";
|
||||
import { updateUserContext, userContext } from "UserContext";
|
||||
import { logConsoleInfo } from "Utils/NotificationConsoleUtils";
|
||||
import { logConsoleError, logConsoleInfo } from "Utils/NotificationConsoleUtils";
|
||||
import * as PriorityBasedExecutionUtils from "Utils/PriorityBasedExecutionUtils";
|
||||
import { useQueryCopilot } from "hooks/useQueryCopilot";
|
||||
import { useSidePanel } from "hooks/useSidePanel";
|
||||
|
@ -172,12 +172,17 @@ export const SettingsPane: FunctionComponent<{ explorer: Explorer }> = ({
|
|||
});
|
||||
const { databaseAccount: account, subscriptionId, resourceGroup } = userContext;
|
||||
if (!userContext.features.enableAadDataPlane) {
|
||||
const keys: DatabaseAccountListKeysResult = await listKeys(subscriptionId, resourceGroup, account.name);
|
||||
try {
|
||||
const keys: DatabaseAccountListKeysResult = await listKeys(subscriptionId, resourceGroup, account.name);
|
||||
|
||||
if (keys.primaryMasterKey) {
|
||||
updateUserContext({ masterKey: keys.primaryMasterKey });
|
||||
if (keys.primaryMasterKey) {
|
||||
updateUserContext({ masterKey: keys.primaryMasterKey });
|
||||
|
||||
useDataPlaneRbac.setState({ dataPlaneRbacEnabled: false });
|
||||
useDataPlaneRbac.setState({ dataPlaneRbacEnabled: false });
|
||||
}
|
||||
} catch (error) {
|
||||
logConsoleError(`Error occurred fetching keys for the account." ${error.message}`);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -338,18 +338,6 @@ async function configureHostedWithAAD(config: AAD): Promise<Explorer> {
|
|||
);
|
||||
await fetchAndUpdateKeys(subscriptionId, resourceGroup, account.name);
|
||||
}
|
||||
} else {
|
||||
Logger.logInfo(
|
||||
`AAD Feature flag is enabled for account ${account.name} with disable local auth set to ${account.properties.disableLocalAuth} `,
|
||||
"Explorer/configureHostedWithAAD",
|
||||
);
|
||||
if (!account.properties.disableLocalAuth) {
|
||||
Logger.logInfo(
|
||||
`Fetching keys for ${userContext.apiType} account ${account.name} with AAD data plane feature enabled`,
|
||||
"Explorer/configureHostedWithAAD",
|
||||
);
|
||||
await fetchAndUpdateKeys(subscriptionId, resourceGroup, account.name);
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
if (userContext.features.enableAadDataPlane) {
|
||||
|
@ -470,7 +458,6 @@ async function fetchAndUpdateKeys(subscriptionId: string, resourceGroup: string,
|
|||
Logger.logInfo(`Fetching keys for ${userContext.apiType} account ${account}`, "Explorer/fetchAndUpdateKeys");
|
||||
const keys = await listKeys(subscriptionId, resourceGroup, account);
|
||||
Logger.logInfo(`Keys fetched for ${userContext.apiType} account ${account}`, "Explorer/fetchAndUpdateKeys");
|
||||
|
||||
updateUserContext({
|
||||
masterKey: keys.primaryMasterKey,
|
||||
});
|
||||
|
@ -479,7 +466,7 @@ async function fetchAndUpdateKeys(subscriptionId: string, resourceGroup: string,
|
|||
"Explorer/fetchAndUpdateKeys",
|
||||
);
|
||||
} catch (error) {
|
||||
console.error("Error during fetching keys or updating user context:", error);
|
||||
logConsoleError(`Error occurred fetching keys for the account." ${error.message}`);
|
||||
Logger.logError(
|
||||
`Error during fetching keys or updating user context: ${error} for ${userContext.apiType} account ${account}`,
|
||||
"Explorer/fetchAndUpdateKeys",
|
||||
|
|
Loading…
Reference in New Issue