fix(azure,m365): use default tenant domain instead of first domain in list (#8402)

This commit is contained in:
Rubén De la Torre Vico
2025-07-30 13:23:25 +02:00
committed by GitHub
parent 77e59203ae
commit 7cd1966066
3 changed files with 9 additions and 8 deletions
+1
View File
@@ -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)
---
+4 -3
View File
@@ -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(
+4 -5
View File
@@ -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(