-
Notifications
You must be signed in to change notification settings - Fork 838
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Confused when using ClientSecretCredential to authenticate an AppConfiguration in China Cloud #20884
Comments
There are 2 ways to set the authority host for azidentity credentials (Azure Public Cloud is the default):
The .NET SDK has a different options API but observes AZURE_AUTHORITY_HOST, so the SDKs should behave the same in your scenario. I guess there's a difference in the service principal details (tenant ID, etc.) or runtime environment. Are both apps running in the same deployment environment? If you can't just debug the app to see what's happening--the authority host is set here--you can enable logging to see where the credential sends token requests: import azlog "github.com/Azure/azure-sdk-for-go/sdk/azcore/log"
azlog.SetListener(func(cls azlog.Event, msg string) {
fmt.Println(msg)
})
azlog.SetEvents(azlog.EventRequest) |
Hi @RichardChen820. Thank you for opening this issue and giving us the opportunity to assist. To help our team better understand your issue and the details of your scenario please provide a response to the question asked above or the information requested above. This will help us more accurately address your issue. |
@chlowell This is what I get after enabling the logging in GO
Seems it just talking with public cloud AAD endpoint, not the mooncake's AAD endpoint.
|
I see. The difference in this case is in the behavior of MSAL.NET and MSAL for Go, supporting libraries the Azure SDK uses to implement service principal authentication. The first two requests in your log are MSAL requesting metadata about the Azure AD instance and tenant. The third is the token request--note that it's sent to Azure China. Looking at the metadata from the second request, I see that Azure China endpoint is the given Off the top of my head, there are a couple reasons for your .NET application to behave differently:
Assuming you didn't set |
Hi @RichardChen820. Thank you for opening this issue and giving us the opportunity to assist. To help our team better understand your issue and the details of your scenario please provide a response to the question asked above or the information requested above. This will help us more accurately address your issue. |
Hi @RichardChen820, we're sending this friendly reminder because we haven't heard back from you in 7 days. We need more information about this issue to help address it. Please be sure to give us your input. If we don't hear back from you within 14 days of this comment the issue will be automatically closed. Thank you! |
When I try to use
ClientSecretCredential
to authenticate an AppConfiguraiton in mooncake to get a setting, code like:It can successfully get the setting without specifying the AuthorityHost when creating the ClientSecretCredential.
But if I use .net SDK in the same way
It throws exception saying no tenant was found.
I'm really confused why there's a such difference between go and .net. How the sovereign clouds be handled in azure. identity?
GO SDK package version I'm using:
.NET SDK package version I'm using:
The text was updated successfully, but these errors were encountered: