Removes feature flag from passing masterKey to SDK (#843)

* Remove Feature flag from master key usage

* Adds flag to fallback

* format
This commit is contained in:
Zachary Foster 2021-05-28 08:12:33 -04:00 committed by GitHub
parent 5417e1e120
commit 69b8196cf0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 2 deletions

View File

@ -83,7 +83,7 @@ export function client(): Cosmos.CosmosClient {
if (_client) return _client; if (_client) return _client;
const options: Cosmos.CosmosClientOptions = { const options: Cosmos.CosmosClientOptions = {
endpoint: endpoint() || "https://cosmos.azure.com", // CosmosClient gets upset if we pass a bad URL. This should never actually get called endpoint: endpoint() || "https://cosmos.azure.com", // CosmosClient gets upset if we pass a bad URL. This should never actually get called
...(!userContext.features.enableAadDataPlane && { key: userContext.masterKey }), key: userContext.masterKey,
tokenProvider, tokenProvider,
connectionPolicy: { connectionPolicy: {
enableEndpointDiscovery: false, enableEndpointDiscovery: false,

View File

@ -106,7 +106,11 @@ async function configureHostedWithAAD(config: AAD, explorerParams: ExplorerParam
try { try {
keys = await listKeys(subscriptionId, resourceGroup, account.name); keys = await listKeys(subscriptionId, resourceGroup, account.name);
} catch (e) { } catch (e) {
console.warn(e); if (userContext.features.enableAadDataPlane) {
console.warn(e);
} else {
throw new Error(`List keys failed: ${e.message}`);
}
} }
updateUserContext({ updateUserContext({
subscriptionId, subscriptionId,