Skip to content

Commit ca88b42

Browse files
committed
Setting AuthorityHost
1 parent 97475fe commit ca88b42

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

src/ServiceControl.Transports.ASBS/AzureQuery.cs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,13 +123,25 @@ protected override void InitializeCore(ReadOnlyDictionary<string, string> settin
123123
}
124124
else
125125
{
126-
clientCredentials = new ClientSecretCredential(tenantId, clientId, clientSecret);
126+
var options = new ClientSecretCredentialOptions { AuthorityHost = AzureAuthorityHosts.AzurePublicCloud };
127+
if (environment == ArmEnvironment.AzureChina)
128+
{
129+
options.AuthorityHost = AzureAuthorityHosts.AzureChina;
130+
}
131+
if (environment == ArmEnvironment.AzureGermany)
132+
{
133+
// Microsoft Cloud Germany was closed on October 29th, 2021. so we default to the public cloud
134+
}
135+
if (environment == ArmEnvironment.AzureGovernment)
136+
{
137+
options.AuthorityHost = AzureAuthorityHosts.AzureGovernment;
138+
}
139+
clientCredentials = new ClientSecretCredential(tenantId, clientId, clientSecret, options);
127140
}
128141

129142
client = new MetricsQueryClient(environment.Endpoint, clientCredentials,
130143
new MetricsQueryClientOptions
131144
{
132-
Audience = environment.Audience,
133145
Transport = new HttpClientTransport(
134146
new HttpClient(new SocketsHttpHandler
135147
{

0 commit comments

Comments
 (0)