public async Task <TenantsList> GetTenantsList() { var authResult = await _authContext.AcquireTokenSilentAsync("https://management.core.windows.net/", _clientCredential, new UserIdentifier(_userObjectId, UserIdentifierType.UniqueId)); using (var httpClient = new HttpClient()) { httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", authResult.AccessToken); var response = httpClient.PostAsync("https://portal.azure.com/AzureHubs/api/tenants/List", null).Result; string responseContent = await response.Content.ReadAsStringAsync(); if (!response.IsSuccessStatusCode) { return(null); } else { TenantsList tenants = JsonConvert.DeserializeObject <TenantsList>(responseContent); return(tenants); } } }
public TenantForm() { TenantsList = new TenantsList(); }