private static async Task WaitForOperationAsync(string source, SubscriptionListOperationResponse.Subscription subscription, ComputeManagementClient client, string requestId)
        {
            var statusResponse = await client.GetOperationStatusAsync(requestId);

            while (statusResponse.Status == OperationStatus.InProgress)
            {
                Logger.InfoFormat("Waiting for operation to finish...");
                await Task.Delay(5000);

                RefreshCredentials(source, subscription, client.Credentials);
                statusResponse = await client.GetOperationStatusAsync(requestId);
            }
            if (statusResponse.Status == OperationStatus.Failed)
            {
                throw new CloudException("Operation failed with code " + statusResponse.Error.Code + ": " + statusResponse.Error.Message);
            }
        }