in arm-templates/sqlDwAutoScaler/SqlDwAutoScaler/Shared/DwClientFactory.cs [20:34]
public static DwManagementClient Create(string resourceId)
{
var authenticationContext = new AuthenticationContext(ActiveDirectoryEndpoint + TenantId);
var credential = new ClientCredential(clientId: ClientId, clientSecret: ClientKey);
var result = authenticationContext.AcquireTokenAsync(resource: WindowsManagementUri, clientCredential: credential).Result;
if (result == null) throw new InvalidOperationException("Failed to obtain the token!");
var token = result.AccessToken;
var aadTokenCredentials = new TokenCloudCredentials(SubscriptionId, token);
var client = new DwManagementClient(aadTokenCredentials, resourceId);
return client;
}