Office365-REST-Python-Client
Office365-REST-Python-Client copied to clipboard
Updating STSProfile ServiceURL for Azure National Cloud using Username and Password Credentials
I've been working on pulling SharePoint data and ran into an issue with Azure National Cloud. I am currently limited to username and password to connect.
Currently when the STSProfile class initializes it sets the serviceURL to 'https://login.microsoftonline.com'.
When the function _acquire_service_token in SamlTokenProvider.py is called it creates a new instance of of STSProflie and pulls the _sts_profile.security_token_service_url which will always point to Pub cloud. This results in the following error:
AADSTS90038: Tenant '<tenant>' request is being redirected to the National Cloud
If I manually change the serviceURL to 'https://login.microsoftonline.us'. Everything works fine.
I have not been able to find a way to update the serviceURL to point to National Cloud via the ClientContext, RequestOptions or other means. Before I start working on alternative security methods, or a fix, I wanted to verify that I'm not missing an existing way to make this change.