vscode: Microsoft Authentication Provider fails to authenticate in sovereign aka national/gov clouds e.g. Mooncake, DoD
Does this issue occur when all extensions are disabled?: Yes/No
- VS Code Version: Version: 1.71.2
- OS Version: Windows 11 Enterprise, Version: 21H2, OS Build: 22000.978
Steps to Reproduce:
- Open PowerPages Studio (https://make.powerpages.microsoft.cn/)
- Login with correct credentials of a user in Mooncake
- Launch VSCode for web
- Notice the authentication popup (the AzureAD endpoint is https://login.microsoftonline.com/ it should have been https://login.partner.microsoftonline.cn/)
- Since the AzureAD endpoint is incorrect it is not able to find the user.

About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 2
- Comments: 28 (21 by maintainers)
@bwateratmsft yes I want that for this as well: https://github.com/microsoft/vscode/issues/115626 and have a similar proposal there
@stgarf-sx LiveShare has to intentionally make a change to support sovereign clouds so I doubt you are leveraging this change. (Telemetry says that no one is yet)
So when you initiate a sign in, login.microsoftonline.com opens, right? And do you but your Sovereign Cloud email in there? I’m still wondering how you’re getting this error through the normal public cloud flow.
Nice! Great minds think alike 😄
I think the signature of
providerOptionsin your draft could be made more generic, i.e.unknown, assuming that there aren’t problems with crossing process boundaries or something.Also GCC-H clouds are a thing. Just wanted to call that out as I am merging an issue about that with this issue.
Relating to the questions that @TylerLeonhardt raised, I can offer some insights from how the Azure Account extension does things.
There are two ways to log in to a sovereign cloud in the Azure Account extension. The first is to set some VSCode settings, and then log in. The second is a separate login command, “Log in to Azure Cloud…”, which first prompts for which sovereign cloud to log in to, and then sets the setting, and then proceeds with login as normal.
I think that both a setting in the auth provider extension and an input hack like
VSCODE_CLIENT_IDwould be helpful. The former would be ideal for users that want to configure every Azure extension all from one place. The latter would be good if there was an extension that wanted to reach “across” to a separate sovereign cloud. I saw in source code that the default login URL,microsoftonline.com, is hardcoded; I think that the default could be controlled by the setting, while including the ability to override with something like theVSCODE_CLIENT_ID.@jingloumsft I know we have some sovereign cloud accounts for testing, can we share these with Tyler?
Couple of questions I need to answer:
github-authentication.uri)VSCODE_CLIENT_IDor finally allow a property bag of provider specific configuration?/{tenant}/oauth2/v2.0/tokenor will it be blocked?