private void RefreshContainer(string resourceGroupName, string resourceName) { bool isRetryNeeded = true; int retryCount = 1; bool isDiscoverySuccessful = false; string errorMessage = string.Empty; while (isRetryNeeded && retryCount <= 3) { var operationId = AzureBackupClient.RefreshContainers(resourceGroupName, resourceName); //Now wait for the operation to Complete isRetryNeeded = WaitForDiscoveryToComplete(resourceGroupName, resourceName, operationId, out isDiscoverySuccessful, out errorMessage); retryCount++; } if (!isDiscoverySuccessful) { ThrowTerminatingError(new ErrorRecord(new Exception(errorMessage), string.Empty, ErrorCategory.InvalidArgument, null)); } }