Пример #1
0
        /// <summary>
        /// Gets current storage account using current subscription.
        /// </summary>
        /// <returns>The current storage account</returns>
        public CloudStorageAccount GetCurrentStorageAccount()
        {
            Binding serviceBinding  = Microsoft.WindowsAzure.Management.Utilities.Common.ConfigurationConstants.WebHttpBinding(0);
            string  serviceEndpoint = string.IsNullOrEmpty(ServiceEndpoint) ?
                                      Microsoft.WindowsAzure.Management.Utilities.Common.ConfigurationConstants.ServiceManagementEndpoint :
                                      ServiceEndpoint;
            IServiceManagement channel = ServiceManagementHelper.CreateServiceManagementChannel <IServiceManagement>(
                serviceBinding,
                new Uri(ServiceEndpoint),
                Certificate);

            return(GetCurrentStorageAccount(channel));
        }
Пример #2
0
        protected virtual T CreateChannel()
        {
            // If ShareChannel is set by a unit test, use the same channel that
            // was passed into out constructor.  This allows the test to submit
            // a mock that we use for all network calls.
            if (ShareChannel)
            {
                return(Channel);
            }

            return(ServiceManagementHelper.CreateServiceManagementChannel <T>(
                       ServiceBinding,
                       new Uri(ServiceEndpoint),
                       CurrentSubscription.Certificate,
                       new HttpRestMessageInspector(WriteDebug)));
        }