From 1e0a42f383776896b5017c0f9a7822c88a7b468a Mon Sep 17 00:00:00 2001 From: Ali Imran Date: Wed, 10 Mar 2021 22:06:27 +0500 Subject: [PATCH 1/5] feature/AKD-96: Added Azure 'Storage Auto Growth Enabled' plugin and test cases --- exports.js | 1 + .../storageAutoGrowthEnabled.js | 59 +++++++++ .../storageAutoGrowthEnabled.spec.js | 119 ++++++++++++++++++ 3 files changed, 179 insertions(+) create mode 100644 plugins/azure/postgresqlserver/storageAutoGrowthEnabled.js create mode 100644 plugins/azure/postgresqlserver/storageAutoGrowthEnabled.spec.js diff --git a/exports.js b/exports.js index 364e127dda..7490c98688 100644 --- a/exports.js +++ b/exports.js @@ -400,6 +400,7 @@ module.exports = { 'logConnectionsEnabled' : require(__dirname + '/plugins/azure/postgresqlserver/logConnectionsEnabled.js'), 'logCheckpointsEnabled' : require(__dirname + '/plugins/azure/postgresqlserver/logCheckpointsEnabled.js'), 'enforcePostgresSSLConnection' : require(__dirname + '/plugins/azure/postgresqlserver/enforcePostgresSSLConnection.js'), + 'storageAutoGrowthEnabled' : require(__dirname + '/plugins/azure/postgresqlserver/storageAutoGrowthEnabled.js'), 'openOracleAutoDataWarehouse' : require(__dirname + '/plugins/azure/networksecuritygroups/openOracleAutoDataWarehouse.js'), 'networkWatcherEnabled' : require(__dirname + '/plugins/azure/networksecuritygroups/networkWatcherEnabled.js'), diff --git a/plugins/azure/postgresqlserver/storageAutoGrowthEnabled.js b/plugins/azure/postgresqlserver/storageAutoGrowthEnabled.js new file mode 100644 index 0000000000..3bb7d91837 --- /dev/null +++ b/plugins/azure/postgresqlserver/storageAutoGrowthEnabled.js @@ -0,0 +1,59 @@ +const async = require('async'); +const helpers = require('../../../helpers/azure'); + +module.exports = { + title: 'Storage Auto Growth Enabled', + category: 'PostgreSQL Server', + description: 'Ensures that Storage Auto Growth is enabled for PostgreSQL servers', + more_info: 'Storage Auto Growth must be enabled to accommodate the growing data', + recommended_action: 'Enable Storage Auto Growth for PostgreSQL Server', + link: 'https://docs.microsoft.com/en-us/azure/postgresql/howto-auto-grow-storage-portal', + apis: ['servers:listPostgres'], + + run: function(cache, settings, callback) { + const results = []; + const source = {}; + const locations = helpers.locations(settings.govcloud); + + async.each(locations.servers, (location, rcb) => { + + const listPostgres = helpers.addSource(cache, source, + ['servers', 'listPostgres', location]); + + if (!listPostgres) return rcb(); + + if (listPostgres.err || !listPostgres.data) { + helpers.addResult(results, 3, + 'Unable to query for PostgreSQL Servers: ' + helpers.addError(listPostgres), location); + return rcb(); + } + + if (!listPostgres.data.length) { + helpers.addResult(results, 0, 'No existing PostgreSQL Servers found', location); + return rcb(); + } + + for (let postgresServer of listPostgres.data) { + const storageProfile = postgresServer.storageProfile; + if (storageProfile) { + if (storageProfile.storageAutogrow && + storageProfile.storageAutogrow.toLowerCase() == 'enabled') { + helpers.addResult(results, 0, + 'Storage Auto Growth is enabled for PostgreSQL Server', location, postgresServer.id); + } else { + helpers.addResult(results, 2, + 'Storage Auto Growth is not enabled for PostgreSQL Server', location, postgresServer.id); + } + } else { + helpers.addResult(results, 2, + 'Storage Auto Growth is not enabled for PostgreSQL Server', location, postgresServer.id); + } + } + + rcb(); + }, function() { + // Global checking goes here + callback(null, results, source); + }); + } +}; diff --git a/plugins/azure/postgresqlserver/storageAutoGrowthEnabled.spec.js b/plugins/azure/postgresqlserver/storageAutoGrowthEnabled.spec.js new file mode 100644 index 0000000000..433d8b56d5 --- /dev/null +++ b/plugins/azure/postgresqlserver/storageAutoGrowthEnabled.spec.js @@ -0,0 +1,119 @@ +var assert = require('assert'); +var expect = require('chai').expect; +var storage = require('./storageAutoGrowthEnabled'); + +const listPostgres = [ + { + "sku": { + "name": "B_Gen5_1", + "tier": "Basic", + "family": "Gen5", + "capacity": 1 + }, + "location": "eastus", + "tags": {}, + "id": "/subscriptions/dce7d0ad-ebf6-437f-a3b0-28fc0d22117e/resourceGroups/Ali-Recource_Group/providers/Microsoft.DBforPostgreSQL/servers/postgresql-ali", + "name": "postgresql-ali", + "type": "Microsoft.DBforPostgreSQL/servers", + "administratorLogin": "adminali", + "storageProfile": { + "storageMB": 5120, + "backupRetentionDays": 7, + "geoRedundantBackup": "Disabled", + "storageAutogrow": "Enabled" + }, + "version": "11", + "sslEnforcement": "Enabled", + "minimalTlsVersion": "TLSEnforcementDisabled", + "userVisibleState": "Ready", + "fullyQualifiedDomainName": "postgresql-ali.postgres.database.azure.com", + "earliestRestoreDate": "2021-03-10T12:45:13.233+00:00", + "replicationRole": "", + "masterServerId": "", + "byokEnforcement": "Disabled", + "privateEndpointConnections": [], + "infrastructureEncryption": "Disabled", + "publicNetworkAccess": "Enabled" + }, + { + "sku": { + "name": "B_Gen5_1", + "tier": "Basic", + "family": "Gen5", + "capacity": 1 + }, + "location": "eastus", + "tags": {}, + "id": "/subscriptions/dce7d0ad-ebf6-437f-a3b0-28fc0d22117e/resourceGroups/Ali-Recource_Group/providers/Microsoft.DBforPostgreSQL/servers/postgresql-ali", + "name": "postgresql-ali", + "type": "Microsoft.DBforPostgreSQL/servers", + "administratorLogin": "adminali", + "storageProfile": { + "storageMB": 5120, + "backupRetentionDays": 7, + "geoRedundantBackup": "Disabled", + "storageAutogrow": "Disabled" + }, + "version": "11", + "sslEnforcement": "Enabled", + "minimalTlsVersion": "TLSEnforcementDisabled", + "userVisibleState": "Ready", + "fullyQualifiedDomainName": "postgresql-ali.postgres.database.azure.com", + "earliestRestoreDate": "2021-03-10T12:45:13.233+00:00", + "replicationRole": "", + "masterServerId": "", + "byokEnforcement": "Disabled", + "privateEndpointConnections": [], + "infrastructureEncryption": "Disabled", + "publicNetworkAccess": "Enabled" + } +]; + +const createCache = (listPostgres) => { + return { + servers: { + listPostgres: { + 'eastus': { + data: listPostgres + } + } + } + }; +}; + +describe('storageAutoGrowth', function () { + describe('run', function () { + it('should give passing result if no servers', function (done) { + const cache = createCache({}); + storage.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 PostgreSQL Servers found'); + expect(results[0].region).to.equal('eastus'); + done() + }); + }) + + it('should give failing result if storage auto growth is not enabled for postgresql server', function (done) { + const cache = createCache([listPostgres[1]]); + storage.run(cache, {}, (err, results) => { + expect(results.length).to.equal(1); + expect(results[0].status).to.equal(2); + expect(results[0].message).to.include('Storage Auto Growth is not enabled for PostgreSQL Server'); + expect(results[0].region).to.equal('eastus'); + done() + }); + }); + + it('should give passing result if storage auto growth is enabled for postgresql server', function (done) { + const cache = createCache([listPostgres[0]]); + storage.run(cache, {}, (err, results) => { + expect(results.length).to.equal(1); + expect(results[0].status).to.equal(0); + expect(results[0].message).to.include('Storage Auto Growth is enabled for PostgreSQL Server'); + expect(results[0].region).to.equal('eastus'); + done() + }); + }); + }) +}) \ No newline at end of file From 7f796bf7b71b5fa4f5825d7a17f5414fd9a03378 Mon Sep 17 00:00:00 2001 From: Ali Imran Date: Thu, 11 Mar 2021 01:06:30 +0500 Subject: [PATCH 2/5] feature/AKD-96: Added Azure 'Storage Auto Growth Enabled' plugin and test cases --- .../storageAutoGrowthEnabled.js | 4 +- .../storageAutoGrowthEnabled.spec.js | 135 +++++++++--------- 2 files changed, 69 insertions(+), 70 deletions(-) diff --git a/plugins/azure/postgresqlserver/storageAutoGrowthEnabled.js b/plugins/azure/postgresqlserver/storageAutoGrowthEnabled.js index 3bb7d91837..6316e07d74 100644 --- a/plugins/azure/postgresqlserver/storageAutoGrowthEnabled.js +++ b/plugins/azure/postgresqlserver/storageAutoGrowthEnabled.js @@ -38,8 +38,8 @@ module.exports = { if (storageProfile) { if (storageProfile.storageAutogrow && storageProfile.storageAutogrow.toLowerCase() == 'enabled') { - helpers.addResult(results, 0, - 'Storage Auto Growth is enabled for PostgreSQL Server', location, postgresServer.id); + helpers.addResult(results, 0, + 'Storage Auto Growth is enabled for PostgreSQL Server', location, postgresServer.id); } else { helpers.addResult(results, 2, 'Storage Auto Growth is not enabled for PostgreSQL Server', location, postgresServer.id); diff --git a/plugins/azure/postgresqlserver/storageAutoGrowthEnabled.spec.js b/plugins/azure/postgresqlserver/storageAutoGrowthEnabled.spec.js index 433d8b56d5..b2236a74c1 100644 --- a/plugins/azure/postgresqlserver/storageAutoGrowthEnabled.spec.js +++ b/plugins/azure/postgresqlserver/storageAutoGrowthEnabled.spec.js @@ -1,71 +1,70 @@ -var assert = require('assert'); var expect = require('chai').expect; var storage = require('./storageAutoGrowthEnabled'); const listPostgres = [ { - "sku": { - "name": "B_Gen5_1", - "tier": "Basic", - "family": "Gen5", - "capacity": 1 + 'sku': { + 'name': 'B_Gen5_1', + 'tier': 'Basic', + 'family': 'Gen5', + 'capacity': 1 }, - "location": "eastus", - "tags": {}, - "id": "/subscriptions/dce7d0ad-ebf6-437f-a3b0-28fc0d22117e/resourceGroups/Ali-Recource_Group/providers/Microsoft.DBforPostgreSQL/servers/postgresql-ali", - "name": "postgresql-ali", - "type": "Microsoft.DBforPostgreSQL/servers", - "administratorLogin": "adminali", - "storageProfile": { - "storageMB": 5120, - "backupRetentionDays": 7, - "geoRedundantBackup": "Disabled", - "storageAutogrow": "Enabled" + 'location': 'eastus', + 'tags': {}, + 'id': '/subscriptions/dce7d0ad-ebf6-437f-a3b0-28fc0d22117e/resourceGroups/Ali-Recource_Group/providers/Microsoft.DBforPostgreSQL/servers/postgresql-ali', + 'name': 'postgresql-ali', + 'type': 'Microsoft.DBforPostgreSQL/servers', + 'administratorLogin': 'adminali', + 'storageProfile': { + 'storageMB': 5120, + 'backupRetentionDays': 7, + 'geoRedundantBackup': 'Disabled', + 'storageAutogrow': 'Enabled' }, - "version": "11", - "sslEnforcement": "Enabled", - "minimalTlsVersion": "TLSEnforcementDisabled", - "userVisibleState": "Ready", - "fullyQualifiedDomainName": "postgresql-ali.postgres.database.azure.com", - "earliestRestoreDate": "2021-03-10T12:45:13.233+00:00", - "replicationRole": "", - "masterServerId": "", - "byokEnforcement": "Disabled", - "privateEndpointConnections": [], - "infrastructureEncryption": "Disabled", - "publicNetworkAccess": "Enabled" + 'version': '11', + 'sslEnforcement': 'Enabled', + 'minimalTlsVersion': 'TLSEnforcementDisabled', + 'userVisibleState': 'Ready', + 'fullyQualifiedDomainName': 'postgresql-ali.postgres.database.azure.com', + 'earliestRestoreDate': '2021-03-10T12:45:13.233+00:00', + 'replicationRole': '', + 'masterServerId': '', + 'byokEnforcement': 'Disabled', + 'privateEndpointConnections': [], + 'infrastructureEncryption': 'Disabled', + 'publicNetworkAccess': 'Enabled' }, { - "sku": { - "name": "B_Gen5_1", - "tier": "Basic", - "family": "Gen5", - "capacity": 1 + 'sku': { + 'name': 'B_Gen5_1', + 'tier': 'Basic', + 'family': 'Gen5', + 'capacity': 1 }, - "location": "eastus", - "tags": {}, - "id": "/subscriptions/dce7d0ad-ebf6-437f-a3b0-28fc0d22117e/resourceGroups/Ali-Recource_Group/providers/Microsoft.DBforPostgreSQL/servers/postgresql-ali", - "name": "postgresql-ali", - "type": "Microsoft.DBforPostgreSQL/servers", - "administratorLogin": "adminali", - "storageProfile": { - "storageMB": 5120, - "backupRetentionDays": 7, - "geoRedundantBackup": "Disabled", - "storageAutogrow": "Disabled" + 'location': 'eastus', + 'tags': {}, + 'id': '/subscriptions/dce7d0ad-ebf6-437f-a3b0-28fc0d22117e/resourceGroups/Ali-Recource_Group/providers/Microsoft.DBforPostgreSQL/servers/postgresql-ali', + 'name': 'postgresql-ali', + 'type': 'Microsoft.DBforPostgreSQL/servers', + 'administratorLogin': 'adminali', + 'storageProfile': { + 'storageMB': 5120, + 'backupRetentionDays': 7, + 'geoRedundantBackup': 'Disabled', + 'storageAutogrow': 'Disabled' }, - "version": "11", - "sslEnforcement": "Enabled", - "minimalTlsVersion": "TLSEnforcementDisabled", - "userVisibleState": "Ready", - "fullyQualifiedDomainName": "postgresql-ali.postgres.database.azure.com", - "earliestRestoreDate": "2021-03-10T12:45:13.233+00:00", - "replicationRole": "", - "masterServerId": "", - "byokEnforcement": "Disabled", - "privateEndpointConnections": [], - "infrastructureEncryption": "Disabled", - "publicNetworkAccess": "Enabled" + 'version': '11', + 'sslEnforcement': 'Enabled', + 'minimalTlsVersion': 'TLSEnforcementDisabled', + 'userVisibleState': 'Ready', + 'fullyQualifiedDomainName': 'postgresql-ali.postgres.database.azure.com', + 'earliestRestoreDate': '2021-03-10T12:45:13.233+00:00', + 'replicationRole': '', + 'masterServerId': '', + 'byokEnforcement': 'Disabled', + 'privateEndpointConnections': [], + 'infrastructureEncryption': 'Disabled', + 'publicNetworkAccess': 'Enabled' } ]; @@ -81,39 +80,39 @@ const createCache = (listPostgres) => { }; }; -describe('storageAutoGrowth', function () { - describe('run', function () { - it('should give passing result if no servers', function (done) { +describe('storageAutoGrowth', function() { + describe('run', function() { + it('should give passing result if no servers', function(done) { const cache = createCache({}); storage.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 PostgreSQL Servers found'); expect(results[0].region).to.equal('eastus'); - done() + done(); }); - }) + }); - it('should give failing result if storage auto growth is not enabled for postgresql server', function (done) { + it('should give failing result if storage auto growth is not enabled for postgresql server', function(done) { const cache = createCache([listPostgres[1]]); storage.run(cache, {}, (err, results) => { expect(results.length).to.equal(1); expect(results[0].status).to.equal(2); expect(results[0].message).to.include('Storage Auto Growth is not enabled for PostgreSQL Server'); expect(results[0].region).to.equal('eastus'); - done() + done(); }); }); - it('should give passing result if storage auto growth is enabled for postgresql server', function (done) { + it('should give passing result if storage auto growth is enabled for postgresql server', function(done) { const cache = createCache([listPostgres[0]]); storage.run(cache, {}, (err, results) => { expect(results.length).to.equal(1); expect(results[0].status).to.equal(0); expect(results[0].message).to.include('Storage Auto Growth is enabled for PostgreSQL Server'); expect(results[0].region).to.equal('eastus'); - done() + done(); }); }); - }) -}) \ No newline at end of file + }); +}); \ No newline at end of file From 7eeb642b8bf7c9b8d07bd70bc0ac05cf938760b8 Mon Sep 17 00:00:00 2001 From: Ali Imran Date: Sun, 14 Mar 2021 05:40:44 +0500 Subject: [PATCH 3/5] feature/AKD-96: Added Azure 'Storage Auto Growth Enabled' plugin and test cases --- .../storageAutoGrowthEnabled.js | 25 ++++++++----------- .../storageAutoGrowthEnabled.spec.js | 4 +-- 2 files changed, 13 insertions(+), 16 deletions(-) diff --git a/plugins/azure/postgresqlserver/storageAutoGrowthEnabled.js b/plugins/azure/postgresqlserver/storageAutoGrowthEnabled.js index 6316e07d74..a56f11a9bd 100644 --- a/plugins/azure/postgresqlserver/storageAutoGrowthEnabled.js +++ b/plugins/azure/postgresqlserver/storageAutoGrowthEnabled.js @@ -2,11 +2,13 @@ const async = require('async'); const helpers = require('../../../helpers/azure'); module.exports = { - title: 'Storage Auto Growth Enabled', + title: 'Storage Auto-Growth Enabled', category: 'PostgreSQL Server', - description: 'Ensures that Storage Auto Growth is enabled for PostgreSQL servers', - more_info: 'Storage Auto Growth must be enabled to accommodate the growing data', - recommended_action: 'Enable Storage Auto Growth for PostgreSQL Server', + description: 'Ensures that Storage Auto-Growth feature is enabled for Microsoft Azure PostgreSQL servers.', + more_info: `Storage auto grow prevents your server from reaching the storage limit and becoming read-only. + For servers with 100 GB or less of provisioned storage, the size is increased by 5 GB when the free space is below 10%. + For servers with more than 100 GB of provisioned storage, the size is increased by 5% when the free space is below 10 GB.`, + recommended_action: 'Modify PostgreSQL servers to enable storage auto-growth feature', link: 'https://docs.microsoft.com/en-us/azure/postgresql/howto-auto-grow-storage-portal', apis: ['servers:listPostgres'], @@ -34,16 +36,11 @@ module.exports = { } for (let postgresServer of listPostgres.data) { - const storageProfile = postgresServer.storageProfile; - if (storageProfile) { - if (storageProfile.storageAutogrow && - storageProfile.storageAutogrow.toLowerCase() == 'enabled') { - helpers.addResult(results, 0, - 'Storage Auto Growth is enabled for PostgreSQL Server', location, postgresServer.id); - } else { - helpers.addResult(results, 2, - 'Storage Auto Growth is not enabled for PostgreSQL Server', location, postgresServer.id); - } + if (postgresServer.storageProfile && + postgresServer.storageProfile.storageAutogrow && + postgresServer.storageProfile.storageAutogrow.toLowerCase() == 'enabled') { + helpers.addResult(results, 0, + 'Storage Auto Growth is enabled for PostgreSQL Server', location, postgresServer.id); } else { helpers.addResult(results, 2, 'Storage Auto Growth is not enabled for PostgreSQL Server', location, postgresServer.id); diff --git a/plugins/azure/postgresqlserver/storageAutoGrowthEnabled.spec.js b/plugins/azure/postgresqlserver/storageAutoGrowthEnabled.spec.js index b2236a74c1..043306ca3c 100644 --- a/plugins/azure/postgresqlserver/storageAutoGrowthEnabled.spec.js +++ b/plugins/azure/postgresqlserver/storageAutoGrowthEnabled.spec.js @@ -11,7 +11,7 @@ const listPostgres = [ }, 'location': 'eastus', 'tags': {}, - 'id': '/subscriptions/dce7d0ad-ebf6-437f-a3b0-28fc0d22117e/resourceGroups/Ali-Recource_Group/providers/Microsoft.DBforPostgreSQL/servers/postgresql-ali', + 'id': '/subscriptions/123/resourceGroups/aqua-resource-group/providers/Microsoft.DBforPostgreSQL/servers/server1', 'name': 'postgresql-ali', 'type': 'Microsoft.DBforPostgreSQL/servers', 'administratorLogin': 'adminali', @@ -43,7 +43,7 @@ const listPostgres = [ }, 'location': 'eastus', 'tags': {}, - 'id': '/subscriptions/dce7d0ad-ebf6-437f-a3b0-28fc0d22117e/resourceGroups/Ali-Recource_Group/providers/Microsoft.DBforPostgreSQL/servers/postgresql-ali', + 'id': '/subscriptions/123/resourceGroups/aqua-resource-group/providers/Microsoft.DBforPostgreSQL/servers/server1', 'name': 'postgresql-ali', 'type': 'Microsoft.DBforPostgreSQL/servers', 'administratorLogin': 'adminali', From 4da5adbc489d72cb60903b33658e95fa0e291229 Mon Sep 17 00:00:00 2001 From: Ali Imran Date: Sun, 14 Mar 2021 21:43:50 +0500 Subject: [PATCH 4/5] feature/AKD-96: Added Azure 'Storage Auto Growth Enabled' plugin and test cases --- .../postgresqlserver/storageAutoGrowthEnabled.js | 6 +++--- .../storageAutoGrowthEnabled.spec.js | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/plugins/azure/postgresqlserver/storageAutoGrowthEnabled.js b/plugins/azure/postgresqlserver/storageAutoGrowthEnabled.js index a56f11a9bd..a57557d280 100644 --- a/plugins/azure/postgresqlserver/storageAutoGrowthEnabled.js +++ b/plugins/azure/postgresqlserver/storageAutoGrowthEnabled.js @@ -5,9 +5,9 @@ module.exports = { title: 'Storage Auto-Growth Enabled', category: 'PostgreSQL Server', description: 'Ensures that Storage Auto-Growth feature is enabled for Microsoft Azure PostgreSQL servers.', - more_info: `Storage auto grow prevents your server from reaching the storage limit and becoming read-only. - For servers with 100 GB or less of provisioned storage, the size is increased by 5 GB when the free space is below 10%. - For servers with more than 100 GB of provisioned storage, the size is increased by 5% when the free space is below 10 GB.`, + more_info: `Storage auto grow prevents your server from reaching the storage limit and becoming read-only. \ + For servers with 100 GB or less of provisioned storage, the size is increased by 5 GB when the free space is below 10%. \ + For servers with more than 100 GB of provisioned storage, the size is increased by 5% when the free space is below 10 GB.`, recommended_action: 'Modify PostgreSQL servers to enable storage auto-growth feature', link: 'https://docs.microsoft.com/en-us/azure/postgresql/howto-auto-grow-storage-portal', apis: ['servers:listPostgres'], diff --git a/plugins/azure/postgresqlserver/storageAutoGrowthEnabled.spec.js b/plugins/azure/postgresqlserver/storageAutoGrowthEnabled.spec.js index 043306ca3c..762a19bab8 100644 --- a/plugins/azure/postgresqlserver/storageAutoGrowthEnabled.spec.js +++ b/plugins/azure/postgresqlserver/storageAutoGrowthEnabled.spec.js @@ -12,9 +12,9 @@ const listPostgres = [ 'location': 'eastus', 'tags': {}, 'id': '/subscriptions/123/resourceGroups/aqua-resource-group/providers/Microsoft.DBforPostgreSQL/servers/server1', - 'name': 'postgresql-ali', + 'name': 'server1', 'type': 'Microsoft.DBforPostgreSQL/servers', - 'administratorLogin': 'adminali', + 'administratorLogin': 'Aquaadmin', 'storageProfile': { 'storageMB': 5120, 'backupRetentionDays': 7, @@ -25,7 +25,7 @@ const listPostgres = [ 'sslEnforcement': 'Enabled', 'minimalTlsVersion': 'TLSEnforcementDisabled', 'userVisibleState': 'Ready', - 'fullyQualifiedDomainName': 'postgresql-ali.postgres.database.azure.com', + 'fullyQualifiedDomainName': 'server1.postgres.database.azure.com', 'earliestRestoreDate': '2021-03-10T12:45:13.233+00:00', 'replicationRole': '', 'masterServerId': '', @@ -44,9 +44,9 @@ const listPostgres = [ 'location': 'eastus', 'tags': {}, 'id': '/subscriptions/123/resourceGroups/aqua-resource-group/providers/Microsoft.DBforPostgreSQL/servers/server1', - 'name': 'postgresql-ali', + 'name': 'server1', 'type': 'Microsoft.DBforPostgreSQL/servers', - 'administratorLogin': 'adminali', + 'administratorLogin': 'Aquaadmin', 'storageProfile': { 'storageMB': 5120, 'backupRetentionDays': 7, @@ -57,7 +57,7 @@ const listPostgres = [ 'sslEnforcement': 'Enabled', 'minimalTlsVersion': 'TLSEnforcementDisabled', 'userVisibleState': 'Ready', - 'fullyQualifiedDomainName': 'postgresql-ali.postgres.database.azure.com', + 'fullyQualifiedDomainName': 'server1.postgres.database.azure.com', 'earliestRestoreDate': '2021-03-10T12:45:13.233+00:00', 'replicationRole': '', 'masterServerId': '', From a8a5ced172117374d49299d524398f28d8336281 Mon Sep 17 00:00:00 2001 From: Ali Imran Date: Sun, 14 Mar 2021 21:59:25 +0500 Subject: [PATCH 5/5] feature/AKD-96: Added Azure 'Storage Auto Growth Enabled' plugin and test cases --- plugins/azure/postgresqlserver/storageAutoGrowthEnabled.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/plugins/azure/postgresqlserver/storageAutoGrowthEnabled.js b/plugins/azure/postgresqlserver/storageAutoGrowthEnabled.js index a57557d280..3ca1112f09 100644 --- a/plugins/azure/postgresqlserver/storageAutoGrowthEnabled.js +++ b/plugins/azure/postgresqlserver/storageAutoGrowthEnabled.js @@ -5,9 +5,7 @@ module.exports = { title: 'Storage Auto-Growth Enabled', category: 'PostgreSQL Server', description: 'Ensures that Storage Auto-Growth feature is enabled for Microsoft Azure PostgreSQL servers.', - more_info: `Storage auto grow prevents your server from reaching the storage limit and becoming read-only. \ - For servers with 100 GB or less of provisioned storage, the size is increased by 5 GB when the free space is below 10%. \ - For servers with more than 100 GB of provisioned storage, the size is increased by 5% when the free space is below 10 GB.`, + more_info: 'Storage auto grow prevents your server from reaching the storage limit and becoming read-only. For servers with 100 GB or less of provisioned storage, the size is increased by 5 GB when the free space is below 10%. For servers with more than 100 GB of provisioned storage, the size is increased by 5% when the free space is below 10 GB.', recommended_action: 'Modify PostgreSQL servers to enable storage auto-growth feature', link: 'https://docs.microsoft.com/en-us/azure/postgresql/howto-auto-grow-storage-portal', apis: ['servers:listPostgres'],