func EnvironmentFromURL(resourceManagerEndpoint string, properties ...OverrideProperty) (environment Environment, err error) {
	var metadataEnvProperties environmentMetadataInfo
	if resourceManagerEndpoint == "" {
		return environment, fmt.Errorf("Metadata resource manager endpoint is empty")
	}
	if metadataEnvProperties, err = retrieveMetadataEnvironment(resourceManagerEndpoint); err != nil {
		return environment, err
	}
	overrideProperties(&environment, properties)
	if environment.Name == "" {
		environment.Name = "HybridEnvironment"
	}
	stampDNSSuffix := environment.StorageEndpointSuffix
	if stampDNSSuffix == "" {
		stampDNSSuffix = strings.TrimSuffix(strings.TrimPrefix(strings.Replace(resourceManagerEndpoint, strings.Split(resourceManagerEndpoint, ".")[0], "", 1), "."), "/")
		environment.StorageEndpointSuffix = stampDNSSuffix
	}
	if environment.KeyVaultDNSSuffix == "" {
		environment.KeyVaultDNSSuffix = fmt.Sprintf("%s.%s", "vault", stampDNSSuffix)
	}
	if environment.KeyVaultEndpoint == "" {
		environment.KeyVaultEndpoint = fmt.Sprintf("%s%s", "https://", environment.KeyVaultDNSSuffix)
	}
	if environment.TokenAudience == "" {
		environment.TokenAudience = metadataEnvProperties.Authentication.Audiences[0]
	}
	if environment.ActiveDirectoryEndpoint == "" {
		environment.ActiveDirectoryEndpoint = metadataEnvProperties.Authentication.LoginEndpoint
	}
	if environment.ResourceManagerEndpoint == "" {
		environment.ResourceManagerEndpoint = resourceManagerEndpoint
	}
	if environment.GalleryEndpoint == "" {
		environment.GalleryEndpoint = metadataEnvProperties.GalleryEndpoint
	}
	if environment.GraphEndpoint == "" {
		environment.GraphEndpoint = metadataEnvProperties.GraphEndpoint
	}
	return environment, nil
}
EnvironmentFromURL loads an Environment from a URL
This function is particularly useful in the Hybrid Cloud model, where one may define their own
endpoints.
package azure
import (
	"encoding/json"
	"fmt"
	"io/ioutil"
	"net/http"
	"strings"
	"github.com/Azure/go-autorest/autorest"
)
type audience []string
type authentication struct {
	LoginEndpoint string   `json:"loginEndpoint"`
	Audiences     audience `json:"audiences"`
}
type environmentMetadataInfo struct {
	GalleryEndpoint string         `json:"galleryEndpoint"`
	GraphEndpoint   string         `json:"graphEndpoint"`
	PortalEndpoint  string         `json:"portalEndpoint"`
	Authentication  authentication `json:"authentication"`
}
type EnvironmentProperty string
const (
	EnvironmentName EnvironmentProperty = "name"
	EnvironmentManagementPortalURL EnvironmentProperty = "managementPortalURL"
	EnvironmentPublishSettingsURL EnvironmentProperty = "publishSettingsURL"
	EnvironmentServiceManagementEndpoint EnvironmentProperty = "serviceManagementEndpoint"
	EnvironmentResourceManagerEndpoint EnvironmentProperty = "resourceManagerEndpoint"
	EnvironmentActiveDirectoryEndpoint EnvironmentProperty = "activeDirectoryEndpoint"
	EnvironmentGalleryEndpoint EnvironmentProperty = "galleryEndpoint"
	EnvironmentKeyVaultEndpoint EnvironmentProperty = "keyVaultEndpoint"
	EnvironmentGraphEndpoint EnvironmentProperty = "graphEndpoint"
	EnvironmentServiceBusEndpoint EnvironmentProperty = "serviceBusEndpoint"
	EnvironmentBatchManagementEndpoint EnvironmentProperty = "batchManagementEndpoint"
	EnvironmentStorageEndpointSuffix EnvironmentProperty = "storageEndpointSuffix"
	EnvironmentSQLDatabaseDNSSuffix EnvironmentProperty = "sqlDatabaseDNSSuffix"
	EnvironmentTrafficManagerDNSSuffix EnvironmentProperty = "trafficManagerDNSSuffix"
	EnvironmentKeyVaultDNSSuffix EnvironmentProperty = "keyVaultDNSSuffix"
	EnvironmentServiceBusEndpointSuffix EnvironmentProperty = "serviceBusEndpointSuffix"
	EnvironmentServiceManagementVMDNSSuffix EnvironmentProperty = "serviceManagementVMDNSSuffix"
	EnvironmentResourceManagerVMDNSSuffix EnvironmentProperty = "resourceManagerVMDNSSuffix"
	EnvironmentContainerRegistryDNSSuffix EnvironmentProperty = "containerRegistryDNSSuffix"
	EnvironmentTokenAudience EnvironmentProperty = "tokenAudience"
)
type OverrideProperty struct {
	Key   EnvironmentProperty
	Value string
}