public IAsyncResult BeginCreateStorageAccount(string subscriptionId, CreateStorageServiceInput createStorageServiceInput, AsyncCallback callback, object state)
 {
     SimpleServiceManagementAsyncResult result = new SimpleServiceManagementAsyncResult();
     result.Values["subscriptionId"] = subscriptionId;
     result.Values["createStorageServiceInput"] = createStorageServiceInput;
     result.Values["callback"] = callback;
     result.Values["state"] = state;
     return result;
 }
        /// <summary>
        /// Create an Azure storage account that we can use to upload our
        /// package when creating and deploying a service.
        /// </summary>
        private void CreateStorageAccount()
        {
            Debug.Assert(
                !string.IsNullOrEmpty(_deploymentSettings.ServiceSettings.StorageAccountName),
                "StorageAccountName cannot be null or empty.");
            Debug.Assert(
                !string.IsNullOrEmpty(_deploymentSettings.Label),
                "Label cannot be null or empty.");
            Debug.Assert(
                !string.IsNullOrEmpty(_deploymentSettings.ServiceSettings.Location),
                "Location cannot be null or empty.");

            CreateStorageServiceInput storageServiceInput = new CreateStorageServiceInput
            {
                ServiceName = _deploymentSettings.ServiceSettings.StorageAccountName,
                Label = ServiceManagementHelper.EncodeToBase64String(_deploymentSettings.Label),
                Location = _deploymentSettings.ServiceSettings.Location
            };

            InvokeInOperationContext(() =>
            {
                RetryCall(subscription =>
                    Channel.CreateStorageAccount(subscription, storageServiceInput));

                StorageService storageService = null;
                do
                {
                    storageService = RetryCall(subscription =>
                        Channel.GetStorageService(subscription, storageServiceInput.ServiceName));
                }
                while (storageService.StorageServiceProperties.Status != StorageAccountStatus.Created);
            });
        }
Exemplo n.º 3
0
 public static void CreateStorageAccount(this IServiceManagement proxy, string subscriptionId, CreateStorageServiceInput createStorageServiceInput)
 {
     proxy.EndCreateStorageAccount(proxy.BeginCreateStorageAccount(subscriptionId, createStorageServiceInput, null, null));
 }