Skip to content

Instantly share code, notes, and snippets.

@justinyoo
Created June 20, 2016 04:00
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/af93aeddf89df9627ec3ab2fa698ecce to your computer and use it in GitHub Desktop.
Save justinyoo/af93aeddf89df9627ec3ab2fa698ecce to your computer and use it in GitHub Desktop.
Application Insights WebTests SDK
var resourceGroup = "RESOURCE_GROUP_NAME";
var resource = new WebTestResource(...);
var identity = resource.ResourceIdentity;
using (var client = new ResourceManagementClient(credentials))
{
var result = client.Resources.CreateOrUpdateAsync(resourceGroup, identity, resource).ConfigureAwait(false);
if (result.StatusCode != HttpStatusCode.Ok && result.StatusCode != HttpStatusCode.Created)
{
throw new HttpResponseException(result.StatusCode);
}
return result.Resource;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment