fix(azure): handle credentials scopes for Graph

This commit is contained in:
pedrooot committed 2025-03-14 11:16:47 +01:00
1 parent f2e19d377a
commit a8211e9013
6 files changed
+41 -6

No files matched your search

@@ -69,6 +69,7 @@ class TestAzureProvider:
authority=None,
base_url="https://management.azure.com",
credential_scopes=["https://management.azure.com/.default"],
graph_credential_scopes=["https://graph.microsoft.com/.default"],
)
assert isinstance(azure_provider.session, DefaultAzureCredential)
assert azure_provider.identity == AzureIdentityInfo(
@@ -3,6 +3,10 @@ from azure.identity import AzureAuthorityHosts
from prowler.providers.azure.lib.regions.regions import (
AZURE_CHINA_CLOUD,
AZURE_GENERIC_CLOUD,
AZURE_GRAPH_CHINA,
AZURE_GRAPH_GLOBAL,
AZURE_GRAPH_GOV_US_L4,
AZURE_GRAPH_GOV_US_L5,
AZURE_US_GOV_CLOUD,
get_regions_config,
)
@@ -20,16 +24,22 @@ class Test_azure_regions:
"authority": None,
"base_url": AZURE_GENERIC_CLOUD,
"credential_scopes": [AZURE_GENERIC_CLOUD + "/.default"],
"graph_credential_scopes": [AZURE_GRAPH_GLOBAL],
},
"AzureChinaCloud": {
"authority": AzureAuthorityHosts.AZURE_CHINA,
"base_url": AZURE_CHINA_CLOUD,
"credential_scopes": [AZURE_CHINA_CLOUD + "/.default"],
"graph_credential_scopes": [AZURE_GRAPH_CHINA],
},
"AzureUSGovernment": {
"authority": AzureAuthorityHosts.AZURE_GOVERNMENT,
"base_url": AZURE_US_GOV_CLOUD,
"credential_scopes": [AZURE_US_GOV_CLOUD + "/.default"],
"graph_credential_scopes": [
AZURE_GRAPH_GOV_US_L4,
AZURE_GRAPH_GOV_US_L5,
],
},
}