private async Task <IEnumerable <ResourceGroup> > GetResourceGroups(IEnumerable <ResourceProvider> resourceProviders, Subscription subscription) { IEnumerable <ResourceGroup> resourceGroups = null; if (_connectionType == ConnectionType.GeoMasterStamp) { List <ResourceGroup> rdfeResourceGroups = new List <ResourceGroup>(); IEnumerable <Location> locations = await _client.GetLocations(subscription); foreach (Location location in locations) { string webspace = location.Name; string resourceGroup = "Default-Web-" + webspace.Replace(" ", ""); rdfeResourceGroups.Add(new ResourceGroup() { Id = resourceGroup, Name = resourceGroup, Location = location.Name, Providers = await GetResourceProviders(subscription) }); } return(await Task.FromResult <IEnumerable <ResourceGroup> >(rdfeResourceGroups)); } string tenantToken = await _client.GetAuthSecret(subscription.TenantId); string response = await _client.CallAzureResourceManager( method : "GET", path : string.Format(@"/subscriptions/{0}/resourceGroups", subscription.Id), token : tenantToken, body : null); if (!string.IsNullOrWhiteSpace(response)) { JObject json = JObject.Parse(response); resourceGroups = json .Value <JArray>("value") .Select(provider => new ResourceGroup() { Id = provider.Value <string>("id"), Name = provider.Value <string>("name"), Location = provider.Value <string>("location"), Providers = CloneProviders(resourceProviders.Where(p => p.Name.StartsWith("Microsoft.Web"))) }); } return(resourceGroups); }