Hi All,
I manage multiple Azure subscriptions and recently discovered that some virtual machines within these subscriptions have not executed the Azure Backup Agent correctly (I have scheduled the backup to run three times per day).
I require a script that retrieves the most recent execution times of the backup across all relevant virtual machines.
I would appreciate your assistance in providing a reliable solution. Kindly ensure the script is not generated using ChatGPT.
Thank you,
Koshila.

Daniel WrightPosted Feb 25, 2025, 12:29 PM
Hi Koshila,
It's great to see your interest in PowerShell scripts for Azure. Your requirement of retrieving the most recent execution times of backups across multiple Azure virtual machines is a common scenario, and PowerShell is indeed a powerful tool for such tasks.
To address your specific need, you can utilize PowerShell cmdlets to interact with Azure resources and retrieve the necessary information. Here's a high-level overview of how you can approach this:
1. Connect to Azure: Begin by connecting to your Azure account using PowerShell. You can do this by installing the Azure PowerShell module and then running the appropriate commands to authenticate.
2. Retrieve Backup Information: Once connected, you can use Azure PowerShell cmdlets to query backup-related information for your virtual machines. You would typically fetch details like the last backup execution time.
3. Filter and Display Data: Filter the retrieved data to focus on the most recent backup executions across all relevant virtual machines. You can then display this information in a readable format, such as a table or a custom report.
Below is a simplified example of PowerShell script snippets that could assist you in achieving this task:
This script provides a basic outline of how you can start retrieving and displaying backup execution times for your Azure virtual machines. You can further customize it based on your specific requirements and data structures.
If you need more advanced filtering or output formatting, additional PowerShell scripting may be required. Let me know if you need further assistance or if you have any specific criteria for this script to meet.
I hope this helps!