Skip to content
Draft
Show file tree
Hide file tree
Changes from 28 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
df0e2f8
Moving toward auth pkg v6
bwateratmsft Oct 27, 2025
5e5315d
Merge branch 'main' into bmw/authV6
bwateratmsft Oct 27, 2025
f347d1f
Engine 106
bwateratmsft Oct 27, 2025
113e82d
Fix mock subscription provider
bwateratmsft Oct 27, 2025
b0a6354
Fix selectSubscriptions
bwateratmsft Oct 27, 2025
8bf992b
Few more fixes
bwateratmsft Oct 27, 2025
3b8e457
Fix focus view TDP
bwateratmsft Oct 27, 2025
b6b606b
Fix one more thing
bwateratmsft Oct 27, 2025
e86152c
Minor changes
bwateratmsft Oct 27, 2025
bc99d99
Commit what I have
bwateratmsft Oct 27, 2025
a314e97
Fixes and refactors
bwateratmsft Oct 28, 2025
4359423
Minimally fix cloud console
bwateratmsft Oct 28, 2025
4ace0db
Build err
bwateratmsft Oct 28, 2025
1c4120d
Delay sending telemetry so we can use cached data
bwateratmsft Oct 28, 2025
66e8086
Dependency updates
bwateratmsft Oct 30, 2025
298fa2f
Ahyup
bwateratmsft Oct 30, 2025
9e3baef
Oh boy...
bwateratmsft Oct 30, 2025
f65146a
Merge branch 'main' into bmw/authV6
bwateratmsft Nov 17, 2025
fe75e7b
Go back to main
bwateratmsft Nov 17, 2025
634048b
Redo after merges
bwateratmsft Nov 17, 2025
f46258c
Should be nodenext
bwateratmsft Nov 17, 2025
10b2b76
We need node 22
bwateratmsft Nov 17, 2025
632635e
Use event
bwateratmsft Nov 17, 2025
e4621f0
Tiny updates
bwateratmsft Nov 17, 2025
e01696e
Fixes
bwateratmsft Nov 17, 2025
6f56d3e
Merge branch 'main' into bmw/authV6
bwateratmsft Nov 20, 2025
0e76bad
Fixes
bwateratmsft Nov 20, 2025
d841bce
Fix super busted lockfile
bwateratmsft Nov 20, 2025
18f6608
Merge branch 'main' into bmw/authV6
bwateratmsft Nov 20, 2025
3c99c9a
Merge branch 'main' into bmw/authV6
bwateratmsft Dec 2, 2025
73f1933
Merge branch 'main' into bmw/authV6
bwateratmsft Dec 4, 2025
1339576
Deps update
bwateratmsft Dec 4, 2025
b1dab72
Impl manual refresh clearing cache
bwateratmsft Dec 4, 2025
60e15bc
Fix lockfile conflict
bwateratmsft Dec 4, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
487 changes: 248 additions & 239 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"icon": "resources/resourceGroup.png",
"aiKey": "0c6ae279ed8443289764825290e4f9e2-1a736e7c-1324-4338-be46-fc2a58ae4d14-7255",
"engines": {
"vscode": "^1.105.0"
"vscode": "^1.106.0"
},
"repository": {
"type": "git",
Expand Down Expand Up @@ -916,7 +916,7 @@
"dependencies": {
"@azure/arm-resources": "^5.2.0",
"@azure/arm-resources-profile-2020-09-01-hybrid": "^2.1.0",
"@microsoft/vscode-azext-azureauth": "^5.1.1",
"@microsoft/vscode-azext-azureauth": "file:../vscode-azuretools/auth/microsoft-vscode-azext-azureauth-6.0.0-alpha.1.tgz",
"@microsoft/vscode-azext-azureutils": "^4.0.0",
"@microsoft/vscode-azext-utils": "^4.0.2",
"form-data": "^4.0.4",
Expand Down
33 changes: 17 additions & 16 deletions src/cloudConsole/cloudConsole.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/

import { TenantIdDescription } from '@azure/arm-resources-subscriptions';
import { AzureSubscriptionProvider, getConfiguredAzureEnv } from '@microsoft/vscode-azext-azureauth';
import { AzureSubscriptionProvider, AzureTenant, getConfiguredAzureEnv } from '@microsoft/vscode-azext-azureauth';
import { IActionContext, IAzureQuickPickItem, IParsedError, callWithTelemetryAndErrorHandlingSync, nonNullProp, parseError } from '@microsoft/vscode-azext-utils';
import * as cp from 'child_process';
import { default as FormData } from 'form-data';
Expand Down Expand Up @@ -262,20 +262,18 @@ export function createCloudConsole(subscriptionProvider: AzureSubscriptionProvid
res.end();
});

if (!await subscriptionProvider.isSignedIn()) {
serverQueue.push({ type: 'log', args: [localize('loggingIn', "Signing in...")] });
try {
if (await subscriptionProvider.signIn()) {
serverQueue.push({ type: 'log', args: [localize('loggingIn', "Signed in successful.")] });
}
} catch (e) {
serverQueue.push({ type: 'log', args: [localize('loggingIn', parseError(e).message)] });
// We used to delay for a second then exit here, but then the user can't read or copy the error message
// await delay(1000);
// serverQueue.push({ type: 'exit' });
updateStatus('Disconnected');
return;
serverQueue.push({ type: 'log', args: [localize('loggingIn', "Signing in...")] });
try {
if (await subscriptionProvider.signIn()) {
serverQueue.push({ type: 'log', args: [localize('loggingIn', "Signed in successful.")] });
}
} catch (e) {
serverQueue.push({ type: 'log', args: [localize('loggingIn', parseError(e).message)] });
// We used to delay for a second then exit here, but then the user can't read or copy the error message
// await delay(1000);
// serverQueue.push({ type: 'exit' });
updateStatus('Disconnected');
return;
}

const env: TerminalOptions['env'] = {
Expand Down Expand Up @@ -336,10 +334,13 @@ export function createCloudConsole(subscriptionProvider: AzureSubscriptionProvid

liveServerQueue = serverQueue;

const tenants = await subscriptionProvider.getTenants();
const tenants: AzureTenant[] = [];
for (const account of await subscriptionProvider.getAccounts({ filter: false })) {
tenants.push(...await subscriptionProvider.getTenantsForAccount(account, { filter: false }));
}
let selectedTenant: TenantIdDescription | undefined = undefined;

const subscriptions = await subscriptionProvider.getSubscriptions(false);
const subscriptions = await subscriptionProvider.getAvailableSubscriptions({ filter: false });
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be reduced to just the getAvailableSubscriptions call

if (tenants.length <= 1) {
serverQueue.push({ type: 'log', args: [localize('foundOneTenant', `Found 1 tenant.`)] });
// if they have only one tenant, use it
Expand Down
1 change: 1 addition & 0 deletions src/commands/accounts/logIn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export async function logIn(_context: IActionContext): Promise<void> {
await provider.signIn();
} finally {
_isLoggingIn = false;
// TODO: do we need this or does the session change event take care of it?
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: Do

ext.actions.refreshAzureTree(); // Refresh now that sign in is complete
ext.actions.refreshTenantTree(); // Refresh now that sign in is complete
}
Expand Down
25 changes: 14 additions & 11 deletions src/commands/accounts/selectSubscriptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.md in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import { AzureSubscription } from "@microsoft/vscode-azext-azureauth";
import { AzureSubscription, isNotSignedInError } from "@microsoft/vscode-azext-azureauth";
import { IActionContext, IAzureQuickPickItem } from "@microsoft/vscode-azext-utils";
import * as vscode from "vscode";
import { ext } from "../../extensionVariables";
Expand All @@ -28,16 +28,15 @@ export interface SelectSubscriptionOptions {

export async function selectSubscriptions(context: IActionContext, options?: SelectSubscriptionOptions): Promise<void> {
const provider = await ext.subscriptionProviderFactory();
if (await provider.isSignedIn()) {

try {
const selectedSubscriptionsWithFullId = await getSelectedTenantAndSubscriptionIds();
const selectedSubscriptionIds = selectedSubscriptionsWithFullId.map(id => id.split('/')[1]);

let subscriptionsShownInPicker: string[] = [];

const subscriptionQuickPickItems: () => Promise<IAzureQuickPickItem<AzureSubscription>[]> = async () => {
// If there are no tenants selected by default all subscriptions will be shown.
let subscriptions = await provider.getSubscriptions(false);
let subscriptions = await provider.getAvailableSubscriptions({ noCache: true, filter: false, });

if (options?.account || options?.tenantId) {

Expand Down Expand Up @@ -89,13 +88,17 @@ export async function selectSubscriptions(context: IActionContext, options?: Sel
}

ext.actions.refreshAzureTree();
} else {
const signIn: vscode.MessageItem = { title: localize('signIn', 'Sign In') };
void vscode.window.showInformationMessage(localize('notSignedIn', 'You are not signed in. Sign in to continue.'), signIn).then((input) => {
if (input === signIn) {
void provider.signIn();
}
});
} catch (error) {
if (isNotSignedInError(error)) {
const signIn: vscode.MessageItem = { title: localize('signIn', 'Sign In') };
void vscode.window.showInformationMessage(localize('notSignedIn', 'You are not signed in. Sign in to continue.'), signIn).then((input) => {
if (input === signIn) {
void provider.signIn();
}
});
} else {
throw error;
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/commands/registerCommands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export function registerCommands(): void {
});

registerCommand('azureTenantsView.signInToTenant', async (_context, node: TenantTreeItem) => {
await (await ext.subscriptionProviderFactory()).signIn(node.tenantId, node.account);
await (await ext.subscriptionProviderFactory()).signIn(node);
ext.actions.refreshTenantTree(node);
});

Expand Down
4 changes: 2 additions & 2 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import { AzureSubscription } from 'api/src';
import { GetApiOptions, apiUtils } from 'api/src/utils/apiUtils';
import * as vscode from 'vscode';
import { AzExtResourceType } from '../api/src/AzExtResourceType';
import { TestApi } from './testApi';
import { DefaultAzureResourceProvider } from './api/DefaultAzureResourceProvider';
import { ResourceGroupsExtensionManager } from './api/ResourceGroupsExtensionManager';
import { ActivityLogResourceProviderManager, AzureResourceProviderManager, TenantResourceProviderManager, WorkspaceResourceProviderManager } from './api/ResourceProviderManagers';
Expand All @@ -36,6 +35,7 @@ import { AzureResourcesApiInternal } from './hostapi.v2.internal';
import { ManagedIdentityBranchDataProvider } from './managedIdentity/ManagedIdentityBranchDataProvider';
import { survey } from './nps';
import { getSubscriptionProviderFactory } from './services/getSubscriptionProviderFactory';
import { TestApi } from './testApi';
import { BranchDataItemCache } from './tree/BranchDataItemCache';
import { HelpTreeItem } from './tree/HelpTreeItem';
import { TreeDataItem } from './tree/ResourceGroupsItem';
Expand Down Expand Up @@ -209,7 +209,7 @@ export async function activate(context: vscode.ExtensionContext, perfStats: { lo
ext.workspaceTree = new CompatibleAzExtTreeDataProvider(workspaceResourceTreeDataProvider);

const getSubscriptions: (filter: boolean) => Promise<AzureSubscription[]> =
async (filter: boolean) => { return await (await ext.subscriptionProviderFactory()).getSubscriptions(filter); };
async (filter: boolean) => { return await (await ext.subscriptionProviderFactory()).getAvailableSubscriptions({ filter }); };

const apiFactories: AzureExtensionApiFactory[] = [
{
Expand Down
2 changes: 1 addition & 1 deletion src/managedIdentity/TargetServiceRoleAssignmentItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export class TargetServiceRoleAssignmentItem implements TreeElementBase {

if (this._loadedAllSubscriptions) {
// filter out this sub since it's already loaded
const subscriptions = (await (await ext.subscriptionProviderFactory()).getSubscriptions(false)).filter(s => s.subscriptionId !== this.subscription.subscriptionId);
const subscriptions = (await (await ext.subscriptionProviderFactory()).getAvailableSubscriptions({ filter: false })).filter(s => s.subscriptionId !== this.subscription.subscriptionId);
await Promise.allSettled(subscriptions.map(async (subscription) => {
children.push(...await createRoleDefinitionsItems(context, subscription, this.msi, this.subscription.subscriptionId));
}));
Expand Down
12 changes: 9 additions & 3 deletions src/services/getSubscriptionProviderFactory.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
import { AzureDevOpsSubscriptionProviderInitializer, AzureSubscriptionProvider, createAzureDevOpsSubscriptionProviderFactory } from "@microsoft/vscode-azext-azureauth";
import { IActionContext } from "@microsoft/vscode-azext-utils";
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.md in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import type { AzureSubscriptionProvider } from "@microsoft/vscode-azext-azureauth";
import { type AzureDevOpsSubscriptionProviderInitializer, createAzureDevOpsSubscriptionProviderFactory } from "@microsoft/vscode-azext-azureauth/azdo";
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should move this out so it's actually in the test code, and thus all the stuff doesn't get bundled.

import type { IActionContext } from "@microsoft/vscode-azext-utils";
import { createVSCodeAzureSubscriptionProviderFactory } from "./VSCodeAzureSubscriptionProvider";

/**
Expand Down Expand Up @@ -32,7 +38,7 @@ export function getSubscriptionProviderFactory(activateContext?: IActionContext)

const initializer: AzureDevOpsSubscriptionProviderInitializer = {
serviceConnectionId,
domain,
tenantId: domain,
clientId,
};
return createAzureDevOpsSubscriptionProviderFactory(initializer);
Expand Down
8 changes: 1 addition & 7 deletions src/tree/ResourceTreeDataProviderBase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,9 @@ export abstract class ResourceTreeDataProviderBase extends vscode.Disposable imp
if (!inCloudShell()) {
// Only outside of Cloud Shell will we monitor for ongoing session changes
// Inside we must avoid due to https://github.com/microsoft/vscode-dev/issues/1334
const one = this.subscriptionProvider.onDidSignIn(() => {
this.statusSubscription = this.subscriptionProvider.onRefreshSuggested(() => {
this.notifyTreeDataChanged();
});

const two = this.subscriptionProvider.onDidSignOut(() => {
this.notifyTreeDataChanged();
});

this.statusSubscription = vscode.Disposable.from(one, two);
}
}

Expand Down
Loading
Loading