diff --git a/prowler/CHANGELOG.md b/prowler/CHANGELOG.md index d3a088e554..df8cf277a2 100644 --- a/prowler/CHANGELOG.md +++ b/prowler/CHANGELOG.md @@ -34,6 +34,7 @@ All notable changes to the **Prowler SDK** are documented in this file. - `sns_topics_not_publicly_accessible` false positive with `aws:SourceArn` conditions [(#8326)](https://github.com/prowler-cloud/prowler/issues/8326) - Remove typo from description req 1.2.3 - Prowler ThreatScore m365 [(#8384)](https://github.com/prowler-cloud/prowler/pull/8384) - Way of counting FAILED/PASS reqs from `kisa_isms_p_2023_aws` table [(#8382)](https://github.com/prowler-cloud/prowler/pull/8382) +- Use default tenant domain instead of first domain in list for Azure and M365 providers [(#8402)](https://github.com/prowler-cloud/prowler/pull/8402) - Avoid multiple module error calls in M365 provider [(#8353)](https://github.com/prowler-cloud/prowler/pull/8353) - Tweaks from Prowler ThreatScore in order to handle the correct reqs [(#8401)](https://github.com/prowler-cloud/prowler/pull/8401) --- diff --git a/prowler/providers/azure/azure_provider.py b/prowler/providers/azure/azure_provider.py index 64377ca07e..db434c0675 100644 --- a/prowler/providers/azure/azure_provider.py +++ b/prowler/providers/azure/azure_provider.py @@ -894,9 +894,10 @@ class AzureProvider(Provider): client = GraphServiceClient(credentials=credentials) domain_result = await client.domains.get() - if getattr(domain_result, "value"): - if getattr(domain_result.value[0], "id"): - identity.tenant_domain = domain_result.value[0].id + for domain in getattr(domain_result, "value", []): + if getattr(domain, "is_default"): + identity.tenant_domain = domain.id + break except HttpResponseError as error: logger.error( diff --git a/prowler/providers/m365/m365_provider.py b/prowler/providers/m365/m365_provider.py index 9e550c07d7..1910e5de91 100644 --- a/prowler/providers/m365/m365_provider.py +++ b/prowler/providers/m365/m365_provider.py @@ -928,11 +928,10 @@ class M365Provider(Provider): client = GraphServiceClient(credentials=session) domain_result = await client.domains.get() - if getattr(domain_result, "value"): - if getattr(domain_result.value[0], "id"): - identity.tenant_domain = domain_result.value[0].id - for domain in domain_result.value: - identity.tenant_domains.append(domain.id) + for domain in getattr(domain_result, "value", []): + identity.tenant_domains.append(domain.id) + if getattr(domain, "is_default", None): + identity.tenant_domain = domain.id except HttpResponseError as error: logger.error(