diff --git a/collectors/azure/collector.js b/collectors/azure/collector.js index c156deec86..61c9d427ec 100644 --- a/collectors/azure/collector.js +++ b/collectors/azure/collector.js @@ -213,6 +213,13 @@ var postcalls = { url: 'https://management.azure.com/{id}/securityAlertPolicies?api-version=2017-03-01-preview' } }, + failoverGroups: { + listByServer: { + reliesOnPath: 'servers.listSql', + properties: ['id'], + url: 'https://management.azure.com/{id}/failoverGroups?api-version=2017-03-01-preview' + } + }, serverAutomaticTuning: { get: { reliesOnPath: 'servers.listSql', diff --git a/exports.js b/exports.js index ea3787d9f4..736e2a8e22 100644 --- a/exports.js +++ b/exports.js @@ -383,6 +383,7 @@ module.exports = { 'scaleSetMultiAz' : require(__dirname + '/plugins/azure/virtualmachines/scaleSetMultiAz.js'), 'scaleSetAutoscaleEnabled' : require(__dirname + '/plugins/azure/virtualmachines/scaleSetAutoscaleEnabled.js'), 'vmAvailabilitySetLimit' : require(__dirname + '/plugins/azure/virtualmachines/vmAvailabilitySetLimit.js'), + 'premiumSsdDisabled' : require(__dirname + '/plugins/azure/virtualmachines/premiumSsdDisabled.js'), 'vmManagedDisks' : require(__dirname + '/plugins/azure/virtualmachines/vmManagedDisks.js'), 'autoInstanceRepairsEnabled' : require(__dirname + '/plugins/azure/virtualmachines/autoInstanceRepairsEnabled.js'), 'noEmptyScaleSets' : require(__dirname + '/plugins/azure/virtualmachines/noEmptyScaleSets.js'), @@ -482,6 +483,7 @@ module.exports = { 'serverAuditingEnabled' : require(__dirname + '/plugins/azure/sqlserver/serverAuditingEnabled.js'), 'azureADAdminEnabled' : require(__dirname + '/plugins/azure/sqlserver/azureADAdminEnabled.js'), 'sqlServerTlsVersion' : require(__dirname + '/plugins/azure/sqlserver/sqlServerTlsVersion.js'), + 'autoFailoverGroupsEnabled' : require(__dirname + '/plugins/azure/sqlserver/autoFailoverGroupsEnabled.js'), 'automaticTuningEnabled' : require(__dirname + '/plugins/azure/sqlserver/automaticTuningEnabled.js'), 'javaVersion' : require(__dirname + '/plugins/azure/appservice/javaVersion.js'), @@ -495,6 +497,7 @@ module.exports = { 'httpsOnlyEnabled' : require(__dirname + '/plugins/azure/appservice/httpsOnlyEnabled.js'), 'tlsVersionCheck' : require(__dirname + '/plugins/azure/appservice/tlsVersionCheck.js'), 'appserviceAutomatedBackups' : require(__dirname + '/plugins/azure/appservice/appserviceAutomatedBackups.js'), + 'alwaysOnEnabled' : require(__dirname + '/plugins/azure/appservice/alwaysOnEnabled.js'), 'rbacEnabled' : require(__dirname + '/plugins/azure/kubernetesservice/rbacEnabled.js'), 'aksLatestVersion' : require(__dirname + '/plugins/azure/kubernetesservice/aksLatestVersion.js'), diff --git a/plugins/azure/appservice/alwaysOnEnabled.js b/plugins/azure/appservice/alwaysOnEnabled.js new file mode 100644 index 0000000000..2e956ac4b6 --- /dev/null +++ b/plugins/azure/appservice/alwaysOnEnabled.js @@ -0,0 +1,64 @@ +var async = require('async'); +var helpers = require('../../../helpers/azure'); + +module.exports = { + title: 'Web Apps Always On Enabled', + category: 'App Service', + description: 'Ensures that Azure Web Apps have Always On feature enabled.', + more_info: 'Always On feature keeps the app loaded even when there\'s no traffic. It\'s required for continuous WebJobs or for WebJobs that are triggered using a CRON expression.', + recommended_action: 'Enable Always On feature for Azure Web Apps', + link: 'https://docs.microsoft.com/en-us/azure/app-service/configure-common', + apis: ['webApps:list', 'webApps:listConfigurations'], + + run: function(cache, settings, callback) { + var results = []; + var source = {}; + var locations = helpers.locations(settings.govcloud); + + async.each(locations.webApps, function(location, rcb) { + const webApps = helpers.addSource(cache, source, + ['webApps', 'list', location]); + + if (!webApps) return rcb(); + + if (webApps.err || !webApps.data) { + helpers.addResult(results, 3, 'Unable to query for Web Apps: ' + helpers.addError(webApps), location); + return rcb(); + } + + if (!webApps.data.length) { + helpers.addResult(results, 0, 'No existing Web Apps found', location); + return rcb(); + } + + async.each(webApps.data, function(webApp, scb) { + if (webApp && webApp.kind && webApp.kind === 'functionapp') { + helpers.addResult(results, 0, 'Always On feature can not be configured for the function App', location, webApp.id); + return scb(); + } + + const configs = helpers.addSource(cache, source, + ['webApps', 'listConfigurations', location, webApp.id]); + + if (!configs || configs.err || !configs.data || !configs.data.length) { + helpers.addResult(results, 3, 'Unable to query for Web App Configs: ' + helpers.addError(configs), location); + return scb(); + } + + const alwaysOnEnabled = configs.data.some(config => config.alwaysOn); + if (alwaysOnEnabled) { + helpers.addResult(results, 0, 'Always On feature is enabled for the Web App', location, webApp.id); + } else { + helpers.addResult(results, 2, 'Always On feature is disabled for the Web App', location, webApp.id); + } + + scb(); + }, function() { + rcb(); + }); + }, function() { + // Global checking goes here + callback(null, results, source); + }); + } +}; diff --git a/plugins/azure/appservice/alwaysOnEnabled.spec.js b/plugins/azure/appservice/alwaysOnEnabled.spec.js new file mode 100644 index 0000000000..14f782071b --- /dev/null +++ b/plugins/azure/appservice/alwaysOnEnabled.spec.js @@ -0,0 +1,143 @@ +var expect = require('chai').expect; +var alwaysOnEnabled = require('./alwaysOnEnabled'); + +const webApps = [ + { + 'id': '/subscriptions/123/resourceGroups/aqua-resource-group/providers/Microsoft.Web/sites/test-app', + 'name': 'test-app', + 'type': 'Microsoft.Web/sites', + 'kind': 'app,linux', + 'location': 'East US' + }, + { + 'id': '/subscriptions/123/resourceGroups/aqua-resource-group/providers/Microsoft.Web/sites/test-app', + 'name': 'test-app', + 'type': 'Microsoft.Web/sites', + 'kind': 'functionapp', + 'location': 'East US' + } +]; + +const configs = [ + { + 'id': '/subscriptions/123/resourceGroups/aqua-resource-group/providers/Microsoft.Web/sites/test-app', + 'name': 'test-app', + 'type': 'Microsoft.Web/sites', + 'location': 'East US', + 'alwaysOn': true + }, + { + 'id': '/subscriptions/123/resourceGroups/aqua-resource-group/providers/Microsoft.Web/sites/test-app', + 'name': 'test-app', + 'type': 'Microsoft.Web/sites', + 'location': 'East US', + 'alwaysOn': false + } +]; + +const createCache = (webApps, configs) => { + let app = {}; + let config = {}; + + if (webApps) { + app['data'] = webApps; + if (webApps && webApps.length) { + config[webApps[0].id] = { + 'data': configs + }; + } + } + + return { + webApps: { + list: { + 'eastus': app + }, + listConfigurations: { + 'eastus': config + } + } + }; +}; + +describe('alwaysOnEnabled', function() { + describe('run', function() { + it('should give passing result if no web apps', function(done) { + const cache = createCache([]); + alwaysOnEnabled.run(cache, {}, (err, results) => { + expect(results.length).to.equal(1); + expect(results[0].status).to.equal(0); + expect(results[0].message).to.include('No existing Web Apps found'); + expect(results[0].region).to.equal('eastus'); + done(); + }); + }); + + it('should give unknown result if unable to query for web apps', function(done) { + const cache = createCache(); + alwaysOnEnabled.run(cache, {}, (err, results) => { + expect(results.length).to.equal(1); + expect(results[0].status).to.equal(3); + expect(results[0].message).to.include('Unable to query for Web Apps'); + expect(results[0].region).to.equal('eastus'); + done(); + }); + }); + + it('should give passing result if always on can not be configured', function(done) { + const cache = createCache([webApps[1]], []); + alwaysOnEnabled.run(cache, {}, (err, results) => { + expect(results.length).to.equal(1); + expect(results[0].status).to.equal(0); + expect(results[0].message).to.include('Always On feature can not be configured for the function App'); + expect(results[0].region).to.equal('eastus'); + done(); + }); + }); + + + it('should give unknown result if no web app configs', function(done) { + const cache = createCache([webApps[0]], []); + alwaysOnEnabled.run(cache, {}, (err, results) => { + expect(results.length).to.equal(1); + expect(results[0].status).to.equal(3); + expect(results[0].message).to.include('Unable to query for Web App Configs:'); + expect(results[0].region).to.equal('eastus'); + done(); + }); + }); + + it('should give unknown result if unable to query for web app configs', function(done) { + const cache = createCache([webApps[0]]); + alwaysOnEnabled.run(cache, {}, (err, results) => { + expect(results.length).to.equal(1); + expect(results[0].status).to.equal(3); + expect(results[0].message).to.include('Unable to query for Web App Configs:'); + expect(results[0].region).to.equal('eastus'); + done(); + }); + }); + + it('should give passing result if always on is enabled', function(done) { + const cache = createCache([webApps[0]], [configs[0]]); + alwaysOnEnabled.run(cache, {}, (err, results) => { + expect(results.length).to.equal(1); + expect(results[0].status).to.equal(0); + expect(results[0].message).to.include('Always On feature is enabled for the Web App'); + expect(results[0].region).to.equal('eastus'); + done(); + }); + }); + + it('should give failing result if always on is disabled', function(done) { + const cache = createCache([webApps[0]], [configs[1]]); + alwaysOnEnabled.run(cache, {}, (err, results) => { + expect(results.length).to.equal(1); + expect(results[0].status).to.equal(2); + expect(results[0].message).to.include('Always On feature is disabled for the Web App'); + expect(results[0].region).to.equal('eastus'); + done(); + }); + }); + }); +}); \ No newline at end of file diff --git a/plugins/azure/sqlserver/autoFailoverGroupsEnabled.js b/plugins/azure/sqlserver/autoFailoverGroupsEnabled.js new file mode 100644 index 0000000000..a830fa029b --- /dev/null +++ b/plugins/azure/sqlserver/autoFailoverGroupsEnabled.js @@ -0,0 +1,59 @@ +var async = require('async'); +const helpers = require('../../../helpers/azure'); + +module.exports = { + title: 'Auto-Failover Groups Enabled', + category: 'SQL Server', + description: 'Ensures that auto-failover groups are configured for Azure SQL database servers.', + more_info: 'In case of any outage that impacts one or more SQL databases, automatic failover process switches all secondary databases in the group to primary databases to ensure high availability.', + recommended_action: 'Ensure that auto-failover Groups are configured for Azure SQL database servers', + link: 'https://docs.microsoft.com/en-us/azure/azure-sql/database/auto-failover-group-overview', + apis: ['servers:listSql', 'failoverGroups:listByServer'], + + run: function(cache, settings, callback) { + var results = []; + var source = {}; + var locations = helpers.locations(settings.govcloud); + + async.each(locations.servers, function(location, rcb) { + + const servers = helpers.addSource(cache, source, + ['servers', 'listSql', location]); + + if (!servers) return rcb(); + + if (servers.err || !servers.data) { + helpers.addResult(results, 3, + 'Unable to query for SQL servers: ' + helpers.addError(servers), location); + return rcb(); + } + + if (!servers.data.length) { + helpers.addResult(results, 0, 'No SQL servers found', location); + return rcb(); + } + + for (const server of servers.data) { + const failoverGroups = helpers.addSource(cache, source, + ['failoverGroups', 'listByServer', location, server.id]); + + if (!failoverGroups || failoverGroups.err || !failoverGroups.data) { + helpers.addResult(results, 3, + 'Unable to query for auto-failover groups: ' + helpers.addError(failoverGroups), location, server.id); + continue; + } + + if (failoverGroups.data.length) { + helpers.addResult(results, 0, 'Auto-failover groups are configured for the SQL server', location, server.id); + } else { + helpers.addResult(results, 2, 'Auto-failover groups are not configured for the SQL server', location, server.id); + } + } + + rcb(); + }, function() { + // Global checking goes here + callback(null, results, source); + }); + } +}; diff --git a/plugins/azure/sqlserver/autoFailoverGroupsEnabled.spec.js b/plugins/azure/sqlserver/autoFailoverGroupsEnabled.spec.js new file mode 100644 index 0000000000..dda1741d82 --- /dev/null +++ b/plugins/azure/sqlserver/autoFailoverGroupsEnabled.spec.js @@ -0,0 +1,103 @@ +var expect = require('chai').expect; +var autoFailoverGroupsEnabled = require('./autoFailoverGroupsEnabled'); + +const servers = [ + { + 'id': '/subscriptions/123/resourceGroups/aqua-resource-group/providers/Microsoft.Sql/servers/test-server', + 'name': 'test-server', + 'location': 'eastus' + } +]; + +const failoverGroups = [ + { + 'id': '/subscriptions/123/resourceGroups/aqua-resource-group/providers/Microsoft.Sql/servers/test-server/failoverGroups/test-group', + 'name': 'test-group', + 'type': 'Microsoft.Sql/servers/failoverGroups' + } +]; + + +const createCache = (servers, failoverGroups) => { + let server = {}; + let groups = {}; + if (servers) { + server['data'] = servers; + if (servers.length > 0 && failoverGroups) { + groups[servers[0].id] = { + data: failoverGroups + }; + } + } + return { + servers: { + listSql: { + 'eastus': server + } + }, + failoverGroups: { + listByServer: { + 'eastus': groups + } + } + }; +}; + +describe('autoFailoverGroupsEnabled', function() { + describe('run', function() { + it('should give passing result if no SQL servers', function(done) { + const cache = createCache([], null); + autoFailoverGroupsEnabled.run(cache, {}, (err, results) => { + expect(results.length).to.equal(1); + expect(results[0].status).to.equal(0); + expect(results[0].message).to.include('No SQL servers found'); + expect(results[0].region).to.equal('eastus'); + done(); + }); + }); + + it('should give unknown result if unable to query for SQL servers', function(done) { + const cache = createCache(null); + autoFailoverGroupsEnabled.run(cache, {}, (err, results) => { + expect(results.length).to.equal(1); + expect(results[0].status).to.equal(3); + expect(results[0].message).to.include('Unable to query for SQL servers:'); + expect(results[0].region).to.equal('eastus'); + done(); + }); + }); + + it('should give unknown result if unable to query for failover groups', function(done) { + const cache = createCache([servers[0]], null); + autoFailoverGroupsEnabled.run(cache, {}, (err, results) => { + expect(results.length).to.equal(1); + expect(results[0].status).to.equal(3); + expect(results[0].message).to.include('Unable to query for auto-failover groups:'); + expect(results[0].region).to.equal('eastus'); + done(); + }); + }); + + it('should give passing result if auto-failover groups are configured', function(done) { + const cache = createCache([servers[0]], [failoverGroups[0]]); + autoFailoverGroupsEnabled.run(cache, {}, (err, results) => { + expect(results.length).to.equal(1); + expect(results[0].status).to.equal(0); + expect(results[0].message).to.include('Auto-failover groups are configured for the SQL server'); + expect(results[0].region).to.equal('eastus'); + done(); + }); + }); + + it('should give failing result if no auto-failover groups found', function(done) { + const cache = createCache([servers[0]], []); + autoFailoverGroupsEnabled.run(cache, {}, (err, results) => { + expect(results.length).to.equal(1); + expect(results[0].status).to.equal(2); + expect(results[0].message).to.include('Auto-failover groups are not configured for the SQL server'); + expect(results[0].region).to.equal('eastus'); + done(); + }); + }); + }); +}); \ No newline at end of file diff --git a/plugins/azure/virtualmachines/premiumSsdDisabled.js b/plugins/azure/virtualmachines/premiumSsdDisabled.js new file mode 100644 index 0000000000..d630c44f41 --- /dev/null +++ b/plugins/azure/virtualmachines/premiumSsdDisabled.js @@ -0,0 +1,62 @@ +var async = require('async'); + +var helpers = require('../../../helpers/azure/'); + +module.exports = { + title: 'Premium SSD Disabled', + category: 'Virtual Machines', + description: 'Ensures that the Azure virtual machines are configured to use standard SSD disk volumes instead of premium SSD disk volumes for managed disks.', + more_info: 'Azure standard SSD disks store data on solid state drives (SSDs), like Azure\'s existing premium storage disks. Standard SSD disks are a cost-effective storage option optimized for workloads that need consistent performance at lower IOPS levels.', + recommended_action: 'Modify virtual machines disks to use standard SSD disk volumes instead of premium SSD disk volumes', + link: 'https://docs.microsoft.com/en-us/azure/virtual-machines/disks-types', + apis: ['virtualMachines:listAll'], + + run: function(cache, settings, callback) { + var results = []; + var source = {}; + var locations = helpers.locations(settings.govcloud); + + async.each(locations.virtualMachines, function(location, rcb){ + const virtualMachines = helpers.addSource(cache, source, ['virtualMachines', 'listAll', location]); + + if (!virtualMachines) return rcb(); + + if (virtualMachines.err || !virtualMachines.data) { + helpers.addResult(results, 3, 'Unable to query for virtual machines: ' + helpers.addError(virtualMachines), location); + return rcb(); + } + if (!virtualMachines.data.length) { + helpers.addResult(results, 0, 'No existing virtual machines found', location); + return rcb(); + } + + virtualMachines.data.forEach(virtualMachine => { + if (virtualMachine.storageProfile && virtualMachine.storageProfile.osDisk && + virtualMachine.storageProfile.osDisk.managedDisk && + virtualMachine.storageProfile.osDisk.managedDisk.id && + virtualMachine.storageProfile.osDisk.managedDisk.storageAccountType && + virtualMachine.storageProfile.osDisk.managedDisk.storageAccountType.toLowerCase() === 'premium_lrs') { + helpers.addResult(results, 2, 'Attached OS disk volume is of Premium SSD type', location, virtualMachine.storageProfile.osDisk.managedDisk.id); + } else { + helpers.addResult(results, 0, 'Attached OS disk volume is not of Premium SSD type', location, virtualMachine.storageProfile.osDisk.managedDisk.id); + } + + const dataDisks = (virtualMachine.storageProfile && virtualMachine.storageProfile.dataDisks) ? virtualMachine.storageProfile.dataDisks : []; + + for (const dataDisk of dataDisks) { + if (dataDisk.managedDisk && dataDisk.managedDisk.storageAccountType && dataDisk.managedDisk.id && + dataDisk.managedDisk.storageAccountType.toLowerCase() === 'premium_lrs') { + helpers.addResult(results, 2, 'Attached data disk volume is of Premium SSD type', location, dataDisk.managedDisk.id); + } else { + helpers.addResult(results, 0, 'Attached data disk volume is not of Premium SSD type', location, dataDisk.managedDisk.id); + } + } + }); + + rcb(); + }, function() { + // Global checking goes here + callback(null, results, source); + }); + } +}; diff --git a/plugins/azure/virtualmachines/premiumSsdDisabled.spec.js b/plugins/azure/virtualmachines/premiumSsdDisabled.spec.js new file mode 100644 index 0000000000..bc851a2d13 --- /dev/null +++ b/plugins/azure/virtualmachines/premiumSsdDisabled.spec.js @@ -0,0 +1,169 @@ +var expect = require('chai').expect; +var premiumSsdDisabled = require('./premiumSsdDisabled'); + +const virtualMachines = [ + { + 'name': 'test-vm', + 'id': '/subscriptions/123/resourceGroups/AQUA-RESOURCE-GROUP/providers/Microsoft.Compute/virtualMachines/test-vm', + 'type': 'Microsoft.Compute/virtualMachines', + 'storageProfile': { + 'osDisk': { + 'managedDisk': { + 'storageAccountType': 'StandardSSD_LRS', + 'id': '/subscriptions/123/resourceGroups/aqua-resource-group/providers/Microsoft.Compute/disks/test-vm_OsDisk_1_d88ee8681dbe4bd3bbbd52a1f8e46d7f' + } + }, + 'dataDisks': [] + } + }, + { + 'name': 'test-vm', + 'id': '/subscriptions/123/resourceGroups/AQUA-RESOURCE-GROUP/providers/Microsoft.Compute/virtualMachines/test-vm', + 'type': 'Microsoft.Compute/virtualMachines', + 'storageProfile': { + 'osDisk': { + 'managedDisk': { + 'storageAccountType': 'Premium_LRS', + 'id': '/subscriptions/123/resourceGroups/aqua-resource-group/providers/Microsoft.Compute/disks/test-vm_OsDisk_1_d88ee8681dbe4bd3bbbd52a1f8e46d7f' + } + }, + 'dataDisks': [] + } + }, + { + 'name': 'test-vm', + 'id': '/subscriptions/123/resourceGroups/AQUA-RESOURCE-GROUP/providers/Microsoft.Compute/virtualMachines/test-vm', + 'type': 'Microsoft.Compute/virtualMachines', + 'storageProfile': { + 'osDisk': { + 'managedDisk': { + 'storageAccountType': 'StandardSSD_LRS', + 'id': '/subscriptions/123/resourceGroups/aqua-resource-group/providers/Microsoft.Compute/disks/test-vm_OsDisk_1_d88ee8681dbe4bd3bbbd52a1f8e46d7f' + } + }, + 'dataDisks': [ + { + 'managedDisk': { + 'storageAccountType': 'StandardSSD_LRS', + 'id': '/subscriptions/123/resourceGroups/aqua-resource-group/providers/Microsoft.Compute/disks/test-disk' + } + } + ] + } + }, + { + 'name': 'test-vm', + 'id': '/subscriptions/123/resourceGroups/AQUA-RESOURCE-GROUP/providers/Microsoft.Compute/virtualMachines/test-vm', + 'type': 'Microsoft.Compute/virtualMachines', + 'storageProfile': { + 'osDisk': { + 'managedDisk': { + 'storageAccountType': 'Premium_LRS', + 'id': '/subscriptions/123/resourceGroups/aqua-resource-group/providers/Microsoft.Compute/disks/test-vm_OsDisk_1_d88ee8681dbe4bd3bbbd52a1f8e46d7f' + } + }, + 'dataDisks': [ + { + 'managedDisk': { + 'storageAccountType': 'Premium_LRS', + 'id': '/subscriptions/123/resourceGroups/aqua-resource-group/providers/Microsoft.Compute/disks/test-disk' + } + } + ] + } + } +]; + +const createCache = (virtualMachines) => { + const machine = {}; + if (virtualMachines) { + machine['data'] = virtualMachines; + } + return { + virtualMachines: { + listAll: { + 'eastus': machine + } + } + }; +}; + +describe('premiumSsdDisabled', function() { + describe('run', function() { + it('should give passing result if no virtual machines found', function(done) { + const cache = createCache([]); + premiumSsdDisabled.run(cache, {}, (err, results) => { + expect(results.length).to.equal(1); + expect(results[0].status).to.equal(0); + expect(results[0].message).to.include('No existing virtual machines found'); + expect(results[0].region).to.equal('eastus'); + done(); + }); + }); + + it('should give unknown result if unable to query for virtual machines', function(done) { + const cache = createCache(null); + premiumSsdDisabled.run(cache, {}, (err, results) => { + expect(results.length).to.equal(1); + expect(results[0].status).to.equal(3); + expect(results[0].message).to.include('Unable to query for virtual machines'); + expect(results[0].region).to.equal('eastus'); + done(); + }); + }); + + it('should give passing result if OS disk volume is not of Premium SSD type', function(done) { + const cache = createCache([virtualMachines[0]]); + premiumSsdDisabled.run(cache, {}, (err, results) => { + expect(results.length).to.equal(1); + expect(results[0].status).to.equal(0); + expect(results[0].message).to.include('Attached OS disk volume is not of Premium SSD type'); + expect(results[0].region).to.equal('eastus'); + done(); + }); + }); + + it('should give failing result if OS disk volume is of Premium SSD type', function(done) { + const cache = createCache([virtualMachines[1]]); + premiumSsdDisabled.run(cache, {}, (err, results) => { + expect(results.length).to.equal(1); + expect(results[0].status).to.equal(2); + expect(results[0].message).to.include('Attached OS disk volume is of Premium SSD type'); + expect(results[0].region).to.equal('eastus'); + done(); + }); + }); + + it('should give passing results if OS and data disk volumes is not of Premium SSD type', function(done) { + const cache = createCache([virtualMachines[2]]); + premiumSsdDisabled.run(cache, {}, (err, results) => { + expect(results.length).to.equal(2); + + expect(results[0].status).to.equal(0); + expect(results[0].message).to.include('Attached OS disk volume is not of Premium SSD type'); + + expect(results[1].status).to.equal(0); + expect(results[1].message).to.include('Attached data disk volume is not of Premium SSD type'); + + expect(results[0].region).to.equal('eastus'); + done(); + }); + }); + + it('should give failing results if OS and data disk volume is of Premium SSD type', function(done) { + const cache = createCache([virtualMachines[3]]); + premiumSsdDisabled.run(cache, {}, (err, results) => { + expect(results.length).to.equal(2); + + expect(results[0].status).to.equal(2); + expect(results[0].message).to.include('Attached OS disk volume is of Premium SSD type'); + + expect(results[1].status).to.equal(2); + expect(results[1].message).to.include('Attached data disk volume is of Premium SSD type'); + + expect(results[0].region).to.equal('eastus'); + done(); + }); + }); + }); +}); \ No newline at end of file