PowerShell to get any successful Azure object deployment or creation in the past 24 hours

EnterpriseArchitect
6,166
Reputation points
How can I get these results sent to me daily via email?
# Make sure the Az module is installed & imported
# Install-Module Az -Scope CurrentUser
Connect-AzAccount
# Define time range
$startTime = (Get-Date).AddDays(-1)
$endTime = Get-Date
# Query the activity log
Get-AzActivityLog -StartTime $startTime -EndTime $endTime -Status Succeeded -WarningAction SilentlyContinue |
Where-Object {
# OperationName usually contains verbs like 'write', 'create', 'deploy'
$_.OperationName.Value -match 'write|create|deploy'
} |
Select-Object `
EventTimestamp,
ResourceGroupName,
ResourceId,
@{Name='Operation';Expression={$_.OperationName.LocalizedValue}},
Caller,
Status |
Sort-Object EventTimestamp -Descending
using Azure Automation?
Azure Automation
Azure Automation
An Azure service that is used to automate, configure, and install updates across hybrid environments.
Sign in to answer