public static async Task ReportNumberOfMessages(string connectionString, string destination) { var client = new ServiceBusAdministrationClient(connectionString); QueueRuntimeProperties info = await client.GetQueueRuntimePropertiesAsync(destination); long activeMessageCount = info.ActiveMessageCount; long deadLetterMessageCount = info.DeadLetterMessageCount; long transferDeadLetterMessageCount = info.TransferDeadLetterMessageCount; string destinationDeadLetterPath = EntityNameHelper.FormatDeadLetterPath(destination); string destinationTransferDeadLetterPath = EntityNameHelper.FormatTransferDeadLetterPath(destination); Console.WriteLine($"#'{activeMessageCount}' messages in '{destination}'"); Console.WriteLine( $"#'{deadLetterMessageCount}' messages in '{destinationDeadLetterPath}'"); Console.WriteLine( $"#'{transferDeadLetterMessageCount}' messages in '{destinationTransferDeadLetterPath}'"); }