Skip to content

Commit

Permalink
Revised enableDefenderForSqlSever function
Browse files Browse the repository at this point in the history
  • Loading branch information
AkhtarAmir authored and AkhtarAmir committed Nov 7, 2024
1 parent c254393 commit 67969e2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 12 deletions.
11 changes: 1 addition & 10 deletions plugins/azure/defender/enableDefenderForSqlServers.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,7 @@ module.exports = {
return callback(null, results, source);
}


let pricingData = pricings.data.find((pricing) => pricing.name.toLowerCase() === serviceName);

if (pricingData && pricingData.pricingTier && pricingData.pricingTier.toLowerCase() === 'standard') {
helpers.addResult(results, 0,
`Azure Defender is enabled for ${serviceDisplayName} at subscription level`, 'global', pricingData.id);
} else {
helpers.addResult(results, 2,
`Azure Defender is not enabled for ${serviceDisplayName} at subscription level`, 'global');
}
helpers.checkMicrosoftDefender(pricings, serviceName, serviceDisplayName, results, 'global');
return callback(null, results, source);
}

Expand Down
4 changes: 2 additions & 2 deletions plugins/azure/defender/enableDefenderForSqlServers.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ describe('enableDefenderForSqlServers', function() {
plugin.run(cache, settings, (err, results) => {
expect(results.length).to.equal(1);
expect(results[0].status).to.equal(0);
expect(results[0].message).to.include('Azure Defender is enabled for SQL Servers at subscription level');
expect(results[0].message).to.include('Azure Defender is enabled for SQL Servers');
done();
});
});
Expand All @@ -35,7 +35,7 @@ describe('enableDefenderForSqlServers', function() {
plugin.run(cache, settings, (err, results) => {
expect(results.length).to.equal(1);
expect(results[0].status).to.equal(2);
expect(results[0].message).to.include('Azure Defender is not enabled for SQL Servers at subscription level');
expect(results[0].message).to.include('Azure Defender is not enabled for SQL Servers');
done();
});
});
Expand Down

0 comments on commit 67969e2

Please sign in to comment.