Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

possible fix. #859

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
20 changes: 11 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,7 @@
"@azure/ms-rest-azure-env": "^2.0.0",
"@azure/storage-blob": "^12.24.0",
"@microsoft/microsoft-graph-client": "^3.0.7",
"@microsoft/vscode-azext-utils": "^2.5.1",
"@microsoft/vscode-azext-utils": "^2.5.4",
"@octokit/rest": "^21.0.1",
"@vscode/extension-telemetry": "^0.9.7",
"decompress": "^4.2.1",
Expand Down
13 changes: 13 additions & 0 deletions src/tree/azureAccountTreeItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { getCredential, getEnvironment } from "../auth/azureAuth";
import { SelectionType, getSubscriptions } from "../commands/utils/subscriptions";
import { Subscription } from "@azure/arm-resources-subscriptions";
import { AzureSessionProvider, ReadyAzureSessionProvider, isReady } from "../auth/types";
import { TokenCredential } from "@azure/identity";

export function createAzureAccountTreeItem(
sessionProvider: AzureSessionProvider,
Expand Down Expand Up @@ -200,5 +201,17 @@ function getSubscriptionContext(
userId: session.account.id,
environment,
isCustomCloud: environment.name === "AzureCustomCloud",
createCredentialsForScopes: async (scopes: string[]): Promise<TokenCredential> => {
const authSession = await sessionProvider.getAuthSession({ scopes });
if (failed(authSession)) {
throw new Error(`No Microsoft authentication session found: ${authSession.error}`);
}

return {
getToken: async () => {
return { token: authSession.result.accessToken, expiresOnTimestamp: 0 };
Tatsinnit marked this conversation as resolved.
Show resolved Hide resolved
},
};
}
};
}
Loading