Add Log analytics Resource AAD Token (#15099)

* Added Azure Log Analytics resource for generating AAD Token.

* Fixed AzureResource

* Removed debug code from connectionManagementService

* Moved AzureLogAnalytics from AzureResource enum in azdata.d.ts to azdata.proposed.d.ts.  Added azureLogAnalyticsResource to all azureSettings in providerSettings.ts

* Updated endpoint for generating AAD Token for LogAnalytics for UsGov, UsNat, and China

* Removed azureMonitor resource from germanyCloud in providerSettings

* Added missing resources to AzureResource in account interfaces.

* Added comment linking enums for AzureResource
This commit is contained in:
Justin M
2021-05-10 15:05:53 -07:00
committed by GitHub
parent 676296fbbb
commit c68b359aaa
7 changed files with 49 additions and 4 deletions

View File

@@ -73,6 +73,10 @@ export abstract class AzureAuth implements vscode.Disposable {
this.resources = this.resources.concat(this.metadata.settings.azureDevOpsResource);
}
if (this.metadata.settings.azureLogAnalyticsResource) {
this.resources = this.resources.concat(this.metadata.settings.azureLogAnalyticsResource);
}
this.scopes = [...this.metadata.settings.scopes];
this.scopesString = this.scopes.join(' ');
}

View File

@@ -17,7 +17,8 @@ const enum SettingIds {
sql = 'sql',
ossrdbms = 'ossrdbms',
vault = 'vault',
ado = 'ado'
ado = 'ado',
ala = 'ala'
}
const publicAzureSettings: ProviderSettings = {
@@ -68,6 +69,11 @@ const publicAzureSettings: ProviderSettings = {
endpoint: '499b84ac-1321-427f-aa17-267ca6975798',
azureResourceId: AzureResource.AzureDevOps,
},
azureLogAnalyticsResource: {
id: SettingIds.ala,
endpoint: 'https://api.loganalytics.io',
azureResourceId: AzureResource.AzureLogAnalytics,
},
redirectUri: 'https://vscode-redirect.azurewebsites.net/',
scopes: [
'openid', 'email', 'profile', 'offline_access',
@@ -117,6 +123,11 @@ const usGovAzureSettings: ProviderSettings = {
endpoint: 'https://vault.usgovcloudapi.net',
azureResourceId: AzureResource.AzureKeyVault
},
azureLogAnalyticsResource: {
id: SettingIds.ala,
endpoint: 'https://api.loganalytics.us',
azureResourceId: AzureResource.AzureLogAnalytics,
},
redirectUri: 'https://vscode-redirect.azurewebsites.net/',
scopes: [
'openid', 'email', 'profile', 'offline_access',
@@ -165,6 +176,11 @@ const usNatAzureSettings: ProviderSettings = {
endpoint: 'https://vault.cloudapi.eaglex.ic.gov',
azureResourceId: AzureResource.AzureKeyVault
},
azureLogAnalyticsResource: {
id: SettingIds.ala,
endpoint: 'https://api.loganalytics.azure.eaglex.ic.gov',
azureResourceId: AzureResource.AzureLogAnalytics,
},
redirectUri: 'https://vscode-redirect.azurewebsites.net/',
scopes: [
'openid', 'email', 'profile', 'offline_access',
@@ -237,6 +253,11 @@ const chinaAzureSettings: ProviderSettings = {
endpoint: 'https://vault.azure.cn',
azureResourceId: AzureResource.AzureKeyVault
},
azureLogAnalyticsResource: {
id: SettingIds.ala,
endpoint: 'https://api.loganalytics.azure.cn',
azureResourceId: AzureResource.AzureLogAnalytics,
},
redirectUri: 'https://vscode-redirect.azurewebsites.net/'
}

View File

@@ -118,6 +118,11 @@ declare module 'azurecore' {
*/
azureDevOpsResource?: Resource;
/**
* Information that describes the Azure Log Analytics resource
*/
azureLogAnalyticsResource?: Resource;
/**
* A list of tenant IDs to authenticate against. If defined, then these IDs will be used
* instead of querying the tenants endpoint of the armResource

View File

@@ -789,6 +789,13 @@ declare module 'azdata' {
delete?: boolean;
}
export enum AzureResource {
/**
* Azure Log Analytics
*/
AzureLogAnalytics = 8
}
export interface ButtonProperties {
/**
* Specifies whether to use expanded layout or not.

View File

@@ -47,12 +47,18 @@ export interface IAccountManagementService {
readonly updateAccountListEvent: Event<UpdateAccountListEventParams>;
}
// API sqlExtHostTypes.ts > AzureResource should also be updated
// Enum matching the AzureResource enum from azdata.d.ts
export enum AzureResource {
ResourceManagement = 0,
Sql = 1,
OssRdbms = 2,
AzureKeyVault = 3
AzureKeyVault = 3,
Graph = 4,
MicrosoftResourceManagement = 5,
AzureDevOps = 6,
MsGraph = 7,
AzureLogAnalytics = 8
}
export interface IAccountStore {

View File

@@ -425,6 +425,7 @@ export class TreeComponentItem extends vsExtTypes.TreeItem {
checked?: boolean;
}
// Accounts interfaces.ts > AzureResource should also be updated
export enum AzureResource {
ResourceManagement = 0,
Sql = 1,
@@ -433,7 +434,8 @@ export enum AzureResource {
Graph = 4,
MicrosoftResourceManagement = 5,
AzureDevOps = 6,
MsGraph = 7
MsGraph = 7,
AzureLogAnalytics = 8
}
export class TreeItem extends vsExtTypes.TreeItem {

View File

@@ -75,7 +75,7 @@ export class ConnectionManagementService extends Disposable implements IConnecti
private static readonly CONNECTION_MEMENTO = 'ConnectionManagement';
private static readonly _azureResources: AzureResource[] =
[AzureResource.ResourceManagement, AzureResource.Sql, AzureResource.OssRdbms];
[AzureResource.ResourceManagement, AzureResource.Sql, AzureResource.OssRdbms, AzureResource.AzureLogAnalytics];
constructor(
@IConnectionDialogService private _connectionDialogService: IConnectionDialogService,