Skip to content

Instantly share code, notes, and snippets.

@justinyoo
Created June 20, 2016 04:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save justinyoo/78a001ca0f491e08f8cca51510f89b85 to your computer and use it in GitHub Desktop.
Save justinyoo/78a001ca0f491e08f8cca51510f89b85 to your computer and use it in GitHub Desktop.
Application Insights WebTests SDK
var clientId = "CLIENT_ID";
var username = "user.name@email.com";
var password = "PASSWORD";
var aad = "https://login.microsoftonline.com/[TENANT_NAME].onmicrosoft.com";
var url = "https://management.core.windows.net/";
var subscriptionId = "SUBSCRIPTION_ID";
var context = new AuthenticationContext(aad, false);
var uc = new UserPasswordCredential(username, password);
var result = await context.AcquireTokenAsync(url, clientId, uc).ConfigureAwait(false);
var credential = new TokenCloudCredentials(subscriptionId, result.AccessToken);
var client = new ResourceManagementClient(credential);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment