AzureMonitor: Update supported namespaces (#50788) and filter resources by the right type (#50880)

This commit is contained in:
Andres Martinez Gotor 2022-06-17 10:15:20 +02:00 committed by GitHub
parent 642b7b1eb8
commit 1f0c951bce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 884 additions and 907 deletions

View File

@ -1,2 +1,4 @@
export * from './locations';
export * from './resourceTypes';
export * from './logsResourceTypes';
export * from './metricNamespaces';

View File

@ -0,0 +1,195 @@
/**
This list is obtained parsing https://docs.microsoft.com/en-us/azure/azure-monitor/essentials/resource-logs-categories
To programatically get the list, execute in the browser console:
const i = [];
document.querySelectorAll('*[id]').forEach((el) => {
if(el.textContent.match(/^(microsoft|Microsoft|Wandisco)/)) {
i.push(el.textContent.toLowerCase())
}});
i;
Note: Validate that the output makes sense, the format of the page may change.
That list is not complete so we should merge it with the one below. You can do with a node console:
const u = require('lodash')
const new = [list from above]
const logsResourceTypes = [this list]
console.dir(u.uniq(logsResourceTypes.concat(new)).sort(), {'maxArrayLength': null})
*/
export const logsResourceTypes = [
'microsoft.aad/domainservices',
'microsoft.aadiam/azureadmetrics',
'microsoft.aadiam/tenants',
'microsoft.agfoodplatform/farmbeats',
'microsoft.analysisservices/servers',
'microsoft.apimanagement/service',
'microsoft.appconfiguration/configurationstores',
'microsoft.appplatform/spring',
'microsoft.attestation/attestationproviders',
'microsoft.automation/automationaccounts',
'microsoft.autonomousdevelopmentplatform/accounts',
'microsoft.autonomousdevelopmentplatform/datapools',
'microsoft.autonomousdevelopmentplatform/workspaces',
'microsoft.avs/privateclouds',
'microsoft.azurestackresourcemonitor/storageaccountmonitor',
'microsoft.batch/batchaccounts',
'microsoft.batchai/workspaces',
'microsoft.blockchain/blockchainmembers',
'microsoft.blockchain/cordamembers',
'microsoft.botservice/botservices',
'microsoft.cache/redis',
'microsoft.cache/redisenterprise',
'microsoft.cdn/cdnwebapplicationfirewallpolicies',
'microsoft.cdn/profiles',
'microsoft.cdn/profiles/endpoints',
'microsoft.classiccompute/domainnames',
'microsoft.classiccompute/virtualmachines',
'microsoft.classicnetwork/networksecuritygroups',
'microsoft.classicstorage/storageaccounts',
'microsoft.cognitiveservices/accounts',
'microsoft.communication/communicationservices',
'microsoft.compute/disks',
'microsoft.compute/virtualmachines',
'microsoft.compute/virtualmachinescalesets',
'microsoft.connectedcache/cachenodes',
'microsoft.connectedvehicle/platformaccounts',
'microsoft.containerinstance/containergroups',
'microsoft.containerregistry/registries',
'microsoft.containerservice/managedclusters',
'microsoft.customerinsights/hubs',
'microsoft.customproviders/resourceproviders',
'microsoft.d365customerinsights/instances',
'microsoft.dashboard/grafana',
'microsoft.databoxedge/databoxedgedevices',
'microsoft.databricks/workspaces',
'microsoft.datacollaboration/workspaces',
'microsoft.datafactory/datafactories',
'microsoft.datafactory/factories',
'microsoft.datalakeanalytics/accounts',
'microsoft.datalakestore/accounts',
'microsoft.datashare/accounts',
'microsoft.dbformariadb/servers',
'microsoft.dbformysql/flexibleservers',
'microsoft.dbformysql/servers',
'microsoft.dbforpostgresql/flexibleservers',
'microsoft.dbforpostgresql/servergroupsv2',
'microsoft.dbforpostgresql/servers',
'microsoft.dbforpostgresql/serversv2',
'microsoft.desktopvirtualization/applicationgroups',
'microsoft.desktopvirtualization/hostpools',
'microsoft.desktopvirtualization/scalingplans',
'microsoft.desktopvirtualization/workspaces',
'microsoft.devices/elasticpools/iothubtenants',
'microsoft.devices/iothubs',
'microsoft.devices/provisioningservices',
'microsoft.digitaltwins/digitaltwinsinstances',
'microsoft.documentdb/cassandraclusters',
'microsoft.documentdb/databaseaccounts',
'microsoft.eventgrid/domains',
'microsoft.eventgrid/partnernamespaces',
'microsoft.eventgrid/partnertopics',
'microsoft.eventgrid/systemtopics',
'microsoft.eventgrid/topics',
'microsoft.eventhub/clusters',
'microsoft.eventhub/namespaces',
'microsoft.experimentation/experimentworkspaces',
'microsoft.fabric.admin/fabriclocations',
'microsoft.hdinsight/clusters',
'microsoft.healthcareapis/services',
'microsoft.healthcareapis/workspaces/dicomservices',
'microsoft.healthcareapis/workspaces/fhirservices',
'microsoft.insights/autoscalesettings',
'microsoft.insights/components',
'microsoft.insights/qos',
'microsoft.iotcentral/iotapps',
'microsoft.keyvault/managedhsms',
'microsoft.keyvault/vaults',
'microsoft.kubernetes/connectedclusters',
'microsoft.kusto/clusters',
'microsoft.logic/integrationaccounts',
'microsoft.logic/integrationserviceenvironments',
'microsoft.logic/workflows',
'microsoft.machinelearningservices/workspaces',
'microsoft.media/mediaservices',
'microsoft.media/mediaservices/liveevents',
'microsoft.media/mediaservices/streamingendpoints',
'microsoft.media/videoanalyzers',
'microsoft.netapp/netappaccounts/capacitypools',
'microsoft.netapp/netappaccounts/capacitypools/volumes',
'microsoft.network/applicationgateways',
'microsoft.network/azurefirewalls',
'microsoft.network/bastionhosts',
'microsoft.network/connections',
'microsoft.network/dnszones',
'microsoft.network/expressroutecircuits',
'microsoft.network/expressroutegateways',
'microsoft.network/expressrouteports',
'microsoft.network/frontdoors',
'microsoft.network/loadbalancers',
'microsoft.network/natgateways',
'microsoft.network/networkinterfaces',
'microsoft.network/networksecuritygroups',
'microsoft.network/networksecurityperimeters',
'microsoft.network/networkvirtualappliances',
'microsoft.network/networkwatchers',
'microsoft.network/networkwatchers/connectionmonitors',
'microsoft.network/p2svpngateways',
'microsoft.network/privateendpoints',
'microsoft.network/privatelinkservices',
'microsoft.network/publicipaddresses',
'microsoft.network/trafficmanagerprofiles',
'microsoft.network/virtualnetworkgateways',
'microsoft.network/virtualnetworks',
'microsoft.network/vpngateways',
'microsoft.networkfunction/azuretrafficcollectors',
'microsoft.notificationhubs/namespaces',
'microsoft.notificationhubs/namespaces/notificationhubs',
'microsoft.openlogisticsplatform/workspaces',
'microsoft.operationalinsights/workspaces',
'microsoft.operationsmanagement/solutions',
'microsoft.peering/peeringservices',
'microsoft.powerbi/tenants',
'microsoft.powerbi/tenants/workspaces',
'microsoft.powerbidedicated/capacities',
'microsoft.purview/accounts',
'microsoft.recoveryservices/vaults',
'microsoft.relay/namespaces',
'microsoft.resources/subscriptions',
'microsoft.resources/subscriptions/resourcegroups',
'microsoft.search/searchservices',
'microsoft.securityinsights/settings',
'microsoft.servicebus/namespaces',
'microsoft.signalrservice/signalr',
'microsoft.signalrservice/webpubsub',
'microsoft.singularity/accounts',
'microsoft.sql/managedinstances',
'microsoft.sql/managedinstances/databases',
'microsoft.sql/servers/databases',
'microsoft.sql/servers/elasticpools',
'microsoft.storage/storageaccounts',
'microsoft.storage/storageaccounts/blobservices',
'microsoft.storage/storageaccounts/fileservices',
'microsoft.storage/storageaccounts/queueservices',
'microsoft.storage/storageaccounts/tableservices',
'microsoft.storagecache/caches',
'microsoft.storagesync/storagesyncservices',
'microsoft.streamanalytics/streamingjobs',
'microsoft.synapse/workspaces',
'microsoft.synapse/workspaces/bigdatapools',
'microsoft.synapse/workspaces/kustopools',
'microsoft.synapse/workspaces/scopepools',
'microsoft.synapse/workspaces/sqlpools',
'microsoft.timeseriesinsights/environments',
'microsoft.timeseriesinsights/environments/eventsources',
'microsoft.videoindexer/accounts',
'microsoft.vmwarecloudsimple/virtualmachines',
'microsoft.web/hostingenvironments',
'microsoft.web/hostingenvironments/workerpools',
'microsoft.web/serverfarms',
'microsoft.web/sites',
'microsoft.web/sites/slots',
];

View File

@ -0,0 +1,175 @@
/**
This list is obtained parsing https://docs.microsoft.com/en-us/azure/azure-monitor/essentials/metrics-supported
To programatically get the list, execute in the browser console:
const i = [];
document.querySelectorAll('*[id]').forEach((el) => {
if(el.textContent.match(/^(microsoft|Microsoft|Wandisco)/)) {
i.push(el.textContent)
}});
i;
Note: Validate that the output makes sense, the format of the page may change.
*/
export const supportedMetricNamespaces = [
'microsoft.aadiam/azureADMetrics',
'Microsoft.AnalysisServices/servers',
'Microsoft.ApiManagement/service',
'Microsoft.AppConfiguration/configurationStores',
'Microsoft.AppPlatform/Spring',
'Microsoft.Automation/automationAccounts',
'microsoft.avs/privateClouds',
'Microsoft.Batch/batchAccounts',
'Microsoft.BatchAI/workspaces',
'microsoft.bing/accounts',
'Microsoft.Blockchain/blockchainMembers',
'microsoft.botservice/botservices',
'Microsoft.Cache/redis',
'Microsoft.Cache/redisEnterprise',
'Microsoft.Cdn/cdnwebapplicationfirewallpolicies',
'Microsoft.Cdn/profiles',
'Microsoft.ClassicCompute/domainNames/slots/roles',
'Microsoft.ClassicCompute/virtualMachines',
'Microsoft.ClassicStorage/storageAccounts',
'Microsoft.ClassicStorage/storageAccounts/blobServices',
'Microsoft.ClassicStorage/storageAccounts/fileServices',
'Microsoft.ClassicStorage/storageAccounts/queueServices',
'Microsoft.ClassicStorage/storageAccounts/tableServices',
'Microsoft.Cloudtest/hostedpools',
'Microsoft.Cloudtest/pools',
'Microsoft.ClusterStor/nodes',
'Microsoft.CognitiveServices/accounts',
'Microsoft.Communication/CommunicationServices',
'Microsoft.Compute/cloudServices',
'Microsoft.Compute/cloudServices/roles',
'microsoft.compute/disks',
'Microsoft.Compute/virtualMachines',
'Microsoft.Compute/virtualMachineScaleSets',
'Microsoft.Compute/virtualMachineScaleSets/virtualMachines',
'Microsoft.ConnectedCache/CacheNodes',
'Microsoft.ConnectedVehicle/platformAccounts',
'Microsoft.ContainerInstance/containerGroups',
'Microsoft.ContainerRegistry/registries',
'Microsoft.ContainerService/managedClusters',
'Microsoft.CustomProviders/resourceproviders',
'Microsoft.DataBoxEdge/dataBoxEdgeDevices',
'Microsoft.DataCollaboration/workspaces',
'Microsoft.DataFactory/datafactories',
'Microsoft.DataFactory/factories',
'Microsoft.DataLakeAnalytics/accounts',
'Microsoft.DataLakeStore/accounts',
'Microsoft.DataShare/accounts',
'Microsoft.DBforMariaDB/servers',
'Microsoft.DBforMySQL/flexibleServers',
'Microsoft.DBforMySQL/servers',
'Microsoft.DBforPostgreSQL/flexibleServers',
'Microsoft.DBForPostgreSQL/serverGroupsv2',
'Microsoft.DBforPostgreSQL/servers',
'Microsoft.DBforPostgreSQL/serversv2',
'Microsoft.Devices/ElasticPools',
'Microsoft.Devices/ElasticPools/IotHubTenants',
'Microsoft.Devices/IotHubs',
'Microsoft.Devices/provisioningServices',
'Microsoft.DigitalTwins/digitalTwinsInstances',
'Microsoft.DocumentDB/cassandraClusters',
'Microsoft.DocumentDB/DatabaseAccounts',
'Microsoft.EventGrid/domains',
'Microsoft.EventGrid/eventSubscriptions',
'Microsoft.EventGrid/extensionTopics',
'Microsoft.EventGrid/partnerNamespaces',
'Microsoft.EventGrid/partnerTopics',
'Microsoft.EventGrid/systemTopics',
'Microsoft.EventGrid/topics',
'Microsoft.EventHub/clusters',
'Microsoft.EventHub/Namespaces',
'Microsoft.HDInsight/clusters',
'Microsoft.HealthcareApis/services',
'Microsoft.HealthcareApis/workspaces/fhirservices',
'Microsoft.HealthcareApis/workspaces/iotconnectors',
'microsoft.hybridnetwork/networkfunctions',
'microsoft.hybridnetwork/virtualnetworkfunctions',
'microsoft.insights/autoscalesettings',
'Microsoft.Insights/Components',
'Microsoft.IoTCentral/IoTApps',
'microsoft.keyvault/managedhsms',
'Microsoft.KeyVault/vaults',
'microsoft.kubernetes/connectedClusters',
'Microsoft.Kusto/Clusters',
'Microsoft.Logic/integrationServiceEnvironments',
'Microsoft.Logic/Workflows',
'Microsoft.MachineLearningServices/workspaces',
'Microsoft.Maps/accounts',
'Microsoft.Media/mediaservices',
'Microsoft.Media/mediaservices/liveEvents',
'Microsoft.Media/mediaservices/streamingEndpoints',
'Microsoft.Media/videoanalyzers',
'Microsoft.MixedReality/remoteRenderingAccounts',
'Microsoft.MixedReality/spatialAnchorsAccounts',
'Microsoft.NetApp/netAppAccounts/capacityPools',
'Microsoft.NetApp/netAppAccounts/capacityPools/volumes',
'Microsoft.Network/applicationgateways',
'Microsoft.Network/azureFirewalls',
'microsoft.network/bastionHosts',
'Microsoft.Network/connections',
'Microsoft.Network/dnszones',
'Microsoft.Network/expressRouteCircuits',
'Microsoft.Network/expressRouteCircuits/peerings',
'Microsoft.Network/expressRouteGateways',
'Microsoft.Network/expressRoutePorts',
'Microsoft.Network/frontdoors',
'Microsoft.Network/loadBalancers',
'Microsoft.Network/natGateways',
'Microsoft.Network/networkInterfaces',
'Microsoft.Network/networkWatchers/connectionMonitors',
'microsoft.network/p2svpngateways',
'Microsoft.Network/privateDnsZones',
'Microsoft.Network/privateEndpoints',
'Microsoft.Network/privateLinkServices',
'Microsoft.Network/publicIPAddresses',
'Microsoft.Network/trafficManagerProfiles',
'Microsoft.Network/virtualHubs',
'microsoft.network/virtualnetworkgateways',
'Microsoft.Network/virtualNetworks',
'Microsoft.Network/virtualRouters',
'microsoft.network/vpngateways',
'Microsoft.NotificationHubs/Namespaces/NotificationHubs',
'Microsoft.OperationalInsights/workspaces',
'Microsoft.Peering/peerings',
'Microsoft.Peering/peeringServices',
'Microsoft.PowerBIDedicated/capacities',
'microsoft.purview/accounts',
'Microsoft.RecoveryServices/Vaults',
'Microsoft.Relay/namespaces',
'microsoft.resources/subscriptions',
'Microsoft.Search/searchServices',
'Microsoft.ServiceBus/Namespaces',
'Microsoft.SignalRService/SignalR',
'Microsoft.SignalRService/WebPubSub',
'Microsoft.Sql/managedInstances',
'Microsoft.Sql/servers/databases',
'Microsoft.Sql/servers/elasticPools',
'Microsoft.Storage/storageAccounts',
'Microsoft.Storage/storageAccounts/blobServices',
'Microsoft.Storage/storageAccounts/fileServices',
'Microsoft.Storage/storageAccounts/queueServices',
'Microsoft.Storage/storageAccounts/tableServices',
'Microsoft.StorageCache/caches',
'microsoft.storagesync/storageSyncServices',
'Microsoft.StreamAnalytics/streamingjobs',
'Microsoft.Synapse/workspaces',
'Microsoft.Synapse/workspaces/bigDataPools',
'Microsoft.Synapse/workspaces/kustoPools',
'Microsoft.Synapse/workspaces/sqlPools',
'Microsoft.TimeSeriesInsights/environments',
'Microsoft.TimeSeriesInsights/environments/eventsources',
'Microsoft.VMwareCloudSimple/virtualMachines',
'Microsoft.Web/connections',
'Microsoft.Web/hostingEnvironments',
'Microsoft.Web/hostingEnvironments/multiRolePools',
'Microsoft.Web/hostingEnvironments/workerPools',
'Microsoft.Web/serverfarms',
'Microsoft.Web/sites',
'Microsoft.Web/sites/slots',
'Microsoft.Web/staticSites',
'Wandisco.Fusion/migrators',
];

View File

@ -1,574 +1,402 @@
// Unfortunately this list is manually maintained as there's no (nice) automated way to get
// data from Azure.
export const resourceTypeMetadata = [
{
resourceType: 'microsoft.analysisservices/servers',
displayName: 'Analysis Services',
supportsLogs: true,
},
{
resourceType: 'microsoft.synapse/workspaces/bigdatapools',
displayName: 'Apache Spark pool',
supportsLogs: true,
},
{
resourceType: 'microsoft.apimanagement/service',
displayName: 'API Management service',
supportsLogs: true,
},
{
resourceType: 'microsoft.appconfiguration/configurationstores',
displayName: 'App Configuration',
supportsLogs: true,
},
{
resourceType: 'microsoft.web/sites/slots',
displayName: 'App Service (Slot)',
supportsLogs: true,
},
{
resourceType: 'microsoft.web/hostingenvironments',
displayName: 'App Service Environment',
supportsLogs: true,
},
{
resourceType: 'microsoft.web/serverfarms',
displayName: 'App Service plan',
supportsLogs: true,
},
{
resourceType: 'microsoft.web/sites',
displayName: 'App Service',
supportsLogs: true,
},
{
resourceType: 'microsoft.network/applicationgateways',
displayName: 'Application gateway',
supportsLogs: true,
},
{
resourceType: 'microsoft.insights/components',
displayName: 'Application Insights',
supportsLogs: true,
},
{
resourceType: 'microsoft.automation/automationaccounts',
displayName: 'Automation Account',
supportsLogs: true,
},
{
resourceType: 'microsoft.insights/autoscalesettings',
displayName: 'Autoscale Settings',
supportsLogs: true,
},
{
resourceType: 'microsoft.aadiam/azureadmetrics',
displayName: 'Azure AD Metrics',
supportsLogs: true,
},
{
resourceType: 'microsoft.cache/redis',
displayName: 'Azure Cache for Redis',
supportsLogs: true,
},
{
resourceType: 'microsoft.documentdb/databaseaccounts',
displayName: 'Azure Cosmos DB account',
supportsLogs: true,
},
{
resourceType: 'microsoft.kusto/clusters',
displayName: 'Azure Data Explorer Cluster',
supportsLogs: true,
},
{
resourceType: 'microsoft.dbformariadb/servers',
displayName: 'Azure Database for MariaDB server',
supportsLogs: true,
},
{
resourceType: 'microsoft.dbformysql/servers',
displayName: 'Azure Database for MySQL server',
supportsLogs: true,
},
{
resourceType: 'microsoft.dbforpostgresql/flexibleservers',
displayName: 'Azure Database for PostgreSQL flexible server',
supportsLogs: true,
},
{
resourceType: 'microsoft.dbforpostgresql/servergroupsv2',
displayName: 'Azure Database for PostgreSQL server group',
supportsLogs: true,
},
{
resourceType: 'microsoft.dbforpostgresql/servers',
displayName: 'Azure Database for PostgreSQL server',
supportsLogs: true,
},
{
resourceType: 'microsoft.dbforpostgresql/serversv2',
displayName: 'Azure Database for PostgreSQL server v2',
supportsLogs: true,
},
{
resourceType: 'microsoft.resources/subscriptions',
displayName: 'Subscription',
supportsLogs: true,
},
{
resourceType: 'microsoft.appplatform/spring',
displayName: 'Azure Spring Cloud',
supportsLogs: true,
},
{
resourceType: 'microsoft.databoxedge/databoxedgedevices',
displayName: 'Azure Stack Edge / Data Box Gateway',
supportsLogs: true,
},
{
resourceType: 'microsoft.azurestackresourcemonitor/storageaccountmonitor',
displayName: 'Azure Stack Resource Monitor',
supportsLogs: true,
},
{
resourceType: 'microsoft.synapse/workspaces',
displayName: 'Synapse workspace',
supportsLogs: true,
},
{
resourceType: 'microsoft.network/bastionhosts',
displayName: 'Bastion',
supportsLogs: true,
},
{
resourceType: 'microsoft.batch/batchaccounts',
displayName: 'Batch account',
supportsLogs: true,
},
{
resourceType: 'microsoft.botservice/botservices',
displayName: 'Bot Service',
supportsLogs: true,
},
{
resourceType: 'microsoft.netapp/netappaccounts/capacitypools',
displayName: 'Capacity pool',
supportsLogs: true,
},
{
resourceType: 'microsoft.classiccompute/domainnames',
displayName: 'Cloud service (classic)',
supportsLogs: true,
},
{
resourceType: 'microsoft.vmwarecloudsimple/virtualmachines',
displayName: 'CloudSimple Virtual Machine',
supportsLogs: true,
},
{
resourceType: 'microsoft.cognitiveservices/accounts',
displayName: 'Cognitive Services',
supportsLogs: true,
},
{
resourceType: 'microsoft.network/networkwatchers/connectionmonitors',
displayName: 'Connection Monitors',
supportsLogs: true,
},
{
resourceType: 'microsoft.network/connections',
displayName: 'Connection',
supportsLogs: true,
},
{
resourceType: 'microsoft.containerinstance/containergroups',
displayName: 'Container instances',
supportsLogs: true,
},
{
resourceType: 'microsoft.containerregistry/registries',
displayName: 'Container registry',
supportsLogs: true,
},
{
resourceType: 'microsoft.insights/qos',
displayName: 'Custom Metric Usage',
supportsLogs: true,
},
{
resourceType: 'microsoft.customerinsights/hubs',
displayName: 'CustomerInsights',
supportsLogs: true,
},
{
resourceType: 'microsoft.datafactory/datafactories',
displayName: 'Data factory',
supportsLogs: true,
},
{
resourceType: 'microsoft.datafactory/factories',
displayName: 'Data factory (V2)',
supportsLogs: true,
},
{
resourceType: 'microsoft.datalakeanalytics/accounts',
displayName: 'Data Lake Analytics',
supportsLogs: true,
},
{
resourceType: 'microsoft.datalakestore/accounts',
displayName: 'Data Lake Storage Gen1',
supportsLogs: true,
},
{
resourceType: 'microsoft.datashare/accounts',
displayName: 'Data Share',
supportsLogs: true,
},
{
resourceType: 'microsoft.synapse/workspaces/sqlpools',
displayName: 'Dedicated SQL pool',
supportsLogs: true,
},
{
resourceType: 'microsoft.devices/provisioningservices',
displayName: 'Device Provisioning Service',
supportsLogs: true,
},
{
resourceType: 'microsoft.compute/disks',
displayName: 'Disk',
supportsLogs: true,
},
{
resourceType: 'microsoft.network/dnszones',
displayName: 'DNS zone',
supportsLogs: true,
},
{
resourceType: 'microsoft.eventgrid/domains',
displayName: 'Event Grid Domain',
supportsLogs: true,
},
{
resourceType: 'microsoft.eventgrid/systemtopics',
displayName: 'Event Grid System Topic',
supportsLogs: true,
},
{
resourceType: 'microsoft.eventgrid/topics',
displayName: 'Event Grid Topic',
supportsLogs: true,
},
{
resourceType: 'microsoft.eventhub/clusters',
displayName: 'Event Hubs Cluster',
supportsLogs: true,
},
{
resourceType: 'microsoft.eventhub/namespaces',
displayName: 'Event Hubs Namespace',
supportsLogs: true,
},
{
resourceType: 'microsoft.network/expressroutecircuits',
displayName: 'ExpressRoute circuit',
supportsLogs: true,
},
{
resourceType: 'microsoft.network/expressrouteports',
displayName: 'ExpressRoute Direct',
supportsLogs: true,
},
{
resourceType: 'microsoft.network/expressroutegateways',
displayName: 'ExpressRoute Gateways',
supportsLogs: true,
},
{
resourceType: 'microsoft.fabric.admin/fabriclocations',
displayName: 'Fabric Locations',
supportsLogs: true,
},
{
resourceType: 'microsoft.network/azurefirewalls',
displayName: 'Firewall',
supportsLogs: true,
},
{
resourceType: 'microsoft.network/frontdoors',
displayName: 'Front Door',
supportsLogs: true,
},
{
resourceType: 'microsoft.hdinsight/clusters',
displayName: 'HDInsight cluster',
supportsLogs: true,
},
{
resourceType: 'microsoft.storagecache/caches',
displayName: 'HPC cache',
supportsLogs: true,
},
{
resourceType: 'microsoft.logic/integrationserviceenvironments',
displayName: 'Integration Service Environment',
supportsLogs: true,
},
{
resourceType: 'microsoft.iotcentral/iotapps',
displayName: 'IoT Central Application',
supportsLogs: true,
},
{
resourceType: 'microsoft.devices/iothubs',
displayName: 'IoT Hub',
supportsLogs: true,
},
{
resourceType: 'microsoft.keyvault/vaults',
displayName: 'Key vault',
supportsLogs: true,
},
{
resourceType: 'microsoft.kubernetes/connectedclusters',
displayName: 'Kubernetes - Azure Arc',
supportsLogs: true,
},
{
resourceType: 'microsoft.containerservice/managedclusters',
displayName: 'Kubernetes service',
supportsLogs: true,
},
{
resourceType: 'microsoft.media/mediaservices/liveevents',
displayName: 'Live event',
supportsLogs: true,
},
{
resourceType: 'microsoft.network/loadbalancers',
displayName: 'Load balancer',
supportsLogs: true,
},
{
resourceType: 'microsoft.operationalinsights/workspaces',
displayName: 'Log Analytics workspace',
supportsLogs: true,
},
{
resourceType: 'microsoft.logic/workflows',
displayName: 'Logic app',
supportsLogs: true,
},
{
resourceType: 'microsoft.machinelearningservices/workspaces',
displayName: 'Machine learning',
supportsLogs: true,
},
{
resourceType: 'microsoft.media/mediaservices',
displayName: 'Media service',
supportsLogs: true,
},
{
resourceType: 'microsoft.network/natgateways',
displayName: 'NAT gateway',
supportsLogs: true,
},
{
resourceType: 'microsoft.network/networkinterfaces',
displayName: 'Network interface',
supportsLogs: true,
},
{
resourceType: 'microsoft.network/networkvirtualappliances',
displayName: 'Network Virtual Appliances',
supportsLogs: true,
},
{
resourceType: 'microsoft.network/networkwatchers',
displayName: 'Network Watcher',
supportsLogs: true,
},
{
resourceType: 'microsoft.notificationhubs/namespaces/notificationhubs',
displayName: 'Notification Hub',
supportsLogs: true,
},
{
resourceType: 'microsoft.network/p2svpngateways',
displayName: 'P2S VPN Gateways',
supportsLogs: true,
},
{
resourceType: 'microsoft.peering/peeringservices',
displayName: 'Peering Service',
supportsLogs: true,
},
{
resourceType: 'microsoft.powerbidedicated/capacities',
displayName: 'Power BI Embedded',
supportsLogs: true,
},
{
resourceType: 'microsoft.network/privateendpoints',
displayName: 'Private endpoint',
supportsLogs: true,
},
{
resourceType: 'microsoft.network/privatelinkservices',
displayName: 'Private link service',
supportsLogs: true,
},
{
resourceType: 'microsoft.network/publicipaddresses',
displayName: 'Public IP address',
supportsLogs: true,
},
{
resourceType: 'microsoft.cache/redisenterprise',
displayName: 'Redis Enterprise',
supportsLogs: true,
},
{
resourceType: 'microsoft.relay/namespaces',
displayName: 'Relay',
supportsLogs: true,
},
{
resourceType: 'microsoft.synapse/workspaces/scopepools',
displayName: 'Scope pool',
supportsLogs: true,
},
{
resourceType: 'microsoft.search/searchservices',
displayName: 'Search service',
supportsLogs: true,
},
{
resourceType: 'microsoft.servicebus/namespaces',
displayName: 'Service Bus Namespace',
supportsLogs: true,
},
{
resourceType: 'microsoft.signalrservice/signalr',
displayName: 'SignalR',
supportsLogs: true,
},
{
resourceType: 'microsoft.operationsmanagement/solutions',
displayName: 'Solution',
supportsLogs: true,
},
{
resourceType: 'microsoft.sql/servers/databases',
displayName: 'SQL database',
supportsLogs: true,
},
{
resourceType: 'microsoft.sql/servers/elasticpools',
displayName: 'SQL elastic pool',
supportsLogs: true,
},
{
resourceType: 'microsoft.sql/managedinstances',
displayName: 'SQL managed instance',
supportsLogs: true,
},
{
resourceType: 'microsoft.storage/storageaccounts',
displayName: 'Storage account',
supportsLogs: true,
},
{
resourceType: 'microsoft.classicstorage/storageaccounts',
displayName: 'Storage account (classic)',
supportsLogs: true,
},
{
resourceType: 'microsoft.storagesync/storagesyncservices',
displayName: 'Storage Sync Service',
supportsLogs: true,
},
{
resourceType: 'microsoft.streamanalytics/streamingjobs',
displayName: 'Stream Analytics job',
supportsLogs: true,
},
{
resourceType: 'microsoft.media/mediaservices/streamingendpoints',
displayName: 'Streaming Endpoint',
supportsLogs: true,
},
{
resourceType: 'microsoft.timeseriesinsights/environments',
displayName: 'Time Series Insights environment',
supportsLogs: true,
},
{
resourceType: 'microsoft.network/trafficmanagerprofiles',
displayName: 'Traffic Manager profile',
supportsLogs: true,
},
{
resourceType: 'microsoft.compute/virtualmachinescalesets',
displayName: 'Virtual machine scale set',
supportsLogs: true,
},
{
resourceType: 'microsoft.compute/virtualmachines',
displayName: 'Virtual machine',
supportsLogs: true,
},
{
resourceType: 'microsoft.classiccompute/virtualmachines',
displayName: 'Virtual machine (classic)',
supportsLogs: true,
},
{
resourceType: 'microsoft.network/virtualnetworkgateways',
displayName: 'Virtual network gateway',
supportsLogs: true,
},
{
resourceType: 'microsoft.netapp/netappaccounts/capacitypools/volumes',
displayName: 'Volume',
supportsLogs: true,
},
{
resourceType: 'microsoft.network/vpngateways',
displayName: 'VPN Gateways',
supportsLogs: true,
},
{
resourceType: 'microsoft.cdn/cdnwebapplicationfirewallpolicies',
displayName: 'Content Delivery Network WAF policy',
supportsLogs: true,
},
{
resourceType: 'microsoft.web/hostingenvironments/workerpools',
displayName: 'WorkerPools',
supportsLogs: true,
},
{
resourceType: 'microsoft.resources/subscriptions/resourcegroups',
displayName: 'Resource Group',
supportsLogs: true,
},
];
export const logsSupportedResourceTypesKusto = resourceTypeMetadata
.filter((v) => v.supportsLogs)
.map((v) => `"${v.resourceType}"`)
.join(',');
// Object, keyed by resourceType ID
export const resourceTypeDisplayNames: Record<string, string> = resourceTypeMetadata.reduce(
(acc, resourceType) => ({
...acc,
[resourceType.resourceType]: resourceType.displayName,
}),
{}
);
/**
This list is obtained parsing https://docs.microsoft.com/en-us/azure/governance/resource-graph/reference/supported-tables-resources
To programatically get the list, execute in the browser console:
const i = {};
document.querySelectorAll('li').forEach((li) => {
const m = li.textContent.match(/(.*\..*\/.*?)\s\((.*)\)/);
if (m) {
i[m[1].toLowerCase()] = m[2];
}
});
i;
Note: Validate that the output makes sense, the format of the page may change.
*/
export const resourceTypeDisplayNames: { [k: string]: string } = {
'microsoft.recoveryservices/vaults/backupfabrics/protectioncontainers/protecteditems': 'Backup Items',
'microsoft.resources/subscriptions': 'Subscriptions',
'microsoft.resources/subscriptions/resourcegroups': 'Resource groups',
'citrix.services/xenappessentials': 'Citrix Virtual Apps Essentials',
'citrix.services/xendesktopessentials': 'Citrix Virtual Desktops Essentials',
'dynatrace.observability/monitors': 'Dynatrace',
'github.enterprise/accounts': 'GitHub AE',
'microsoft.aad/domainservices': 'Azure AD Domain Services',
'microsoft.aadiam/privatelinkforazuread': 'Private Link for Azure AD',
'microsoft.agfoodplatform/farmbeats': 'Azure FarmBeats',
'microsoft.analysisservices/servers': 'Analysis Services',
'microsoft.anybuild/clusters': 'AnyBuild clusters',
'microsoft.apimanagement/service': 'API Management services',
'microsoft.appconfiguration/configurationstores': 'App Configuration',
'microsoft.appplatform/spring': 'Azure Spring Cloud',
'microsoft.attestation/attestationproviders': 'Attestation providers',
'microsoft.authorization/resourcemanagementprivatelinks': 'Resource management private links',
'microsoft.automation/automationaccounts': 'Automation Accounts',
'microsoft.automation/automationaccounts/runbooks': 'Runbook',
'microsoft.autonomoussystems/workspaces': 'Bonsai',
'microsoft.avs/privateclouds': 'AVS Private clouds',
'microsoft.azureactivedirectory/b2cdirectories': 'B2C Tenants',
'microsoft.azureactivedirectory/guestusages': 'Guest Usages',
'microsoft.azurearcdata/datacontrollers': 'Azure Arc data controllers',
'microsoft.azurearcdata/postgresinstances': 'Azure Arc-enabled PostgreSQL Hyperscale server groups',
'microsoft.azurearcdata/sqlmanagedinstances': 'SQL managed instances - Azure Arc',
'microsoft.azurearcdata/sqlserverinstances': 'SQL Server - Azure Arc',
'microsoft.azuredata/sqlserverregistrations': 'SQL Server registries',
'microsoft.azurepercept/accounts': 'Azure Percept accounts',
'microsoft.azurestackhci/clusters': 'Azure Stack HCI',
'microsoft.azurestackhci/virtualmachines': 'Azure Stack HCI virtual machine - Azure Arc',
'microsoft.baremetal/crayservers': 'Cray Servers',
'microsoft.baremetal/monitoringservers': 'Monitoring Servers',
'microsoft.baremetalinfrastructure/baremetalinstances': 'BareMetal Instances',
'microsoft.batch/batchaccounts': 'Batch accounts',
'microsoft.bing/accounts': 'Bing Resources',
'microsoft.botservice/botservices': 'Bot Services',
'microsoft.cache/redis': 'Azure Cache for Redis',
'microsoft.cache/redisenterprise': 'Redis Enterprise',
'microsoft.cdn/cdnwebapplicationfirewallpolicies': 'Content Delivery Network WAF policies',
'microsoft.cdn/profiles (front doors standard/premium': 'Preview)',
'microsoft.cdn/profiles/afdendpoints': 'Endpoints',
'microsoft.cdn/profiles/endpoints': 'Endpoints',
'microsoft.certificateregistration/certificateorders': 'App Service Certificates',
'microsoft.chaos/chaosexperiments': 'Chaos Experiments (Classic)',
'microsoft.chaos/experiments': 'Chaos Experiments',
'microsoft.classiccompute/domainnames': 'Cloud services (classic)',
'microsoft.classiccompute/virtualmachines': 'Virtual machines (classic)',
'microsoft.classicnetwork/networksecuritygroups': 'Network security groups (classic)',
'microsoft.classicnetwork/reservedips': 'Reserved IP addresses (classic)',
'microsoft.classicnetwork/virtualnetworks': 'Virtual networks (classic)',
'microsoft.classicstorage/storageaccounts': 'Storage accounts (classic)',
'microsoft.cloudtest/accounts': 'CloudTest Accounts',
'microsoft.cloudtest/hostedpools': '1ES Hosted Pools',
'microsoft.cloudtest/images': 'CloudTest Images',
'microsoft.cloudtest/pools': 'CloudTest Pools',
'microsoft.clusterstor/nodes': 'ClusterStors',
'microsoft.cognitiveservices/accounts': 'Cognitive Services',
'microsoft.compute/availabilitysets': 'Availability sets',
'microsoft.compute/capacityreservationgroups': 'Capacity Reservation Groups',
'microsoft.compute/cloudservices': 'Cloud services (extended support)',
'microsoft.compute/diskaccesses': 'Disk Accesses',
'microsoft.compute/diskencryptionsets': 'Disk Encryption Sets',
'microsoft.compute/disks': 'Disks',
'microsoft.compute/galleries': 'Azure compute galleries',
'microsoft.compute/galleries/applications': 'VM application definitions',
'microsoft.compute/galleries/applications/versions': 'VM application versions',
'microsoft.compute/galleries/images': 'VM image definitions',
'microsoft.compute/galleries/images/versions': 'VM image versions',
'microsoft.compute/hostgroups': 'Host groups',
'microsoft.compute/hostgroups/hosts': 'Hosts',
'microsoft.compute/images': 'Images',
'microsoft.compute/proximityplacementgroups': 'Proximity placement groups',
'microsoft.compute/restorepointcollections': 'Restore Point Collections',
'microsoft.compute/snapshots': 'Snapshots',
'microsoft.compute/sshpublickeys': 'SSH keys',
'microsoft.compute/virtualmachines': 'Virtual machines',
'microsoft.compute/virtualmachinescalesets': 'Virtual machine scale sets',
'microsoft.confidentialledger/ledgers': 'Confidential Ledgers',
'microsoft.confluent/organizations': 'Confluent organizations',
'microsoft.connectedcache/cachenodes': 'Connected Cache Resources',
'microsoft.connectedcache/enterprisecustomers': 'Connected Cache Resources',
'microsoft.connectedvehicle/platformaccounts': 'Connected Vehicle Platforms',
'microsoft.connectedvmwarevsphere/vcenters': 'VMware vCenters',
'microsoft.connectedvmwarevsphere/virtualmachines': 'VMware + AVS virtual machines',
'microsoft.containerinstance/containergroups': 'Container instances',
'microsoft.containerregistry/registries': 'Container registries',
'microsoft.containerregistry/registries/replications': 'Container registry replications',
'microsoft.containerregistry/registries/webhooks': 'Container registry webhooks',
'microsoft.containerservice/managedclusters': 'Kubernetes services',
'microsoft.dashboard/grafana': 'Grafana Workspaces',
'microsoft.databox/jobs': 'Azure Data Box',
'microsoft.databoxedge/databoxedgedevices': 'Azure Stack Edge / Data Box Gateway',
'microsoft.databricks/workspaces': 'Azure Databricks Services',
'microsoft.datacatalog/catalogs': 'Data Catalog',
'microsoft.datacollaboration/workspaces': 'Project CI',
'microsoft.datadog/monitors': 'Datadog',
'microsoft.datafactory/datafactories': 'Data factories',
'microsoft.datafactory/factories': 'Data factories (V2)',
'microsoft.datalakeanalytics/accounts': 'Data Lake Analytics',
'microsoft.datalakestore/accounts': 'Data Lake Storage Gen1',
'microsoft.datamigration/services': 'Azure Database Migration Services',
'microsoft.datamigration/services/projects': 'Azure Database Migration Projects',
'microsoft.datamigration/sqlmigrationservices': 'Azure Database Migration Services',
'microsoft.dataprotection/backupvaults': 'Backup vaults',
'microsoft.dataprotection/resourceguards': 'Resource Guards (Preview)',
'microsoft.datareplication/replicationvaults': 'Site Recovery Vaults',
'microsoft.datashare/accounts': 'Data Shares',
'microsoft.dbformariadb/servers': 'Azure Database for MariaDB servers',
'microsoft.dbformysql/flexibleservers': 'Azure Database for MySQL flexible servers',
'microsoft.dbformysql/servers': 'Azure Database for MySQL servers',
'microsoft.dbforpostgresql/flexibleservers': 'Azure Database for PostgreSQL flexible servers',
'microsoft.dbforpostgresql/servergroups': 'Azure Database for PostgreSQL server groups',
'microsoft.dbforpostgresql/servergroupsv2': 'Azure Database for PostgreSQL server groups',
'microsoft.dbforpostgresql/servers': 'Azure Database for PostgreSQL servers',
'microsoft.dbforpostgresql/serversv2': 'Azure Database for PostgreSQL servers v2',
'microsoft.deploymentmanager/rollouts': 'Rollouts',
'microsoft.desktopvirtualization/applicationgroups': 'Application groups',
'microsoft.desktopvirtualization/hostpools': 'Host pools',
'microsoft.desktopvirtualization/scalingplans': 'Scaling plans',
'microsoft.desktopvirtualization/workspaces': 'Workspaces',
'microsoft.devices/iothubs': 'IoT Hub',
'microsoft.devices/provisioningservices': 'Device Provisioning Services',
'microsoft.deviceupdate/accounts': 'Device Update for IoT Hubs',
'microsoft.devops/pipelines': 'DevOps Starter',
'microsoft.devtestlab/labs': 'DevTest Labs',
'microsoft.devtestlab/labs/virtualmachines': 'Virtual machines',
'microsoft.digitaltwins/digitaltwinsinstances': 'Azure Digital Twins',
'microsoft.documentdb/cassandraclusters': 'Azure Managed Instance for Apache Cassandra',
'microsoft.documentdb/databaseaccounts': 'Azure Cosmos DB accounts',
'microsoft.domainregistration/domains': 'App Service Domains',
'microsoft.edgeorder/addresses': 'Azure Edge Hardware Center Address',
'microsoft.edgeorder/orderitems': 'Azure Edge Hardware Center',
'microsoft.elastic/monitors': 'Elasticsearch (Elastic Cloud)',
'microsoft.eventgrid/domains': 'Event Grid Domains',
'microsoft.eventgrid/partnernamespaces': 'Event Grid Partner Namespaces',
'microsoft.eventgrid/partnerregistrations': 'Event Grid Partner Registrations',
'microsoft.eventgrid/partnertopics': 'Event Grid Partner Topics',
'microsoft.eventgrid/systemtopics': 'Event Grid System Topics',
'microsoft.eventgrid/topics': 'Event Grid Topics',
'microsoft.eventhub/clusters': 'Event Hubs Clusters',
'microsoft.eventhub/namespaces': 'Event Hubs Namespaces',
'microsoft.experimentation/experimentworkspaces': 'Experiment Workspaces',
'microsoft.extendedlocation/customlocations': 'Custom locations',
'microsoft.fidalgo/devcenters': 'Fidalgo DevCenters',
'microsoft.fidalgo/networksettings': 'Network Configurations',
'microsoft.fidalgo/projects': 'Fidalgo Projects',
'microsoft.fidalgo/projects/environments': 'Fidalgo Environments',
'microsoft.fluidrelay/fluidrelayservers': 'Fluid Relay',
'microsoft.genomics/accounts': 'Genomics accounts',
'microsoft.hanaonazure/hanainstances': 'SAP HANA on Azure',
'microsoft.hanaonazure/sapmonitors': 'Azure Monitors for SAP Solutions',
'microsoft.hdinsight/clusterpools': 'HDInsight cluster pools',
'microsoft.hdinsight/clusterpools/clusters': 'HDInsight gen2 clusters',
'microsoft.hdinsight/clusterpools/clusters/sessionclusters': 'HDInsight session clusters',
'microsoft.hdinsight/clusters': 'HDInsight clusters',
'microsoft.healthbot/healthbots': 'Azure Health Bot',
'microsoft.healthcareapis/services': 'Azure API for FHIR',
'microsoft.healthcareapis/workspaces': 'Healthcare APIs Workspaces',
'microsoft.healthcareapis/workspaces/dicomservices': 'DICOM services',
'microsoft.healthcareapis/workspaces/fhirservices': 'FHIR services',
'microsoft.healthcareapis/workspaces/iotconnectors': 'IoT connectors',
'microsoft.hpcworkbench/instances': 'HPC Workbenches (preview)',
'microsoft.hpcworkbench/instances/chambers': 'Chambers (preview)',
'microsoft.hpcworkbench/instances/chambers/accessprofiles': 'Chamber Profiles (preview)',
'microsoft.hpcworkbench/instances/chambers/workloads': 'Chamber VMs (preview)',
'microsoft.hpcworkbench/instances/consortiums': 'Consortiums (preview)',
'microsoft.hybridcompute/machines': 'Servers - Azure Arc',
'microsoft.hybridcompute/privatelinkscopes': 'Azure Arc Private Link Scopes',
'microsoft.hybriddata/datamanagers': 'StorSimple Data Managers',
'microsoft.hybridnetwork/devices': 'Azure Network Function Manager Devices',
'microsoft.hybridnetwork/networkfunctions': 'Azure Network Function Manager Network Functions',
'microsoft.importexport/jobs': 'Import/export jobs',
'microsoft.insights/components': 'Application Insights',
'microsoft.insights/datacollectionendpoints': 'Data collection endpoints',
'microsoft.insights/datacollectionrules': 'Data collection rules',
'microsoft.insights/privatelinkscopes': 'Azure Monitor Private Link Scopes',
'microsoft.insights/webtests': 'Availability tests',
'microsoft.insights/workbooks': 'Azure Workbooks',
'microsoft.insights/workbooktemplates': 'Azure Workbook Templates',
'microsoft.iotcentral/iotapps': 'IoT Central Applications',
'microsoft.keyvault/vaults': 'Key vaults',
'microsoft.kubernetes/connectedclusters': 'Kubernetes - Azure Arc',
'microsoft.kusto/clusters': 'Azure Data Explorer Clusters',
'microsoft.kusto/clusters/databases': 'Azure Data Explorer Databases',
'microsoft.labservices/labaccounts': 'Lab accounts',
'microsoft.labservices/labplans': 'Lab plans',
'microsoft.labservices/labs': 'Labs',
'microsoft.loadtestservice/loadtests': 'Azure Load Testing',
'microsoft.logic/integrationaccounts': 'Integration accounts',
'microsoft.logic/integrationserviceenvironments': 'Integration Service Environments',
'microsoft.logic/integrationserviceenvironments/managedapis': 'Managed Connector',
'microsoft.logic/workflows': 'Logic apps',
'microsoft.logz/monitors': 'Logz main account',
'microsoft.logz/monitors/accounts': 'Logz sub account',
'microsoft.logz/monitors/metricssource': 'Logz metrics data source',
'microsoft.machinelearning/commitmentplans': 'Machine Learning Studio (classic) web service plans',
'microsoft.machinelearning/webservices': 'Machine Learning Studio (classic) web services',
'microsoft.machinelearning/workspaces': 'Machine Learning Studio (classic) workspaces',
'microsoft.machinelearningservices/workspaces': 'Machine learning',
'microsoft.machinelearningservices/workspaces/onlineendpoints': 'Machine learning online endpoints',
'microsoft.machinelearningservices/workspaces/onlineendpoints/deployments': 'Machine learning online deployments',
'microsoft.maintenance/maintenanceconfigurations': 'Maintenance Configurations',
'microsoft.managedidentity/userassignedidentities': 'Managed Identities',
'microsoft.maps/accounts': 'Azure Maps Accounts',
'microsoft.maps/accounts/creators': 'Azure Maps Creator Resources',
'microsoft.media/mediaservices': 'Media Services',
'microsoft.media/mediaservices/liveevents': 'Live events',
'microsoft.media/mediaservices/streamingendpoints': 'Streaming Endpoints',
'microsoft.media/videoanalyzers': 'Video Analyzers',
'microsoft.migrate/projects': 'Migration projects',
'microsoft.mixedreality/objectanchorsaccounts': 'Object Anchors Accounts',
'microsoft.mixedreality/objectunderstandingaccounts': 'Object Understanding Accounts',
'microsoft.mixedreality/remoterenderingaccounts': 'Remote Rendering Accounts',
'microsoft.mixedreality/spatialanchorsaccounts': 'Spatial Anchors Accounts',
'microsoft.mobilenetwork/mobilenetworks': 'Mobile Networks',
'microsoft.mobilenetwork/mobilenetworks/datanetworks': 'Data Networks',
'microsoft.mobilenetwork/mobilenetworks/services': 'Services',
'microsoft.mobilenetwork/mobilenetworks/simpolicies': 'Sim Policies',
'microsoft.mobilenetwork/mobilenetworks/sites': 'Mobile Network Sites',
'microsoft.mobilenetwork/mobilenetworks/slices': 'Slices',
'microsoft.mobilenetwork/packetcorecontrolplanes': 'Packet Core Control Planes',
'microsoft.mobilenetwork/packetcorecontrolplanes/packetcoredataplanes': 'Packet Core Data Planes',
'microsoft.mobilenetwork/packetcorecontrolplanes/packetcoredataplanes/attacheddatanetworks': 'Attached Data Networks',
'microsoft.mobilenetwork/sims': 'Sims',
'microsoft.netapp/netappaccounts': 'NetApp accounts',
'microsoft.netapp/netappaccounts/capacitypools': 'Capacity pools',
'microsoft.netapp/netappaccounts/capacitypools/volumes': 'Volumes',
'microsoft.netapp/netappaccounts/capacitypools/volumes/snapshots': 'Snapshots',
'microsoft.netapp/netappaccounts/snapshotpolicies': 'Snapshot policies',
'microsoft.network/applicationgateways': 'Application gateways',
'microsoft.network/applicationgatewaywebapplicationfirewallpolicies': 'Application Gateway WAF policies',
'microsoft.network/applicationsecuritygroups': 'Application security groups',
'microsoft.network/azurefirewalls': 'Firewalls',
'microsoft.network/bastionhosts': 'Bastions',
'microsoft.network/connections': 'Connections',
'microsoft.network/customipprefixes': 'Custom IP Prefixes',
'microsoft.network/ddosprotectionplans': 'DDoS protection plans',
'microsoft.network/dnsforwardingrulesets': 'Dns Forwarding Rulesets',
'microsoft.network/dnsresolvers': 'DNS Private Resolvers',
'microsoft.network/dnszones': 'DNS zones',
'microsoft.network/expressroutecircuits': 'ExpressRoute circuits',
'microsoft.network/expressrouteports': 'ExpressRoute Direct',
'microsoft.network/firewallpolicies': 'Firewall Policies',
'microsoft.network/frontdoors': 'Front Doors',
'microsoft.network/frontdoorwebapplicationfirewallpolicies': 'Web Application Firewall policies (WAF)',
'microsoft.network/ipgroups': 'IP Groups',
'microsoft.network/loadbalancers': 'Load balancers',
'microsoft.network/localnetworkgateways': 'Local network gateways',
'microsoft.network/natgateways': 'NAT gateways',
'microsoft.network/networkexperimentprofiles': 'Internet Analyzer profiles',
'microsoft.network/networkinterfaces': 'Network interfaces',
'microsoft.network/networkmanagers': 'Network Managers',
'microsoft.network/networksecuritygroups': 'Network security groups',
'microsoft.network/networkwatchers': 'Network Watchers',
'microsoft.network/networkwatchers/flowlogs': 'NSG Flow Logs',
'microsoft.network/privatednszones': 'Private DNS zones',
'microsoft.network/privateendpoints': 'Private endpoints',
'microsoft.network/privatelinkservices': 'Private link services',
'microsoft.network/publicipaddresses': 'Public IP addresses',
'microsoft.network/publicipprefixes': 'Public IP Prefixes',
'microsoft.network/routefilters': 'Route filters',
'microsoft.network/routetables': 'Route tables',
'microsoft.network/serviceendpointpolicies': 'Service endpoint policies',
'microsoft.network/trafficmanagerprofiles': 'Traffic Manager profiles',
'microsoft.network/virtualnetworkgateways': 'Virtual network gateways',
'microsoft.network/virtualnetworks': 'Virtual networks',
'microsoft.network/virtualwans': 'Virtual WANs',
'microsoft.notificationhubs/namespaces': 'Notification Hub Namespaces',
'microsoft.notificationhubs/namespaces/notificationhubs': 'Notification Hubs',
'microsoft.openenergyplatform/energyservices': 'Project Oak Forest',
'microsoft.openlogisticsplatform/workspaces': 'Open Supply Chain Platform',
'microsoft.operationalinsights/querypacks': 'Log Analytics query packs',
'microsoft.operationalinsights/workspaces': 'Log Analytics workspaces',
'microsoft.operationsmanagement/solutions': 'Solutions',
'microsoft.orbital/contactprofiles': 'Contact Profiles',
'microsoft.orbital/edgesites': 'Edge Sites',
'microsoft.orbital/groundstations': 'Ground Stations',
'microsoft.orbital/l2connections': 'L2 Connections',
'microsoft.orbital/spacecrafts': 'Spacecrafts',
'microsoft.peering/peerings': 'Peerings',
'microsoft.peering/peeringservices': 'Peering Services',
'microsoft.playfab/playeraccountpools': 'PlayFab player account pools',
'microsoft.playfab/titles': 'PlayFab titles',
'microsoft.portal/dashboards': 'Shared dashboards',
'microsoft.powerbidedicated/capacities': 'Power BI Embedded',
'microsoft.purview/accounts': 'Microsoft Purview accounts',
'microsoft.quantum/workspaces': 'Quantum Workspaces',
'microsoft.recommendationsservice/accounts': 'Intelligent Recommendations Accounts',
'microsoft.recommendationsservice/accounts/modeling': 'Modeling',
'microsoft.recommendationsservice/accounts/serviceendpoints': 'Service Endpoints',
'microsoft.recoveryservices/vaults': 'Recovery Services vaults',
'microsoft.redhatopenshift/openshiftclusters': 'Azure Red Hat OpenShift',
'microsoft.relay/namespaces': 'Relays',
'microsoft.resourceconnector/appliances': 'Resource bridges',
'microsoft.resourcegraph/queries': 'Resource Graph queries',
'microsoft.resources/deploymentscripts': 'Deployment Scripts',
'microsoft.resources/templatespecs': 'Template specs',
'microsoft.saas/applications': 'Software as a Service (classic)',
'microsoft.saas/resources': 'SaaS',
'microsoft.scom/managedinstances': 'Aquila Instances',
'microsoft.scvmm/virtualmachines': 'SCVMM virtual machine - Azure Arc',
'microsoft.scvmm/vmmservers': 'SCVMM management servers',
'microsoft.search/searchservices': 'Search services',
'microsoft.securitydetonation/chambers': 'Security Detonation Chambers',
'microsoft.servicebus/namespaces': 'Service Bus Namespaces',
'microsoft.servicefabric/clusters': 'Service Fabric clusters',
'microsoft.servicefabric/managedclusters': 'Service Fabric managed clusters',
'microsoft.serviceshub/connectors': 'Services Hub Connectors',
'microsoft.signalrservice/signalr': 'SignalR',
'microsoft.signalrservice/webpubsub': 'Web PubSub Service',
'microsoft.solutions/applicationdefinitions': 'Service catalog managed application definitions',
'microsoft.solutions/applications': 'Managed applications',
'microsoft.sql/instancepools': 'Instance pools',
'microsoft.sql/managedinstances': 'SQL managed instances',
'microsoft.sql/managedinstances/databases': 'Managed databases',
'microsoft.sql/servers': 'SQL servers',
'microsoft.sql/servers/databases': 'SQL databases',
'microsoft.sql/servers/elasticpools': 'SQL elastic pools',
'microsoft.sql/servers/jobagents': 'Elastic Job agents',
'microsoft.sql/virtualclusters': 'Virtual clusters',
'microsoft.sqlvirtualmachine/sqlvirtualmachines': 'SQL virtual machines',
'microsoft.storage/storageaccounts': 'Storage accounts',
'microsoft.storagecache/amlfilesystems': 'Lustre File Systems',
'microsoft.storagecache/caches': 'HPC caches',
'microsoft.storagepool/diskpools': 'Disk Pools',
'microsoft.storagesync/storagesyncservices': 'Storage Sync Services',
'microsoft.storagesyncdev/storagesyncservices': 'Storage Sync Services',
'microsoft.storagesyncint/storagesyncservices': 'Storage Sync Services',
'microsoft.storsimple/managers': 'StorSimple Device Managers',
'microsoft.streamanalytics/clusters': 'Stream Analytics clusters',
'microsoft.streamanalytics/streamingjobs': 'Stream Analytics jobs',
'microsoft.synapse/privatelinkhubs': 'Azure Synapse Analytics (private link hubs)',
'microsoft.synapse/workspaces': 'Azure Synapse Analytics',
'microsoft.synapse/workspaces/bigdatapools': 'Apache Spark pools',
'microsoft.synapse/workspaces/kustopools': 'Data Explorer pools (preview)',
'microsoft.synapse/workspaces/sqlpools': 'Dedicated SQL pools',
'microsoft.testbase/testbaseaccounts': 'Test Base Accounts',
'microsoft.testbase/testbaseaccounts/packages': 'Test Base Packages',
'microsoft.timeseriesinsights/environments': 'Time Series Insights environments',
'microsoft.timeseriesinsights/environments/eventsources': 'Time Series Insights event sources',
'microsoft.timeseriesinsights/environments/referencedatasets': 'Time Series Insights reference data sets',
'microsoft.videoindexer/accounts': 'Video Analyzer for Media',
'microsoft.virtualmachineimages/imagetemplates': 'Image Templates',
'microsoft.visualstudio/account': 'Azure DevOps organizations',
'microsoft.visualstudio/account/project': 'DevOps Starter',
'microsoft.vmwarecloudsimple/dedicatedcloudnodes': 'CloudSimple Nodes',
'microsoft.vmwarecloudsimple/dedicatedcloudservices': 'CloudSimple Services',
'microsoft.vmwarecloudsimple/virtualmachines': 'CloudSimple Virtual Machines',
'microsoft.vsonline/plans': 'Visual Studio Online Plans',
'microsoft.web/connectiongateways': 'On-premises data gateways',
'microsoft.web/connections': 'API Connections',
'microsoft.web/containerapps': 'Container Apps',
'microsoft.web/customapis': 'Logic Apps Custom Connector',
'microsoft.web/hostingenvironments': 'App Service Environments',
'microsoft.web/kubeenvironments': 'App Service Kubernetes Environments',
'microsoft.web/serverfarms': 'App Service plans',
'microsoft.web/sites': 'App Services',
'microsoft.web/sites/slots': 'App Service (Slots)',
'microsoft.web/staticsites': 'Static Web Apps',
'microsoft.windowsesu/multipleactivationkeys': 'Windows Multiple Activation Keys',
'microsoft.windowsiot/deviceservices': 'Windows 10 IoT Core Services',
'microsoft.workloads/monitors': 'Azure Monitors for SAP Solutions (v2)',
'microsoft.workloads/phpworkloads': 'Scalable WordPress on Linux',
'microsoft.workloads/sapvirtualinstances': 'SAP Virtual Instances',
'microsoft.workloads/sapvirtualinstances/applicationinstances': 'SAP app server instances',
'microsoft.workloads/sapvirtualinstances/centralinstances': 'SAP central server instances',
'microsoft.workloads/sapvirtualinstances/databaseinstances': 'SAP database server instances',
'nginx.nginxplus/nginxdeployments': 'NGINX Deployment',
'providers.test/statefulibizaengines': 'VLCentral Help',
'wandisco.fusion/fusiongroups': 'LiveData Planes',
'wandisco.fusion/fusiongroups/azurezones': 'Azure Zones',
'wandisco.fusion/fusiongroups/azurezones/plugins': 'Plugins',
'wandisco.fusion/fusiongroups/hivereplicationrules': 'Hive Replication Rules',
'wandisco.fusion/fusiongroups/managedonpremzones': 'On-premises Zones',
'wandisco.fusion/fusiongroups/replicationrules': 'Replication Rules',
'wandisco.fusion/migrators': 'LiveData Migrators',
'wandisco.fusion/migrators/exclusiontemplates': 'Exclusions',
'wandisco.fusion/migrators/livedatamigrations': 'Migrations',
'wandisco.fusion/migrators/metadatamigrations': 'Metadata Migrations',
'wandisco.fusion/migrators/metadatatargets': 'Metadata Targets',
'wandisco.fusion/migrators/pathmappings': 'Path Mappings',
'wandisco.fusion/migrators/targets': 'Targets',
'microsoft.security/insights/classification': 'Data Sensitivity Security Insights (Preview)',
'microsoft.security/locations/alerts': 'Security Alerts',
};

View File

@ -403,11 +403,11 @@ describe('AzureMonitorDatasource', () => {
.getMetricDefinitions('mock-subscription-id', 'nodesapp')
.then((results: Array<{ text: string; value: string }>) => {
expect(results.length).toEqual(7);
expect(results[0].text).toEqual('Network interface');
expect(results[0].text).toEqual('Network interfaces');
expect(results[0].value).toEqual('Microsoft.Network/networkInterfaces');
expect(results[1].text).toEqual('Virtual machine');
expect(results[1].text).toEqual('Virtual machines');
expect(results[1].value).toEqual('Microsoft.Compute/virtualMachines');
expect(results[2].text).toEqual('Storage account');
expect(results[2].text).toEqual('Storage accounts');
expect(results[2].value).toEqual('Microsoft.Storage/storageAccounts');
expect(results[3].text).toEqual('Microsoft.Storage/storageAccounts/blobServices');
expect(results[3].value).toEqual('Microsoft.Storage/storageAccounts/blobServices');

View File

@ -1,10 +1,10 @@
import { filter, find, startsWith } from 'lodash';
import { find, startsWith } from 'lodash';
import { DataSourceInstanceSettings, ScopedVars } from '@grafana/data';
import { DataSourceWithBackend, getTemplateSrv, isFetchError } from '@grafana/runtime';
import { getTimeSrv, TimeSrv } from 'app/features/dashboard/services/TimeSrv';
import { resourceTypeDisplayNames } from '../azureMetadata';
import { resourceTypeDisplayNames, supportedMetricNamespaces } from '../azureMetadata';
import { getAuthType, getAzureCloud, getAzurePortalUrl } from '../credentials';
import TimegrainConverter from '../time_grain_converter';
import {
@ -24,7 +24,6 @@ import {
import { routeNames } from '../utils/common';
import ResponseParser from './response_parser';
import SupportedNamespaces from './supported_namespaces';
import UrlBuilder from './url_builder';
const defaultDropdownValue = 'select';
@ -42,7 +41,6 @@ export default class AzureMonitorDatasource extends DataSourceWithBackend<AzureM
azurePortalUrl: string;
declare resourceGroup: string;
declare resourceName: string;
supportedMetricNamespaces: string[] = [];
timeSrv: TimeSrv;
constructor(private instanceSettings: DataSourceInstanceSettings<AzureDataSourceJsonData>) {
@ -53,7 +51,6 @@ export default class AzureMonitorDatasource extends DataSourceWithBackend<AzureM
const cloud = getAzureCloud(instanceSettings);
this.resourcePath = routeNames.azureMonitor;
this.supportedMetricNamespaces = new SupportedNamespaces(cloud).get();
this.azurePortalUrl = getAzurePortalUrl(cloud);
}
@ -160,17 +157,16 @@ export default class AzureMonitorDatasource extends DataSourceWithBackend<AzureM
.then((result: AzureMonitorMetricDefinitionsResponse) => {
return ResponseParser.parseResponseValues(result, 'type', 'type');
})
.then((result) => {
return filter(result, (t) => {
for (let i = 0; i < this.supportedMetricNamespaces.length; i++) {
if (t.value.toLowerCase() === this.supportedMetricNamespaces[i].toLowerCase()) {
.then((result) =>
result.filter((t) => {
for (let i = 0; i < supportedMetricNamespaces.length; i++) {
if (t.value.toLowerCase() === supportedMetricNamespaces[i].toLowerCase()) {
return true;
}
}
return false;
});
})
})
)
.then((result) => {
let shouldHardcodeBlobStorage = false;
for (let i = 0; i < result.length; i++) {

View File

@ -1,267 +0,0 @@
export default class SupportedNamespaces {
supportedMetricNamespaces: any = {
azuremonitor: [
'Microsoft.AnalysisServices/servers',
'Microsoft.ApiManagement/service',
'Microsoft.AppConfiguration/configurationStores',
'Microsoft.Automation/automationAccounts',
'Microsoft.Batch/batchAccounts',
'Microsoft.Cache/redis',
'Microsoft.Cdn/cdnwebapplicationfirewallpolicies',
'Microsoft.Cdn/profiles',
'Microsoft.ClassicCompute/virtualMachines',
'Microsoft.ClassicCompute/domainNames',
'Microsoft.CognitiveServices/accounts',
'Microsoft.Compute/virtualMachines',
'Microsoft.Compute/virtualMachineScaleSets',
'Microsoft.ContainerInstance/containerGroups',
'Microsoft.ContainerRegistry/registries',
'Microsoft.ContainerService/managedClusters',
'Microsoft.CustomerInsights/hubs',
'Microsoft.DataBoxEdge/dataBoxEdgeDevices',
'Microsoft.DataFactory/datafactories',
'Microsoft.DataFactory/factories',
'Microsoft.DataLakeAnalytics/accounts',
'Microsoft.DataLakeStore/accounts',
'Microsoft.DBforMariaDB/servers',
'Microsoft.DBforMySQL/servers',
'Microsoft.DBforMySQL/flexibleServers',
'Microsoft.DBforPostgreSQL/servers',
'Microsoft.DBforPostgreSQL/serversv2',
'Microsoft.DBforPostgreSQL/serverGroups',
'Microsoft.DBforPostgreSQL/serverGroupsv2',
'Microsoft.DBforPostgreSQL/flexibleServers',
'Microsoft.Devices/IotHubs',
'Microsoft.Devices/provisioningServices',
'Microsoft.DocumentDB/databaseAccounts',
'Microsoft.EventGrid/topics',
'Microsoft.EventGrid/eventSubscriptions',
'Microsoft.EventGrid/extensionTopics',
'Microsoft.EventHub/namespaces',
'Microsoft.EventHub/clusters',
'Microsoft.HDInsight/clusters',
'Microsoft.Insights/AutoscaleSettings',
'Microsoft.Insights/components',
'Microsoft.KeyVault/vaults',
'Microsoft.Kusto/clusters',
'Microsoft.LocationBasedServices/accounts',
'Microsoft.Logic/workflows',
'Microsoft.Logic/integrationServiceEnvironments',
'Microsoft.NetApp/netAppAccounts/capacityPools',
'Microsoft.NetApp/netAppAccounts/capacityPools/volumes',
'Microsoft.Network/networkInterfaces',
'Microsoft.Network/loadBalancers',
'Microsoft.Network/dnsZones',
'Microsoft.Network/publicIPAddresses',
'Microsoft.Network/azureFirewalls',
'Microsoft.Network/applicationGateways',
'Microsoft.Network/virtualNetworkGateways',
'Microsoft.Network/expressRouteCircuits',
'Microsoft.Network/expressRouteCircuits/Peerings',
'Microsoft.Network/connections',
'Microsoft.Network/trafficManagerProfiles',
'Microsoft.Network/networkWatchers/connectionMonitors',
'Microsoft.Network/frontdoors',
'Microsoft.Network/natGateways',
'Microsoft.Network/vpngateways',
'Microsoft.Network/virtualNetworkGateways',
'Microsoft.NotificationHubs/namespaces/notificationHubs',
'Microsoft.OperationalInsights/workspaces',
'Microsoft.PowerBIDedicated/capacities',
'Microsoft.Relay/namespaces',
'Microsoft.Search/searchServices',
'Microsoft.ServiceBus/namespaces',
'Microsoft.SignalRService/SignalR',
'Microsoft.Sql/servers/databases',
'Microsoft.Sql/servers/elasticPools',
'Microsoft.Sql/managedInstances',
'Microsoft.Storage/storageAccounts',
'Microsoft.Storage/storageAccounts/blobServices',
'Microsoft.Storage/storageAccounts/fileServices',
'Microsoft.Storage/storageAccounts/queueServices',
'Microsoft.Storage/storageAccounts/tableServices',
'Microsoft.StorageSync/storageSyncServices',
'Microsoft.StorageSync/storageSyncServices/syncGroups',
'Microsoft.StorageSync/storageSyncServices/syncGroups/serverEndpoints',
'Microsoft.StorageSync/storageSyncServices/registeredServers',
'Microsoft.StreamAnalytics/streamingJobs',
'Microsoft.Web/serverfarms',
'Microsoft.Web/sites',
'Microsoft.Web/sites/slots',
'Microsoft.Web/hostingEnvironments/multiRolePools',
'Microsoft.Web/hostingEnvironments/workerPools',
],
govazuremonitor: [
'Microsoft.AnalysisServices/servers',
'Microsoft.ApiManagement/service',
'Microsoft.Batch/batchAccounts',
'Microsoft.Cache/redis',
'Microsoft.Cdn/cdnwebapplicationfirewallpolicies',
'Microsoft.Cdn/profiles',
'Microsoft.ClassicCompute/virtualMachines',
'Microsoft.ClassicCompute/domainNames',
'Microsoft.CognitiveServices/accounts',
'Microsoft.Compute/virtualMachines',
'Microsoft.Compute/virtualMachineScaleSets',
'Microsoft.ContainerRegistry/registries',
'Microsoft.DBforMySQL/servers',
'Microsoft.DBforPostgreSQL/servers',
'Microsoft.DBforPostgreSQL/serversv2',
'Microsoft.Devices/IotHubs',
'Microsoft.Devices/provisioningServices',
'Microsoft.EventGrid/topics',
'Microsoft.EventGrid/eventSubscriptions',
'Microsoft.EventGrid/extensionTopics',
'Microsoft.EventHub/namespaces',
'Microsoft.EventHub/clusters',
'Microsoft.Insights/AutoscaleSettings',
'Microsoft.Insights/components',
'Microsoft.KeyVault/vaults',
'Microsoft.Logic/workflows',
'Microsoft.Network/networkInterfaces',
'Microsoft.Network/loadBalancers',
'Microsoft.Network/dnsZones',
'Microsoft.Network/publicIPAddresses',
'Microsoft.Network/azureFirewalls',
'Microsoft.Network/applicationGateways',
'Microsoft.Network/virtualNetworkGateways',
'Microsoft.Network/expressRouteCircuits',
'Microsoft.Network/expressRouteCircuits/Peerings',
'Microsoft.Network/connections',
'Microsoft.Network/trafficManagerProfiles',
'Microsoft.Network/networkWatchers/connectionMonitors',
'Microsoft.Network/frontdoors',
'Microsoft.NotificationHubs/namespaces/notificationHubs',
'Microsoft.OperationalInsights/workspaces',
'Microsoft.PowerBIDedicated/capacities',
'Microsoft.Relay/namespaces',
'Microsoft.ServiceBus/namespaces',
'Microsoft.Sql/servers/databases',
'Microsoft.Sql/servers/elasticPools',
'Microsoft.Sql/managedInstances',
'Microsoft.Storage/storageAccounts',
'Microsoft.Storage/storageAccounts/blobServices',
'Microsoft.Storage/storageAccounts/fileServices',
'Microsoft.Storage/storageAccounts/queueServices',
'Microsoft.Storage/storageAccounts/tableServices',
'Microsoft.Web/serverfarms',
'Microsoft.Web/sites',
'Microsoft.Web/sites/slots',
'Microsoft.Web/hostingEnvironments/multiRolePools',
'Microsoft.Web/hostingEnvironments/workerPools',
],
germanyazuremonitor: [
'Microsoft.AnalysisServices/servers',
'Microsoft.Batch/batchAccounts',
'Microsoft.Cache/redis',
'Microsoft.Cdn/cdnwebapplicationfirewallpolicies',
'Microsoft.Cdn/profiles',
'Microsoft.ClassicCompute/virtualMachines',
'Microsoft.ClassicCompute/domainNames',
'Microsoft.Compute/virtualMachines',
'Microsoft.Compute/virtualMachineScaleSets',
'Microsoft.DBforMySQL/servers',
'Microsoft.DBforPostgreSQL/servers',
'Microsoft.DBforPostgreSQL/serversv2',
'Microsoft.Devices/IotHubs',
'Microsoft.Devices/provisioningServices',
'Microsoft.EventHub/namespaces',
'Microsoft.EventHub/clusters',
'Microsoft.Insights/AutoscaleSettings',
'Microsoft.Insights/components',
'Microsoft.KeyVault/vaults',
'Microsoft.Network/networkInterfaces',
'Microsoft.Network/loadBalancers',
'Microsoft.Network/dnsZones',
'Microsoft.Network/publicIPAddresses',
'Microsoft.Network/azureFirewalls',
'Microsoft.Network/applicationGateways',
'Microsoft.Network/virtualNetworkGateways',
'Microsoft.Network/expressRouteCircuits',
'Microsoft.Network/expressRouteCircuits/Peerings',
'Microsoft.Network/connections',
'Microsoft.Network/trafficManagerProfiles',
'Microsoft.Network/networkWatchers/connectionMonitors',
'Microsoft.Network/frontdoors',
'Microsoft.NotificationHubs/namespaces/notificationHubs',
'Microsoft.OperationalInsights/workspaces',
'Microsoft.PowerBIDedicated/capacities',
'Microsoft.Relay/namespaces',
'Microsoft.ServiceBus/namespaces',
'Microsoft.Sql/servers/databases',
'Microsoft.Sql/servers/elasticPools',
'Microsoft.Sql/managedInstances',
'Microsoft.Storage/storageAccounts',
'Microsoft.Storage/storageAccounts/blobServices',
'Microsoft.Storage/storageAccounts/fileServices',
'Microsoft.Storage/storageAccounts/queueServices',
'Microsoft.Storage/storageAccounts/tableServices',
'Microsoft.StreamAnalytics/streamingJobs',
'Microsoft.Web/serverfarms',
'Microsoft.Web/sites',
'Microsoft.Web/sites/slots',
'Microsoft.Web/hostingEnvironments/multiRolePools',
'Microsoft.Web/hostingEnvironments/workerPools',
],
chinaazuremonitor: [
'Microsoft.AnalysisServices/servers',
'Microsoft.Batch/batchAccounts',
'Microsoft.Cache/redis',
'Microsoft.Cdn/cdnwebapplicationfirewallpolicies',
'Microsoft.Cdn/profiles',
'Microsoft.ClassicCompute/virtualMachines',
'Microsoft.ClassicCompute/domainNames',
'Microsoft.CognitiveServices/accounts',
'Microsoft.Compute/virtualMachines',
'Microsoft.Compute/virtualMachineScaleSets',
'Microsoft.ContainerRegistry/registries',
'Microsoft.DBforMySQL/servers',
'Microsoft.DBforPostgreSQL/servers',
'Microsoft.DBforPostgreSQL/serversv2',
'Microsoft.Devices/IotHubs',
'Microsoft.Devices/provisioningServices',
'Microsoft.EventHub/namespaces',
'Microsoft.Insights/AutoscaleSettings',
'Microsoft.Insights/components',
'Microsoft.KeyVault/vaults',
'Microsoft.Logic/workflows',
'Microsoft.Network/networkInterfaces',
'Microsoft.Network/loadBalancers',
'Microsoft.Network/dnsZones',
'Microsoft.Network/publicIPAddresses',
'Microsoft.Network/azureFirewalls',
'Microsoft.Network/applicationGateways',
'Microsoft.Network/virtualNetworkGateways',
'Microsoft.Network/expressRouteCircuits',
'Microsoft.Network/expressRouteCircuits/Peerings',
'Microsoft.Network/connections',
'Microsoft.Network/trafficManagerProfiles',
'Microsoft.Network/networkWatchers/connectionMonitors',
'Microsoft.Network/frontdoors',
'Microsoft.NotificationHubs/namespaces/notificationHubs',
'Microsoft.PowerBIDedicated/capacities',
'Microsoft.Relay/namespaces',
'Microsoft.ServiceBus/namespaces',
'Microsoft.Sql/servers/databases',
'Microsoft.Sql/servers/elasticPools',
'Microsoft.Sql/managedInstances',
'Microsoft.Storage/storageAccounts',
'Microsoft.Storage/storageAccounts/blobServices',
'Microsoft.Storage/storageAccounts/fileServices',
'Microsoft.Storage/storageAccounts/queueServices',
'Microsoft.Storage/storageAccounts/tableServices',
'Microsoft.StreamAnalytics/streamingJobs',
'Microsoft.Web/serverfarms',
'Microsoft.Web/sites',
'Microsoft.Web/sites/slots',
'Microsoft.Web/hostingEnvironments/multiRolePools',
'Microsoft.Web/hostingEnvironments/workerPools',
],
};
constructor(private cloudName: string) {}
get(): string[] {
return this.supportedMetricNamespaces[this.cloudName];
}
}

View File

@ -58,6 +58,7 @@ const LogsQueryEditor: React.FC<LogsQueryEditorProps> = ({
]}
setResource={setResource}
resourceUri={query.azureLogAnalytics?.resource}
queryType="logs"
/>
</EditorFieldGroup>
</EditorRow>
@ -106,6 +107,7 @@ const LogsQueryEditor: React.FC<LogsQueryEditorProps> = ({
]}
setResource={setResource}
resourceUri={query.azureLogAnalytics?.resource}
queryType="logs"
/>
<QueryField

View File

@ -59,6 +59,7 @@ const MetricsQueryEditor: React.FC<MetricsQueryEditorProps> = ({
selectableEntryTypes={[ResourceRowType.Resource]}
setResource={setResource}
resourceUri={query.azureMonitor?.resourceUri}
queryType={'metrics'}
/>
<MetricNamespaceField
metricNamespaces={metricNamespaces}
@ -146,6 +147,7 @@ const MetricsQueryEditor: React.FC<MetricsQueryEditorProps> = ({
selectableEntryTypes={[ResourceRowType.Resource]}
setResource={setResource}
resourceUri={query.azureMonitor?.resourceUri}
queryType="metrics"
/>
</InlineFieldRow>

View File

@ -4,6 +4,7 @@ import React, { useCallback, useEffect, useState } from 'react';
import { Button, Icon, Modal, useStyles2 } from '@grafana/ui';
import Datasource from '../../datasource';
import { ResourcePickerQueryType } from '../../resourcePicker/resourcePickerData';
import { AzureQueryEditorFieldProps, AzureMonitorQuery, AzureResourceSummaryItem } from '../../types';
import { Field } from '../Field';
import ResourcePicker from '../ResourcePicker';
@ -28,6 +29,7 @@ function parseResourceDetails(resourceURI: string) {
interface ResourceFieldProps extends AzureQueryEditorFieldProps {
setResource: (query: AzureMonitorQuery, resourceURI?: string) => AzureMonitorQuery;
selectableEntryTypes: ResourceRowType[];
queryType: ResourcePickerQueryType;
resourceUri?: string;
inlineField?: boolean;
labelWidth?: number;
@ -39,6 +41,7 @@ const ResourceField: React.FC<ResourceFieldProps> = ({
onQueryChange,
setResource,
selectableEntryTypes,
queryType,
resourceUri,
inlineField,
labelWidth,
@ -79,6 +82,7 @@ const ResourceField: React.FC<ResourceFieldProps> = ({
onApply={handleApply}
onCancel={closePicker}
selectableEntryTypes={selectableEntryTypes}
queryType={queryType}
/>
</Modal>
<Field label="Resource" inlineField={inlineField} labelWidth={labelWidth}>

View File

@ -9,7 +9,7 @@ import {
mockResourcesByResourceGroup,
mockSearchResults,
} from '../../__mocks__/resourcePickerRows';
import ResourcePickerData from '../../resourcePicker/resourcePickerData';
import ResourcePickerData, { ResourcePickerQueryType } from '../../resourcePicker/resourcePickerData';
import { ResourceRowType } from './types';
@ -37,6 +37,8 @@ function createMockResourcePickerData() {
return mockResourcePicker;
}
const queryType: ResourcePickerQueryType = 'logs';
const defaultProps = {
templateVariables: [],
resourceURI: noResourceURI,
@ -49,6 +51,7 @@ const defaultProps = {
ResourceRowType.Resource,
ResourceRowType.Variable,
],
queryType,
};
describe('AzureMonitor ResourcePicker', () => {

View File

@ -4,7 +4,7 @@ import { useEffectOnce } from 'react-use';
import { Alert, Button, Icon, Input, LoadingPlaceholder, Tooltip, useStyles2, Collapse, Label } from '@grafana/ui';
import ResourcePickerData from '../../resourcePicker/resourcePickerData';
import ResourcePickerData, { ResourcePickerQueryType } from '../../resourcePicker/resourcePickerData';
import messageFromError from '../../utils/messageFromError';
import { Space } from '../Space';
@ -18,6 +18,7 @@ interface ResourcePickerProps {
resourcePickerData: ResourcePickerData;
resourceURI: string | undefined;
selectableEntryTypes: ResourceRowType[];
queryType: ResourcePickerQueryType;
onApply: (resourceURI: string | undefined) => void;
onCancel: () => void;
@ -29,6 +30,7 @@ const ResourcePicker = ({
onApply,
onCancel,
selectableEntryTypes,
queryType,
}: ResourcePickerProps) => {
const styles = useStyles2(getStyles);
@ -49,14 +51,14 @@ const ResourcePicker = ({
if (!isLoading) {
try {
setIsLoading(true);
const resources = await resourcePickerData.fetchInitialRows(internalSelectedURI || '');
const resources = await resourcePickerData.fetchInitialRows(queryType, internalSelectedURI || '');
setRows(resources);
} catch (error) {
setErrorMessage(messageFromError(error));
}
setIsLoading(false);
}
}, [internalSelectedURI, isLoading, resourcePickerData]);
}, [internalSelectedURI, isLoading, resourcePickerData, queryType]);
useEffectOnce(() => {
loadInitialData();
@ -91,14 +93,14 @@ const ResourcePicker = ({
}
try {
const nestedRows = await resourcePickerData.fetchAndAppendNestedRow(rows, parentRow);
const nestedRows = await resourcePickerData.fetchAndAppendNestedRow(rows, parentRow, queryType);
setRows(nestedRows);
} catch (error) {
setErrorMessage(messageFromError(error));
throw error;
}
},
[resourcePickerData, rows]
[resourcePickerData, rows, queryType]
);
const handleSelectionChanged = useCallback((row: ResourceRow, isSelected: boolean) => {
@ -122,8 +124,7 @@ const ResourcePicker = ({
try {
setIsLoading(true);
const searchType = selectableEntryTypes.length > 1 ? 'logs' : 'metrics';
const searchResults = await resourcePickerData.search(searchWord, searchType);
const searchResults = await resourcePickerData.search(searchWord, queryType);
setRows(searchResults);
if (searchResults.length >= resourcePickerData.resultLimit) {
setShouldShowLimitFlag(true);
@ -133,7 +134,7 @@ const ResourcePicker = ({
}
setIsLoading(false);
},
[loadInitialData, selectableEntryTypes.length, resourcePickerData]
[loadInitialData, resourcePickerData, queryType]
);
return (

View File

@ -106,7 +106,7 @@ describe('AzureMonitor resourcePickerData', () => {
it('makes 1 call to ARG with the correct path and query arguments', async () => {
const mockResponse = createMockARGResourceGroupsResponse();
const { resourcePickerData, postResource } = createResourcePickerData([mockResponse]);
await resourcePickerData.getResourceGroupsBySubscriptionId('123');
await resourcePickerData.getResourceGroupsBySubscriptionId('123', 'logs');
expect(postResource).toBeCalledTimes(1);
const firstCall = postResource.mock.calls[0];
@ -115,11 +115,12 @@ describe('AzureMonitor resourcePickerData', () => {
expect(postBody.query).toContain("type == 'microsoft.resources/subscriptions/resourcegroups'");
expect(postBody.query).toContain("where subscriptionId == '123'");
});
it('returns formatted resourceGroups', async () => {
const mockResponse = createMockARGResourceGroupsResponse();
const { resourcePickerData } = createResourcePickerData([mockResponse]);
const resourceGroups = await resourcePickerData.getResourceGroupsBySubscriptionId('123');
const resourceGroups = await resourcePickerData.getResourceGroupsBySubscriptionId('123', 'logs');
expect(resourceGroups.length).toEqual(6);
expect(resourceGroups[0]).toEqual({
id: 'prod',
@ -139,7 +140,7 @@ describe('AzureMonitor resourcePickerData', () => {
const response2 = createMockARGResourceGroupsResponse();
const { resourcePickerData, postResource } = createResourcePickerData([response1, response2]);
await resourcePickerData.getResourceGroupsBySubscriptionId('123');
await resourcePickerData.getResourceGroupsBySubscriptionId('123', 'logs');
expect(postResource).toHaveBeenCalledTimes(2);
const secondCall = postResource.mock.calls[1];
@ -155,7 +156,7 @@ describe('AzureMonitor resourcePickerData', () => {
const response2 = createMockARGResourceGroupsResponse();
const { resourcePickerData } = createResourcePickerData([response1, response2]);
const resourceGroups = await resourcePickerData.getResourceGroupsBySubscriptionId('123');
const resourceGroups = await resourcePickerData.getResourceGroupsBySubscriptionId('123', 'logs');
expect(resourceGroups.length).toEqual(12);
expect(resourceGroups[0]).toEqual({
@ -179,7 +180,7 @@ describe('AzureMonitor resourcePickerData', () => {
};
const { resourcePickerData } = createResourcePickerData([mockResponse]);
try {
await resourcePickerData.getResourceGroupsBySubscriptionId('123');
await resourcePickerData.getResourceGroupsBySubscriptionId('123', 'logs');
throw Error('expected getResourceGroupsBySubscriptionId to fail but it succeeded');
} catch (err) {
if (err instanceof Error) {
@ -189,13 +190,24 @@ describe('AzureMonitor resourcePickerData', () => {
}
}
});
it('filters by metric specific resources', async () => {
const mockResponse = createMockARGResourceGroupsResponse();
const { resourcePickerData, postResource } = createResourcePickerData([mockResponse]);
await resourcePickerData.getResourceGroupsBySubscriptionId('123', 'metrics');
expect(postResource).toBeCalledTimes(1);
const firstCall = postResource.mock.calls[0];
const [_, postBody] = firstCall;
expect(postBody.query).toContain('wandisco.fusion/migrators');
});
});
describe('getResourcesForResourceGroup', () => {
it('makes 1 call to ARG with the correct path and query arguments', async () => {
const mockResponse = createARGResourcesResponse();
const { resourcePickerData, postResource } = createResourcePickerData([mockResponse]);
await resourcePickerData.getResourcesForResourceGroup('dev');
await resourcePickerData.getResourcesForResourceGroup('dev', 'logs');
expect(postResource).toBeCalledTimes(1);
const firstCall = postResource.mock.calls[0];
@ -204,11 +216,12 @@ describe('AzureMonitor resourcePickerData', () => {
expect(postBody.query).toContain('resources');
expect(postBody.query).toContain('where id hasprefix "dev"');
});
it('returns formatted resources', async () => {
const mockResponse = createARGResourcesResponse();
const { resourcePickerData } = createResourcePickerData([mockResponse]);
const resources = await resourcePickerData.getResourcesForResourceGroup('dev');
const resources = await resourcePickerData.getResourcesForResourceGroup('dev', 'logs');
expect(resources.length).toEqual(4);
expect(resources[0]).toEqual({
@ -237,7 +250,7 @@ describe('AzureMonitor resourcePickerData', () => {
};
const { resourcePickerData } = createResourcePickerData([mockResponse]);
try {
await resourcePickerData.getResourcesForResourceGroup('dev');
await resourcePickerData.getResourcesForResourceGroup('dev', 'logs');
throw Error('expected getResourcesForResourceGroup to fail but it succeeded');
} catch (err) {
if (err instanceof Error) {
@ -247,6 +260,17 @@ describe('AzureMonitor resourcePickerData', () => {
}
}
});
it('should filter metrics resources', async () => {
const mockResponse = createARGResourcesResponse();
const { resourcePickerData, postResource } = createResourcePickerData([mockResponse]);
await resourcePickerData.getResourcesForResourceGroup('dev', 'metrics');
expect(postResource).toBeCalledTimes(1);
const firstCall = postResource.mock.calls[0];
const [_, postBody] = firstCall;
expect(postBody.query).toContain('wandisco.fusion/migrators');
});
});
describe('search', () => {
@ -277,7 +301,7 @@ describe('AzureMonitor resourcePickerData', () => {
type: 'Resource',
location: 'North Europe',
resourceGroupName: 'rgName',
typeLabel: 'Virtual machine',
typeLabel: 'Virtual machines',
uri: '/subscriptions/subId/resourceGroups/rgName/providers/Microsoft.Compute/virtualMachines/vmname',
});
});
@ -307,7 +331,7 @@ describe('AzureMonitor resourcePickerData', () => {
type: 'ResourceGroup',
location: 'North Europe',
resourceGroupName: 'rgName',
typeLabel: 'Resource Group',
typeLabel: 'Resource groups',
uri: '/subscriptions/subId/resourceGroups/rgName',
});
});

View File

@ -4,13 +4,12 @@ import { DataSourceInstanceSettings } from '../../../../../../packages/grafana-d
import {
locationDisplayNames,
logsSupportedLocationsKusto,
logsSupportedResourceTypesKusto,
logsResourceTypes,
resourceTypeDisplayNames,
supportedMetricNamespaces,
} from '../azureMetadata';
import SupportedNamespaces from '../azure_monitor/supported_namespaces';
import { ResourceRow, ResourceRowGroup, ResourceRowType } from '../components/ResourcePicker/types';
import { addResources, parseResourceURI } from '../components/ResourcePicker/utils';
import { getAzureCloud } from '../credentials';
import {
AzureDataSourceJsonData,
AzureGraphResponse,
@ -24,19 +23,22 @@ import {
import { routeNames } from '../utils/common';
const RESOURCE_GRAPH_URL = '/providers/Microsoft.ResourceGraph/resources?api-version=2021-03-01';
const logsSupportedResourceTypesKusto = logsResourceTypes.map((v) => `"${v}"`).join(',');
const supportedMetricNamespacesKusto = supportedMetricNamespaces.map((v) => `"${v.toLocaleLowerCase()}"`).join(',');
export type ResourcePickerQueryType = 'logs' | 'metrics';
export default class ResourcePickerData extends DataSourceWithBackend<AzureMonitorQuery, AzureDataSourceJsonData> {
private resourcePath: string;
private supportedMetricNamespaces: string[];
resultLimit = 200;
constructor(instanceSettings: DataSourceInstanceSettings<AzureDataSourceJsonData>) {
super(instanceSettings);
this.resourcePath = `${routeNames.resourceGraph}`;
const cloud = getAzureCloud(instanceSettings);
this.supportedMetricNamespaces = new SupportedNamespaces(cloud).get();
}
async fetchInitialRows(currentSelection?: string): Promise<ResourceRowGroup> {
async fetchInitialRows(type: ResourcePickerQueryType, currentSelection?: string): Promise<ResourceRowGroup> {
const subscriptions = await this.getSubscriptions();
if (!currentSelection) {
return subscriptions;
@ -48,46 +50,44 @@ export default class ResourcePickerData extends DataSourceWithBackend<AzureMonit
const resourceGroupURI = `/subscriptions/${parsedURI.subscriptionID}/resourceGroups/${parsedURI.resourceGroup}`;
if (parsedURI.resourceGroup) {
const resourceGroups = await this.getResourceGroupsBySubscriptionId(parsedURI.subscriptionID);
const resourceGroups = await this.getResourceGroupsBySubscriptionId(parsedURI.subscriptionID, type);
resources = addResources(resources, `/subscriptions/${parsedURI.subscriptionID}`, resourceGroups);
}
if (parsedURI.resource) {
const resourcesForResourceGroup = await this.getResourcesForResourceGroup(resourceGroupURI);
const resourcesForResourceGroup = await this.getResourcesForResourceGroup(resourceGroupURI, type);
resources = addResources(resources, resourceGroupURI, resourcesForResourceGroup);
}
}
return resources;
}
async fetchAndAppendNestedRow(rows: ResourceRowGroup, parentRow: ResourceRow): Promise<ResourceRowGroup> {
async fetchAndAppendNestedRow(
rows: ResourceRowGroup,
parentRow: ResourceRow,
type: ResourcePickerQueryType
): Promise<ResourceRowGroup> {
const nestedRows =
parentRow.type === ResourceRowType.Subscription
? await this.getResourceGroupsBySubscriptionId(parentRow.id)
: await this.getResourcesForResourceGroup(parentRow.id);
? await this.getResourceGroupsBySubscriptionId(parentRow.id, type)
: await this.getResourcesForResourceGroup(parentRow.id, type);
return addResources(rows, parentRow.uri, nestedRows);
}
search = async (searchPhrase: string, searchType: 'logs' | 'metrics'): Promise<ResourceRowGroup> => {
const searchQuery = {
metrics: `
resources
search = async (searchPhrase: string, searchType: ResourcePickerQueryType): Promise<ResourceRowGroup> => {
let searchQuery = 'resources';
if (searchType === 'logs') {
searchQuery += `
| union resourcecontainers`;
}
searchQuery += `
| where id contains "${searchPhrase}"
| where type in (${this.supportedMetricNamespaces.map((ns) => `"${ns.toLowerCase()}"`).join(',')})
${this.filterByType(searchType)}
| order by tolower(name) asc
| limit ${this.resultLimit}
`,
logs: `
resources
| union resourcecontainers
| where id contains "${searchPhrase}"
| where type in (${logsSupportedResourceTypesKusto})
| order by tolower(name) asc
| limit ${this.resultLimit}
`,
};
const { data: response } = await this.makeResourceGraphRequest<RawAzureResourceItem[]>(searchQuery[searchType]);
`;
const { data: response } = await this.makeResourceGraphRequest<RawAzureResourceItem[]>(searchQuery);
return response.map((item) => {
const parsedUri = parseResourceURI(item.id);
if (!parsedUri || !(parsedUri.resource || parsedUri.resourceGroup || parsedUri.subscriptionID)) {
@ -158,7 +158,10 @@ export default class ResourcePickerData extends DataSourceWithBackend<AzureMonit
}));
}
async getResourceGroupsBySubscriptionId(subscriptionId: string): Promise<ResourceRowGroup> {
async getResourceGroupsBySubscriptionId(
subscriptionId: string,
type: ResourcePickerQueryType
): Promise<ResourceRowGroup> {
const query = `
resources
| join kind=inner (
@ -167,7 +170,7 @@ export default class ResourcePickerData extends DataSourceWithBackend<AzureMonit
| project resourceGroupURI=id, resourceGroupName=name, resourceGroup, subscriptionId
) on resourceGroup, subscriptionId
| where type in (${logsSupportedResourceTypesKusto})
${this.filterByType(type)}
| where subscriptionId == '${subscriptionId}'
| summarize count() by resourceGroupName, resourceGroupURI
| order by resourceGroupURI asc`;
@ -205,11 +208,14 @@ export default class ResourcePickerData extends DataSourceWithBackend<AzureMonit
});
}
async getResourcesForResourceGroup(resourceGroupId: string): Promise<ResourceRowGroup> {
async getResourcesForResourceGroup(
resourceGroupId: string,
type: ResourcePickerQueryType
): Promise<ResourceRowGroup> {
const { data: response } = await this.makeResourceGraphRequest<RawAzureResourceItem[]>(`
resources
| where id hasprefix "${resourceGroupId}"
| where type in (${logsSupportedResourceTypesKusto}) and location in (${logsSupportedLocationsKusto})
${this.filterByType(type)} and location in (${logsSupportedLocationsKusto})
`);
return response.map((item) => {
@ -316,4 +322,10 @@ export default class ResourcePickerData extends DataSourceWithBackend<AzureMonit
throw error;
}
}
private filterByType = (t: ResourcePickerQueryType) => {
return t === 'logs'
? `| where type in (${logsSupportedResourceTypesKusto})`
: `| where type in (${supportedMetricNamespacesKusto})`;
};
}