From 4d2fb9529c0a64701cbf8ea8bf97a6d37f59897d Mon Sep 17 00:00:00 2001 From: alphadev4 Date: Fri, 24 Nov 2023 14:46:09 +0500 Subject: [PATCH 1/7] SAAS-20313/Dns-management-domain --- exports.js | 6 +- .../frontdoor/frontDoorDnsManagedDomain.js | 73 ++++++ .../frontDoorDnsManagedDomain.spec.js | 233 ++++++++++++++++++ 3 files changed, 310 insertions(+), 2 deletions(-) create mode 100644 plugins/azure/frontdoor/frontDoorDnsManagedDomain.js create mode 100644 plugins/azure/frontdoor/frontDoorDnsManagedDomain.spec.js diff --git a/exports.js b/exports.js index 53c1523d03..24948beaa4 100644 --- a/exports.js +++ b/exports.js @@ -989,7 +989,9 @@ module.exports = { 'eventHubMinimumTLSversion' : require(__dirname + '/plugins/azure/eventhub/eventHubMinimumTLSversion.js'), 'accessLogsEnabled' : require(__dirname + '/plugins/azure/frontdoor/accessLogsEnabled.js'), - 'frontDoorMinimumTlsVersion' : require(__dirname + '/plugins/azure/frontdoor/frontDoorMinimumTlsVersion.js') + 'frontDoorMinimumTlsVersion' : require(__dirname + '/plugins/azure/frontdoor/frontDoorMinimumTlsVersion.js'), + 'frontDoorDnsManagedDomain' : require(__dirname + '/plugins/azure/frontdoor/frontDoorDnsManagedDomain.js') + }, github: { 'publicKeysRotated' : require(__dirname + '/plugins/github/users/publicKeysRotated.js'), @@ -1478,4 +1480,4 @@ module.exports = { 'securityNotificationsEnabled' : require(__dirname + '/plugins/alibaba/securitycenter/securityNotificationsEnabled.js'), 'vulnerabilityScanEnabled' : require(__dirname + '/plugins/alibaba/securitycenter/vulnerabilityScanEnabled.js') } -}; +}; \ No newline at end of file diff --git a/plugins/azure/frontdoor/frontDoorDnsManagedDomain.js b/plugins/azure/frontdoor/frontDoorDnsManagedDomain.js new file mode 100644 index 0000000000..fc716b2bfe --- /dev/null +++ b/plugins/azure/frontdoor/frontDoorDnsManagedDomain.js @@ -0,0 +1,73 @@ +var async = require('async'); +var helpers = require('../../../helpers/azure'); + +module.exports = { + title: 'Front Door Domain Managed DNS', + category: 'Front Door', + domain: 'Content Delivery', + description: 'Ensures that Front Door Standard and Premium profile custom domains are configured to use Azure Managed DNS', + more_info: 'Azure Managed DNS is a hosting service for DNS domains that provides name resolution by using Microsoft Azure infrastructure.', + recommended_action: 'Ensure that Non-Azure validated domains for Front Door Standard and Premium are using Azure Managed DNS.', + link: 'https://learn.microsoft.com/en-us/azure/frontdoor/standard-premium/how-to-configure-https-custom-domain?tabs=powershell#azure-front-door-managed-certificates-for-non-azure-pre-validated-domains', + apis: ['profiles:list', 'customDomain:listByFrontDoorProfiles'], + + run: function(cache, settings, callback) { + const results = []; + const source = {}; + const locations = helpers.locations(settings.govcloud); + async.each(locations.profiles, (location, rcb) => { + const profiles = helpers.addSource(cache, source, + ['profiles', 'list', location]); + + if (!profiles) return rcb(); + + if (profiles.err || !profiles.data) { + helpers.addResult(results, 3, + 'Unable to query Azure Front Door profiles: ' + helpers.addError(profiles), location); + return rcb(); + } + + if (!profiles.data.length) { + helpers.addResult(results, 0, 'No existing Azure Front Door profiles found', location); + return rcb(); + } + + var frontDoorProfile = false; + profiles.data.forEach(function(profile) { + if (!profile.id || profile.kind != 'frontdoor') return; + + frontDoorProfile = true; + var failingDomains = {}; + const customDomains = helpers.addSource(cache, source, + ['customDomain', 'listByFrontDoorProfiles', location, profile.id]); + if (!customDomains || customDomains.err || !customDomains.data) { + helpers.addResult(results, 3, + 'Unable to query Front Door custom domains: ' + helpers.addError(customDomains), location, profile.id); + } else if (!customDomains.data.length) { + helpers.addResult(results, 0, 'No existing Front Door custom domains found', location, profile.id); + } else { + failingDomains = customDomains.data.filter(customDomain => { + return (!customDomain.azureDnsZone); + }).map(function(customDomain) { + return customDomain.name; + }); + + if (failingDomains.length){ + helpers.addResult(results, 2, + `Front Door Profile domains are not using Azure managed DNS ${failingDomains.join(', ')}`, location, profile.id); + } else { + helpers.addResult(results, 0, + 'Front Door Profile domains are using Azure managed DNS', location, profile.id); + } + } + }); + + if (!frontDoorProfile) { + helpers.addResult(results, 0, 'No existing Azure Front Door profiles found', location); + } + rcb(); + }, function() { + callback(null, results, source); + }); + } +}; \ No newline at end of file diff --git a/plugins/azure/frontdoor/frontDoorDnsManagedDomain.spec.js b/plugins/azure/frontdoor/frontDoorDnsManagedDomain.spec.js new file mode 100644 index 0000000000..7efb78dba6 --- /dev/null +++ b/plugins/azure/frontdoor/frontDoorDnsManagedDomain.spec.js @@ -0,0 +1,233 @@ +var expect = require('chai').expect; +var frontDoorDnsManagedDomain = require('./frontDoorDnsManagedDomain.js'); + +const profiles = [ + { + "id": "/subscriptions/234/resourcegroups/sadeedrg/providers/Microsoft.Cdn/profiles/test-profile", + "type": "Microsoft.Cdn/profiles", + "name": "test-profile", + "location": "Global", + "kind": "frontdoor", + "tags": {}, + "sku": { + "name": "Standard_Microsoft" + }, + "properties": { + "resourceState": "Active", + "provisioningState": "Succeeded" + } + }, + { + "id": "/subscriptions/234/resourcegroups/sadeedrg/providers/Microsoft.Cdn/profiles/test-profile", + "type": "Microsoft.Cdn/profiles", + "name": "test-profile", + "location": "Global", + "kind": "frontdoor", + "tags": {}, + "sku": { + "name": "Standard_Microsoft" + }, + "properties": { + "resourceState": "Active", + "provisioningState": "Succeeded" + } + }, + { + "id": "/subscriptions/26a1a07e-06dd-4892-92c9-e4996b0fc546/resourcegroups/meerab-rg/providers/Microsoft.Cdn/profiles/mehak-fd", + "type": "Microsoft.Cdn/profiles", + "name": "mehak-fd", + "location": "Global", + "kind": "frontdoor", + "tags": {}, + "sku": { + "name": "Premium_AzureFrontDoor" + }, + "properties": { + "originResponseTimeoutSeconds": 60, + "frontDoorId": "40590271-c2c4-4264-8061-45b884a91a70", + "resourceState": "Active", + "provisioningState": "Succeeded" + } + } +]; + + +const customDomain = [ + { + "id": "/subscriptions/26a1a07e-06dd-4892-92c9-e4996b0fc546/resourcegroups/meerab-rg/providers/Microsoft.Cdn/profiles/mehak-fd/customdomains/test-naim-app-srvenv-appserviceenvironment-net", + "type": "Microsoft.Cdn/profiles/customdomains", + "name": "test-naim-app-srvenv-appserviceenvironment-net", + "hostName": "test.naim-app-srvenv.appserviceenvironment.net", + "tlsSettings": { + "certificateType": "ManagedCertificate", + "minimumTlsVersion": "TLS12", + "secret": null + }, + "validationProperties": { + "validationToken": "mh0nl1m0syywj6m6bt5s9hksxw1sk4h9", + "expirationDate": "2023-08-07T20:07:11.5302594+00:00" + }, + "azureDnsZone": { + "id": "/subscriptions/a7ddb462-bd4a-4c99-bda2-e008b2ab62f8/resourceGroups/naim-resources/providers/Microsoft.Network/dnszones/naim-app-srvenv.appserviceenvironment.net" + }, + "domainValidationState": "Pending", + "preValidatedCustomDomainResourceId": null, + "provisioningState": "Succeeded", + "deploymentStatus": "NotStarted" + }, + { + + }, + { + "id": "/subscriptions/26a1a07e-06dd-4892-92c9-e4996b0fc546/resourcegroups/meerab-rg/providers/Microsoft.Cdn/profiles/mehak-fd/customdomains/test-naim-app-srvenv-appserviceenvironment-net", + "type": "Microsoft.Cdn/profiles/customdomains", + "name": "test-naim-app-srvenv-appserviceenvironment-net", + "hostName": "test.naim-app-srvenv.appserviceenvironment.net", + "tlsSettings": { + "certificateType": "ManagedCertificate", + "minimumTlsVersion": "TLS1", + "secret": null + }, + "validationProperties": { + "validationToken": "mh0nl1m0syywj6m6bt5s9hksxw1sk4h9", + "expirationDate": "2023-08-07T20:07:11.5302594+00:00" + }, + "azureDnsZone": null, + "domainValidationState": "Pending", + "preValidatedCustomDomainResourceId": null, + "provisioningState": "Succeeded", + "deploymentStatus": "NotStarted" + }, +] + +const createCache = (profiles, customDomains) => { + let customDomain = {}; + if (profiles.length) { + customDomain[profiles[0].id] = { + data: customDomains + }; + } + + + return { + profiles: { + list: { + 'global': { + data: profiles + } + } + }, + customDomain: { + listByFrontDoorProfiles: { + 'global': customDomain + } + } + }; +}; + +const createErrorCache = (key) => { + if (key == 'profile') { + return { + profiles: { + list: { + 'global': {} + } + } + }; + } else if (key === 'customDomains') { + return { + profiles: { + list: { + 'global': { + data: [profiles[0]] + } + } + }, + customDomains: { + listByFrontDoorProfiles: { + 'global': {} + } + } + }; + } else { + const profileId = (profiles && profiles.length) ? profiles[0].id : null; + const customDomains = (customDomains && customDomains.length) ? customDomains[0].id : null; + return { + profiles: { + list: { + 'global': { + data: [profiles[0]] + } + } + }, + diagnosticSettings: { + customDomains: { + 'global': { + data: {} + } + } + } + }; + } +}; + +describe('frontDoorDnsManagedDomain', function () { + describe('run', function () { + + it('should give unknown if Unable to query Azure Front Door profiles:', function (done) { + const cache = createErrorCache('profile'); + frontDoorDnsManagedDomain.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 Azure Front Door profiles'); + expect(results[0].region).to.equal('global'); + done(); + }); + }); + + + it('should give unknown if Unable to query Front Door custom domains:', function (done) { + const cache = createErrorCache('customDomains'); + frontDoorDnsManagedDomain.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 Front Door custom domains:'); + expect(results[0].region).to.equal('global'); + done(); + }); + }); + + it('should give pass if No existing Front Door custom domains found', function (done) { + const cache = createCache([profiles[0]], customDomain[1]); + frontDoorDnsManagedDomain.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 Front Door custom domains found'); + expect(results[0].region).to.equal('global'); + done(); + }); + }); + + it('should give pass result if AFD profile custom domain is using Azure managed DNS', function (done) { + const cache = createCache([profiles[2]], [customDomain[0]]); + frontDoorDnsManagedDomain.run(cache, {}, (err, results) => { + expect(results.length).to.equal(1); + expect(results[0].status).to.equal(0); + expect(results[0].message).to.include('Front Door Profile domains are using Azure managed DNS'); + expect(results[0].region).to.equal('global'); + done(); + }); + }); + + it('should give fail result if AFD profile custom domain is not using Azure managed DNS', function (done) { + const cache = createCache([profiles[2]], [customDomain[2]]); + frontDoorDnsManagedDomain.run(cache, {}, (err, results) => { + expect(results.length).to.equal(1); + expect(results[0].status).to.equal(2); + expect(results[0].message).to.include('Front Door Profile domains are not using Azure managed DNS'); + expect(results[0].region).to.equal('global'); + done(); + }); + }); + }); +}); \ No newline at end of file From e7e87c863b1fe8524d7fc0cf54ce2dd7b8bcc514 Mon Sep 17 00:00:00 2001 From: alphadev4 Date: Wed, 29 Nov 2023 18:27:16 +0500 Subject: [PATCH 2/7] Renaming --- exports.js | 2 +- ...omain.js => frontDoorAzureManagedDomain.js} | 10 +++++----- ....js => frontDoorAzureManagedDomain.spec.js} | 18 +++++++++--------- 3 files changed, 15 insertions(+), 15 deletions(-) rename plugins/azure/frontdoor/{frontDoorDnsManagedDomain.js => frontDoorAzureManagedDomain.js} (88%) rename plugins/azure/frontdoor/{frontDoorDnsManagedDomain.spec.js => frontDoorAzureManagedDomain.spec.js} (92%) diff --git a/exports.js b/exports.js index 24948beaa4..b74bfef4bf 100644 --- a/exports.js +++ b/exports.js @@ -990,7 +990,7 @@ module.exports = { 'accessLogsEnabled' : require(__dirname + '/plugins/azure/frontdoor/accessLogsEnabled.js'), 'frontDoorMinimumTlsVersion' : require(__dirname + '/plugins/azure/frontdoor/frontDoorMinimumTlsVersion.js'), - 'frontDoorDnsManagedDomain' : require(__dirname + '/plugins/azure/frontdoor/frontDoorDnsManagedDomain.js') + 'frontDoorAzureManagedDomain' : require(__dirname + '/plugins/azure/frontdoor/frontDoorAzureManagedDomain.js') }, github: { diff --git a/plugins/azure/frontdoor/frontDoorDnsManagedDomain.js b/plugins/azure/frontdoor/frontDoorAzureManagedDomain.js similarity index 88% rename from plugins/azure/frontdoor/frontDoorDnsManagedDomain.js rename to plugins/azure/frontdoor/frontDoorAzureManagedDomain.js index fc716b2bfe..e5b8769539 100644 --- a/plugins/azure/frontdoor/frontDoorDnsManagedDomain.js +++ b/plugins/azure/frontdoor/frontDoorAzureManagedDomain.js @@ -2,12 +2,12 @@ var async = require('async'); var helpers = require('../../../helpers/azure'); module.exports = { - title: 'Front Door Domain Managed DNS', + title: 'Front Door Azure Managed DNS', category: 'Front Door', domain: 'Content Delivery', - description: 'Ensures that Front Door Standard and Premium profile custom domains are configured to use Azure Managed DNS', + description: 'Ensures that Front Door standard and premium profile custom domains are configured to use Azure Managed DNS', more_info: 'Azure Managed DNS is a hosting service for DNS domains that provides name resolution by using Microsoft Azure infrastructure.', - recommended_action: 'Ensure that Non-Azure validated domains for Front Door Standard and Premium are using Azure Managed DNS.', + recommended_action: 'Ensure that Non-Azure validated domains for Front Door profiles are using Azure Managed DNS.', link: 'https://learn.microsoft.com/en-us/azure/frontdoor/standard-premium/how-to-configure-https-custom-domain?tabs=powershell#azure-front-door-managed-certificates-for-non-azure-pre-validated-domains', apis: ['profiles:list', 'customDomain:listByFrontDoorProfiles'], @@ -54,10 +54,10 @@ module.exports = { if (failingDomains.length){ helpers.addResult(results, 2, - `Front Door Profile domains are not using Azure managed DNS ${failingDomains.join(', ')}`, location, profile.id); + `Front Door profile custom domains are not using Azure managed DNS: ${failingDomains.join(', ')}`, location, profile.id); } else { helpers.addResult(results, 0, - 'Front Door Profile domains are using Azure managed DNS', location, profile.id); + 'Front Door profile custom domains are using Azure managed DNS', location, profile.id); } } }); diff --git a/plugins/azure/frontdoor/frontDoorDnsManagedDomain.spec.js b/plugins/azure/frontdoor/frontDoorAzureManagedDomain.spec.js similarity index 92% rename from plugins/azure/frontdoor/frontDoorDnsManagedDomain.spec.js rename to plugins/azure/frontdoor/frontDoorAzureManagedDomain.spec.js index 7efb78dba6..5a30b4b3f6 100644 --- a/plugins/azure/frontdoor/frontDoorDnsManagedDomain.spec.js +++ b/plugins/azure/frontdoor/frontDoorAzureManagedDomain.spec.js @@ -1,5 +1,5 @@ var expect = require('chai').expect; -var frontDoorDnsManagedDomain = require('./frontDoorDnsManagedDomain.js'); +var frontDoorAzureManagedDomain = require('./frontDoorAzureManagedDomain.js'); const profiles = [ { @@ -171,12 +171,12 @@ const createErrorCache = (key) => { } }; -describe('frontDoorDnsManagedDomain', function () { +describe('frontDoorAzureManagedDomain', function () { describe('run', function () { it('should give unknown if Unable to query Azure Front Door profiles:', function (done) { const cache = createErrorCache('profile'); - frontDoorDnsManagedDomain.run(cache, {}, (err, results) => { + frontDoorAzureManagedDomain.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 Azure Front Door profiles'); @@ -188,7 +188,7 @@ describe('frontDoorDnsManagedDomain', function () { it('should give unknown if Unable to query Front Door custom domains:', function (done) { const cache = createErrorCache('customDomains'); - frontDoorDnsManagedDomain.run(cache, {}, (err, results) => { + frontDoorAzureManagedDomain.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 Front Door custom domains:'); @@ -199,7 +199,7 @@ describe('frontDoorDnsManagedDomain', function () { it('should give pass if No existing Front Door custom domains found', function (done) { const cache = createCache([profiles[0]], customDomain[1]); - frontDoorDnsManagedDomain.run(cache, {}, (err, results) => { + frontDoorAzureManagedDomain.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 Front Door custom domains found'); @@ -210,10 +210,10 @@ describe('frontDoorDnsManagedDomain', function () { it('should give pass result if AFD profile custom domain is using Azure managed DNS', function (done) { const cache = createCache([profiles[2]], [customDomain[0]]); - frontDoorDnsManagedDomain.run(cache, {}, (err, results) => { + frontDoorAzureManagedDomain.run(cache, {}, (err, results) => { expect(results.length).to.equal(1); expect(results[0].status).to.equal(0); - expect(results[0].message).to.include('Front Door Profile domains are using Azure managed DNS'); + expect(results[0].message).to.include('Front Door profile custom domains are using Azure managed DNS'); expect(results[0].region).to.equal('global'); done(); }); @@ -221,10 +221,10 @@ describe('frontDoorDnsManagedDomain', function () { it('should give fail result if AFD profile custom domain is not using Azure managed DNS', function (done) { const cache = createCache([profiles[2]], [customDomain[2]]); - frontDoorDnsManagedDomain.run(cache, {}, (err, results) => { + frontDoorAzureManagedDomain.run(cache, {}, (err, results) => { expect(results.length).to.equal(1); expect(results[0].status).to.equal(2); - expect(results[0].message).to.include('Front Door Profile domains are not using Azure managed DNS'); + expect(results[0].message).to.include('Front Door profile custom domains are not using Azure managed DNS:'); expect(results[0].region).to.equal('global'); done(); }); From 1e1f9791f91add309d51643dfb8a024e32942e67 Mon Sep 17 00:00:00 2001 From: alphadev4 <113519745+alphadev4@users.noreply.github.com> Date: Wed, 29 Nov 2023 18:27:56 +0500 Subject: [PATCH 3/7] Update exports.js --- exports.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exports.js b/exports.js index b74bfef4bf..674c01eb0b 100644 --- a/exports.js +++ b/exports.js @@ -1480,4 +1480,4 @@ module.exports = { 'securityNotificationsEnabled' : require(__dirname + '/plugins/alibaba/securitycenter/securityNotificationsEnabled.js'), 'vulnerabilityScanEnabled' : require(__dirname + '/plugins/alibaba/securitycenter/vulnerabilityScanEnabled.js') } -}; \ No newline at end of file +}; From f2882b0bd5406d19fb3fd67d1f14e2caa715d8a9 Mon Sep 17 00:00:00 2001 From: alphadev4 <113519745+alphadev4@users.noreply.github.com> Date: Fri, 1 Dec 2023 15:08:59 +0500 Subject: [PATCH 4/7] Update plugins/azure/frontdoor/frontDoorAzureManagedDomain.js --- plugins/azure/frontdoor/frontDoorAzureManagedDomain.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/azure/frontdoor/frontDoorAzureManagedDomain.js b/plugins/azure/frontdoor/frontDoorAzureManagedDomain.js index e5b8769539..100fddec7a 100644 --- a/plugins/azure/frontdoor/frontDoorAzureManagedDomain.js +++ b/plugins/azure/frontdoor/frontDoorAzureManagedDomain.js @@ -6,7 +6,7 @@ module.exports = { category: 'Front Door', domain: 'Content Delivery', description: 'Ensures that Front Door standard and premium profile custom domains are configured to use Azure Managed DNS', - more_info: 'Azure Managed DNS is a hosting service for DNS domains that provides name resolution by using Microsoft Azure infrastructure.', + more_info: 'DNS domains in Azure DNS are hosted on the Azure global network of DNS name servers. This system uses Anycast networking so that each DNS query is answered by the closest available DNS server. Azure DNS provides fast performance and high availability for your domain.', recommended_action: 'Ensure that Non-Azure validated domains for Front Door profiles are using Azure Managed DNS.', link: 'https://learn.microsoft.com/en-us/azure/frontdoor/standard-premium/how-to-configure-https-custom-domain?tabs=powershell#azure-front-door-managed-certificates-for-non-azure-pre-validated-domains', apis: ['profiles:list', 'customDomain:listByFrontDoorProfiles'], From ceb6f706af42d13393e7bf144a57428f6a30ac05 Mon Sep 17 00:00:00 2001 From: alphadev4 Date: Fri, 1 Dec 2023 15:21:23 +0500 Subject: [PATCH 5/7] Simplified-Logic --- plugins/azure/frontdoor/frontDoorAzureManagedDomain.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/plugins/azure/frontdoor/frontDoorAzureManagedDomain.js b/plugins/azure/frontdoor/frontDoorAzureManagedDomain.js index 100fddec7a..96c62c2064 100644 --- a/plugins/azure/frontdoor/frontDoorAzureManagedDomain.js +++ b/plugins/azure/frontdoor/frontDoorAzureManagedDomain.js @@ -16,6 +16,7 @@ module.exports = { const source = {}; const locations = helpers.locations(settings.govcloud); async.each(locations.profiles, (location, rcb) => { + const profiles = helpers.addSource(cache, source, ['profiles', 'list', location]); @@ -37,7 +38,7 @@ module.exports = { if (!profile.id || profile.kind != 'frontdoor') return; frontDoorProfile = true; - var failingDomains = {}; + var failingDomains = []; const customDomains = helpers.addSource(cache, source, ['customDomain', 'listByFrontDoorProfiles', location, profile.id]); if (!customDomains || customDomains.err || !customDomains.data) { @@ -46,11 +47,8 @@ module.exports = { } else if (!customDomains.data.length) { helpers.addResult(results, 0, 'No existing Front Door custom domains found', location, profile.id); } else { - failingDomains = customDomains.data.filter(customDomain => { - return (!customDomain.azureDnsZone); - }).map(function(customDomain) { - return customDomain.name; - }); + failingDomains = customDomains.data.filter(customDomain => !customDomain.azureDnsZone) + .map(customDomain => customDomain.name); if (failingDomains.length){ helpers.addResult(results, 2, From 5102b95769729b34c1c86d53496d199a61a32493 Mon Sep 17 00:00:00 2001 From: alphadev4 <113519745+alphadev4@users.noreply.github.com> Date: Fri, 1 Dec 2023 15:21:43 +0500 Subject: [PATCH 6/7] Update plugins/azure/frontdoor/frontDoorAzureManagedDomain.js Co-authored-by: mehakseedat63 <87388442+mehakseedat63@users.noreply.github.com> --- plugins/azure/frontdoor/frontDoorAzureManagedDomain.js | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/azure/frontdoor/frontDoorAzureManagedDomain.js b/plugins/azure/frontdoor/frontDoorAzureManagedDomain.js index 96c62c2064..cad8e9cf99 100644 --- a/plugins/azure/frontdoor/frontDoorAzureManagedDomain.js +++ b/plugins/azure/frontdoor/frontDoorAzureManagedDomain.js @@ -41,6 +41,7 @@ module.exports = { var failingDomains = []; const customDomains = helpers.addSource(cache, source, ['customDomain', 'listByFrontDoorProfiles', location, profile.id]); + if (!customDomains || customDomains.err || !customDomains.data) { helpers.addResult(results, 3, 'Unable to query Front Door custom domains: ' + helpers.addError(customDomains), location, profile.id); From 37237af1eb83da53ebacdc9932eb7237211eda64 Mon Sep 17 00:00:00 2001 From: alphadev4 Date: Fri, 1 Dec 2023 15:24:03 +0500 Subject: [PATCH 7/7] Linting --- plugins/azure/frontdoor/frontDoorAzureManagedDomain.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/azure/frontdoor/frontDoorAzureManagedDomain.js b/plugins/azure/frontdoor/frontDoorAzureManagedDomain.js index cad8e9cf99..740c242892 100644 --- a/plugins/azure/frontdoor/frontDoorAzureManagedDomain.js +++ b/plugins/azure/frontdoor/frontDoorAzureManagedDomain.js @@ -49,7 +49,7 @@ module.exports = { helpers.addResult(results, 0, 'No existing Front Door custom domains found', location, profile.id); } else { failingDomains = customDomains.data.filter(customDomain => !customDomain.azureDnsZone) - .map(customDomain => customDomain.name); + .map(customDomain => customDomain.name); if (failingDomains.length){ helpers.addResult(results, 2,