NationalClouds are wrongly prefixed #917
Description
Describe the bug
NationalClouds is defined in
msgraph-sdk-python-core/src/msgraph_core/_enums.py
Lines 33 to 43 in e54022a
| class NationalClouds(str, Enum): | |
| """Enumerated list of supported sovereign clouds""" | |
| China = 'https://microsoftgraph.chinacloudapi.cn' | |
| Germany = 'https://graph.microsoft.de' | |
| Global = 'https://graph.microsoft.com' | |
| US_DoD = 'https://dod-graph.microsoft.us' | |
| US_GOV = 'https://graph.microsoft.us' | |
| def __str__(self): | |
| return self.value |
https,
however, since we pass them as allowed hosts to the AzureIdentityAuthenticationProvider by default in
msgraph-sdk-python-core/src/msgraph_core/authentication/azure_identity_authentication_provider.py
Line 22 in e54022a
| allowed_hosts: list[str] = [nc.value for nc in NationalClouds] |
they are fed to the AllowedHostsValidator which in https://github.com/microsoft/kiota-python/blob/b23edcbf268efdb81d14ef59cecc6c9565288248/packages/abstractions/kiota_abstractions/authentication/allowed_hosts_validator.py#L20 raises an exception if they are prefixed.
Expected behavior
The validator should either strip the urls or the enum should be updated.
How to reproduce
Instantiate an AzureIdentityAuthenticationProvider with default allowed hosts.
SDK Version
1.3.3
Latest version known to work for scenario above?
No response
Known Workarounds
Pass allowed_hosts manually.
Debug output
No response
Configuration
No response
Other information
No response
Activity
Acurisu commentedon May 13, 2025
If the opinion is that the validator should be updated then this issue of course belongs to the corresponding repository.
tidux commentedon Sep 3, 2025
Can this be fixed one way or the other? I had to hardcode
allowed_hosts=['graph.microsoft.com', 'graph.microsoft.us']in a constructor call because of this bug.MIchaelMainer commentedon Feb 9, 2026
Thank you for opening this issue. This is certainly a bug.
Note to team: we should take a look at all of the core libraries and how we are handling the allowed host list.