ValidateSubscription() public static method

Validates that the given subscription is valid.
public static ValidateSubscription ( AzureSubscription subscription ) : void
subscription Microsoft.Azure.Commands.Common.Authentication.Models.AzureSubscription The to validate.
return void
Exemplo n.º 1
0
        /// <summary>
        /// Retrieve the SQL Management client for the currently selected subscription.
        /// </summary>
        /// <returns>The SQL Management client for the currently selected subscription.</returns>
        public static SqlManagementClient GetCurrentSqlClient()
        {
            // Get the SQL management client for the current subscription
            WindowsAzureSubscription subscription = WindowsAzureProfile.Instance.CurrentSubscription;

            SqlDatabaseCmdletBase.ValidateSubscription(subscription);
            return(subscription.CreateClient <SqlManagementClient>());
        }
        /// <summary>
        /// Retrieve the SQL Management client for the currently selected subscription, adding the session and request
        /// id tracing headers for the current cmdlet invocation.
        /// </summary>
        /// <returns>The SQL Management client for the currently selected subscription.</returns>
        protected SqlManagementClient GetCurrentSqlClient()
        {
            // Get the SQL management client for the current subscription
            WindowsAzureSubscription subscription = WindowsAzureProfile.Instance.CurrentSubscription;

            SqlDatabaseCmdletBase.ValidateSubscription(subscription);
            SqlManagementClient client = subscription.CreateClient <SqlManagementClient>();

            client.HttpClient.DefaultRequestHeaders.Add(Constants.ClientSessionIdHeaderName, clientSessionId);
            client.HttpClient.DefaultRequestHeaders.Add(Constants.ClientRequestIdHeaderName, clientRequestId);
            return(client);
        }
        /// <summary>
        /// Retrieve the SQL Management client for the currently selected subscription, adding the session and request
        /// id tracing headers for the current cmdlet invocation.
        /// </summary>
        /// <returns>The SQL Management client for the currently selected subscription.</returns>
        protected SqlManagementClient GetCurrentSqlClient()
        {
            // Get the SQL management client for the current subscription
            IAzureSubscription subscription = Profile.Context.Subscription;

            SqlDatabaseCmdletBase.ValidateSubscription(subscription);
            SqlManagementClient client = AzureSession.Instance.ClientFactory.CreateClient <SqlManagementClient>(Profile, subscription, AzureEnvironment.Endpoint.ServiceManagement);

            client.HttpClient.DefaultRequestHeaders.Add(Constants.ClientSessionIdHeaderName, clientSessionId);
            client.HttpClient.DefaultRequestHeaders.Add(Constants.ClientRequestIdHeaderName, clientRequestId);
            return(client);
        }