mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-17 11:01:37 -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> {
|
public async getSecurityToken(account: azdata.Account, azureResource: azdata.AzureResource): Promise<TokenResponse | undefined> {
|
||||||
if (account.isStale === true) {
|
if (account.isStale === true) {
|
||||||
|
console.log('Account was stale, no tokens being fetched');
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -183,6 +184,7 @@ export abstract class AzureAuth implements vscode.Disposable {
|
|||||||
if (!resource) {
|
if (!resource) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
const azureAccount = account as AzureAccount;
|
const azureAccount = account as AzureAccount;
|
||||||
const response: TokenResponse = {};
|
const response: TokenResponse = {};
|
||||||
|
|
||||||
@@ -213,17 +215,21 @@ export abstract class AzureAuth implements vscode.Disposable {
|
|||||||
|
|
||||||
const baseToken = await this.getCachedToken(account.key);
|
const baseToken = await this.getCachedToken(account.key);
|
||||||
if (!baseToken) {
|
if (!baseToken) {
|
||||||
|
account.isStale = true;
|
||||||
|
console.log('Base token was empty, account is stale.');
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
await this.refreshAccessToken(account.key, baseToken.refreshToken, tenant, resource);
|
await this.refreshAccessToken(account.key, baseToken.refreshToken, tenant, resource);
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
|
console.log(ex);
|
||||||
account.isStale = true;
|
account.isStale = true;
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
cachedTokens = await this.getCachedToken(account.key, resource.id, tenant.id);
|
cachedTokens = await this.getCachedToken(account.key, resource.id, tenant.id);
|
||||||
if (!cachedTokens) {
|
if (!cachedTokens) {
|
||||||
|
console.log('Refresh access tokens didn not set cache');
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -326,6 +332,10 @@ export abstract class AzureAuth implements vscode.Disposable {
|
|||||||
}
|
}
|
||||||
const allSubs: Subscription[] = [];
|
const allSubs: Subscription[] = [];
|
||||||
const tokens = await this.getSecurityToken(account, azdata.AzureResource.ResourceManagement);
|
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) {
|
for (const tenant of account.properties.tenants) {
|
||||||
const token = tokens[tenant.id];
|
const token = tokens[tenant.id];
|
||||||
|
|||||||
Reference in New Issue
Block a user