对于自动化帐户,使用 azure 资源图是否比 powershell cmdlet 更快?

For automation accounts, is using the azure resource graph faster than powershell cmdlets?

查看在 Azure 自动化帐户中编写的几个 powershell 脚本,使用 Azure Resource Graph 而非 Azure Powershell cmdlet 来更新所有资源通常更快吗?

Azure Resource Graph 是可用于查询 Azure 中的某些资源及其基本属性的服务。

针对一个资源组使用 Azure PowerShell 很容易,但是当您需要查询多个资源组或订阅中的资源时,事情会变得更加复杂。 Azure Resource Graph 是一种探索工具,旨在高效查询 Azure 租户中的不同类型的资源

您不会得到与 Azure PowerShell 查询中相同的结果,但您会在您的订阅或订阅的子集中更快地获得结果

您可以使用以下命令安装此模块 -

Install-Module -Name Az.ResourceGraph -Scope CurrentUser

Resource Graph 使用的查询语言是 Kusto 查询语言 (KQL),与您在 Azure 数据资源管理器或 Azure Monitor 中使用的相同。

请注意,您不会像 PowerShell 那样获得包含每个对象的完整详细信息的对象集合,而是包含有限数据的表格结果。

我建议阅读 Get started with Azure Resource Graph and PowerShell, Microsoft Azure Resource Graph is a Powerful Tool and What's the difference between Azure AD Graph, Azure Resource Graph and Microsoft Graph 文档以获取更多信息。