private IAzureEnvironment EnsureCustomAudienceSet(IAzureEnvironment environment, string customAudience)
 {
     if (environment != null)
     {
         if (!environment.IsPropertySet(customAudience))
         {
             environment.SetProperty(customAudience, customAudience);
         }
     }
     return(environment);
 }
Beispiel #2
0
        private IAzureEnvironment EnsureStorageOAuthAudienceSet(IAzureEnvironment environment)
        {
            if (environment != null)
            {
                if (!environment.IsPropertySet(StorageOAuthEndpointResourceKey))
                {
                    environment.SetProperty(StorageOAuthEndpointResourceKey, StorageOAuthEndpointResourceValue);
                }
            }

            return(environment);
        }
Beispiel #3
0
        /// <summary>
        /// Try to get the uri from the environment mathcing the given name
        /// </summary>
        /// <param name="environment">The environment to get the value from</param>
        /// <param name="endpointName">The name of the endpoint to attempt to get</param>
        /// <param name="endpoint">The returned endpoint value as a Uri, or null if no endpoint was found</param>
        /// <returns>true if the endpoint was found, otherwise false</returns>
        public static bool TryGetEndpointUrl(this IAzureEnvironment environment, string endpointName, out Uri endpoint)
        {
            bool result = true;

            endpoint = null;
            switch (endpointName)
            {
            case AzureEnvironment.Endpoint.ActiveDirectory:
                endpoint = new Uri(environment.ActiveDirectoryAuthority);
                break;

            case AzureEnvironment.Endpoint.Gallery:
                endpoint = new Uri(environment.GalleryUrl);
                break;

            case AzureEnvironment.Endpoint.Graph:
                endpoint = new Uri(environment.GraphUrl);
                break;

            case AzureEnvironment.Endpoint.ManagementPortalUrl:
                endpoint = new Uri(environment.ManagementPortalUrl);
                break;

            case AzureEnvironment.Endpoint.PublishSettingsFileUrl:
                endpoint = new Uri(environment.PublishSettingsFileUrl);
                break;

            case AzureEnvironment.Endpoint.ResourceManager:
                endpoint = new Uri(environment.ResourceManagerUrl);
                break;

            case AzureEnvironment.Endpoint.ServiceManagement:
                endpoint = new Uri(environment.ServiceManagementUrl);
                break;

            case AzureEnvironment.Endpoint.ActiveDirectoryServiceEndpointResourceId:
                endpoint = new Uri(environment.ActiveDirectoryServiceEndpointResourceId);
                break;

            case AzureEnvironment.Endpoint.GraphEndpointResourceId:
                endpoint = new Uri(environment.GraphEndpointResourceId);
                break;

            case AzureEnvironment.Endpoint.DataLakeEndpointResourceId:
                endpoint = new Uri(environment.DataLakeEndpointResourceId);
                break;

            case AzureEnvironment.Endpoint.BatchEndpointResourceId:
                endpoint = new Uri(environment.BatchEndpointResourceId);
                break;

            default:
                result = environment.IsPropertySet(endpointName);
                if (result)
                {
                    endpoint = new Uri(environment.GetProperty(endpointName));
                }
                break;
            }

            return(result);
        }