예제 #1
0
 public AzureClient(
     string resourceManagerEndpoint = "management.azure.com",
     string apiVersion      = "2015-01-01",
     AzureMetadata metadata = null)
 {
     this.ResouceManagerEndpoint = resourceManagerEndpoint;
     this.ApiVersion             = apiVersion;
     this.Metadata = metadata;
 }
예제 #2
0
        public static async Task <AzureMetadata> GetAzureMetadata(string azureResourceManager = "management.azure.com", string apiVersion = "1.0")
        {
            JObject response = await GetAzureResourceManagerMetadataAsJObject(azureResourceManager, apiVersion);

            JObject authentication = response.Value <JObject>("authentication");

            AzureMetadata metadata = new AzureMetadata()
            {
                Audiences = authentication
                            .Value <JArray>("audiences")
                            .Select(audience => audience.Value <string>())
                            .ToArray(),
                LoginEndpoint = authentication
                                .Value <string>("loginEndpoint")
            };

            return(metadata);
        }