mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
Add more debug console logs so we can assist users better (#9907)
This commit is contained in:
@@ -176,6 +176,7 @@ export abstract class AzureAuth implements vscode.Disposable {
|
||||
|
||||
public async getSecurityToken(account: azdata.Account, azureResource: azdata.AzureResource): Promise<TokenResponse | undefined> {
|
||||
if (account.isStale === true) {
|
||||
console.log('Account was stale, no tokens being fetched');
|
||||
return undefined;
|
||||
}
|
||||
|
||||
@@ -183,6 +184,7 @@ export abstract class AzureAuth implements vscode.Disposable {
|
||||
if (!resource) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const azureAccount = account as AzureAccount;
|
||||
const response: TokenResponse = {};
|
||||
|
||||
@@ -213,17 +215,21 @@ export abstract class AzureAuth implements vscode.Disposable {
|
||||
|
||||
const baseToken = await this.getCachedToken(account.key);
|
||||
if (!baseToken) {
|
||||
account.isStale = true;
|
||||
console.log('Base token was empty, account is stale.');
|
||||
return undefined;
|
||||
}
|
||||
try {
|
||||
await this.refreshAccessToken(account.key, baseToken.refreshToken, tenant, resource);
|
||||
} catch (ex) {
|
||||
console.log(ex);
|
||||
account.isStale = true;
|
||||
return undefined;
|
||||
}
|
||||
|
||||
cachedTokens = await this.getCachedToken(account.key, resource.id, tenant.id);
|
||||
if (!cachedTokens) {
|
||||
console.log('Refresh access tokens didn not set cache');
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
@@ -326,6 +332,10 @@ export abstract class AzureAuth implements vscode.Disposable {
|
||||
}
|
||||
const allSubs: Subscription[] = [];
|
||||
const tokens = await this.getSecurityToken(account, azdata.AzureResource.ResourceManagement);
|
||||
if (!tokens) {
|
||||
console.log('There were no resource management tokens to retrieve subscriptions from. Account is stale.');
|
||||
account.isStale = true;
|
||||
}
|
||||
|
||||
for (const tenant of account.properties.tenants) {
|
||||
const token = tokens[tenant.id];
|
||||
|
||||
Reference in New Issue
Block a user