public async Async.Task <MonitorSettings> GetMonitorSettings() { var token = GetToken(); var client = new OperationalInsightsManagementClient(new Rest.TokenCredentials(token.Token)) { SubscriptionId = _creds.GetSubscription() }; var customerId = (await client.Workspaces.ListByResourceGroupAsync(_creds.GetBaseResourceGroup())) .Select(w => w.CustomerId) .First(); var keys = await client.SharedKeys.GetSharedKeysAsync(_creds.GetBaseResourceGroup(), _config.OneFuzzMonitor); return(new MonitorSettings(customerId, keys.PrimarySharedKey)); }
public async Async.Task <MonitorSettings> GetMonitorSettings() { string[] scopes = { "https://management.azure.com/.default" }; var token = _creds.GetIdentity().GetToken(new TokenRequestContext(scopes)); var client = new OperationalInsightsManagementClient(new Rest.TokenCredentials(token.Token)) { SubscriptionId = _creds.GetSubscription() }; var customerId = (await client.Workspaces.ListByResourceGroupAsync(_creds.GetBaseResourceGroup())) .Select(w => w.CustomerId) .First(); var keys = await client.SharedKeys.GetSharedKeysAsync(_creds.GetBaseResourceGroup(), _config.OneFuzzMonitor); return(new MonitorSettings(customerId, keys.PrimarySharedKey)); }
private VirtualMachineScaleSetResource GetVmssResource(Guid name) { var resourceGroup = _creds.GetBaseResourceGroup(); var id = VirtualMachineScaleSetResource.CreateResourceIdentifier(_creds.GetSubscription(), resourceGroup, name.ToString()); return(_creds.ArmClient.GetVirtualMachineScaleSetResource(id)); }
public async Task <HttpResponseData> GetSubscription([HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = "testhooks/creds/subscription")] HttpRequestData req) { _log.Info("Get subscription"); var resp = req.CreateResponse(HttpStatusCode.OK); await resp.WriteStringAsync(_creds.GetSubscription().ToString()); return(resp); }