如何获取给定时间的 Azure 资源列表

How to get the list of Azure Resources at a given time

我面临这样一种情况,我需要一周到一个月前的 azure 资源与现在的资源(应用服务、数据库等)进行比较,以确定发生了什么变化。

如何做到这一点?通过 restful api 或 powershell 或任何其他方式。

谢谢。

Azure 门户:

通过activity日志,可以确定:

• 对您订阅的资源进行了哪些操作

• 谁发起了操作(尽管由后端服务发起的操作不是 return 用户作为调用者)

• 操作发生时

• 操作状态

• 可能有助于您研究操作的其他属性的值

Azure PowerShell:

检索日志条目:

Get-AzureRmLog

检索资源组的操作:

Get-AzureRmLog -ResourceGroup myResourceGroup

Azure CLI:

检索日志条目:

az monitor activity-log list 

检索资源组的操作:

az monitor activity-log list --resource-group <group name>

休息 API:

使用 activity 日志的 REST 操作是 Insights REST API 的一部分。要检索 activity 日志事件,请参阅列出订阅中的管理事件。

详情请参考“View activity log to audit actions on resources”。

注:Activity登录blade"Event Initiated By"栏会有发起请求的用户名。 Get-AzureRMLog 也可以,您需要注意来电者 属性。您将其视为空白条目的可能原因是它们是结构发起的事件,而不是由唯一用户发起的事件。如果要搜索特定呼叫者,请使用 -StartTime 和 -Caller 参数。

Archive the Azure Activity Log: 除非您将日志存档到存储帐户,否则保留期为 90 天,因此请确保您搜索的是过去 90 天内发生的 activity。