private async Task <GSEnvironments> GetServiceConfig(string discoveryUrl)
        {
            using (var client = new HttpClient())
            {
                client.DefaultRequestHeaders.Accept.Clear();
                var response = await client.PostAsync(discoveryUrl, null);

                var serializer = new DataContractJsonSerializer(typeof(GSEnvironments));

                this.CustomServiceEnvironments = serializer.ReadObject(await response.Content.ReadAsStreamAsync()) as GSEnvironments;
            }

            return(this.CustomServiceEnvironments);
        }
示例#2
0
        private static void AssertValidCloudEnvironment(string cloudName, IPowerBIEnvironment environment, GSEnvironments cloudEnvironments)
        {
            var cloudEnvironment = cloudEnvironments.Environments.FirstOrDefault(c => c.CloudName.Equals(cloudName, StringComparison.OrdinalIgnoreCase));
            var backendService   = cloudEnvironment.Services.First(s => s.Name.Equals("powerbi-backend", StringComparison.OrdinalIgnoreCase));

            Assert.AreEqual(cloudEnvironment.Services.First(s => s.Name.Equals("aad", StringComparison.OrdinalIgnoreCase)).Endpoint, environment.AzureADAuthority);
            AssertValidEnvironmentSharedProperties(environment);
            Assert.AreEqual(backendService.ResourceId, environment.AzureADResource);
            Assert.AreEqual(backendService.Endpoint, environment.GlobalServiceEndpoint);
        }