You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何通过PowerShell或Azure门户获取使用特定存储账户的所有Azure资源?

查找Azure中关联特定存储账户的所有资源

PowerShell 方法

Get-AzStorageAccount仅能获取存储账户自身信息,要查询关联资源,推荐使用Azure资源图(高效跨资源/订阅查询),步骤如下:

  1. 先获取目标存储账户的资源ID:
$storageAccountId = (Get-AzStorageAccount -ResourceGroupName "<resourcegroup>" -Name "<storage acct>").Id
  1. 执行资源图查询,找出所有引用该存储账户ID的资源:
Search-AzGraph -Query "resources | where properties.storageAccountId == '$storageAccountId' or properties.storageAccount.id == '$storageAccountId' or properties contains '$storageAccountId' | project name, type, resourceGroup"

该查询覆盖了多数资源存储关联信息的字段,返回结果包含资源名称、类型和所属资源组。

如果仅需查询当前订阅内的资源,也可使用以下命令(遍历所有资源,效率较低):

Get-AzResource | Where-Object { $_.Properties -match $storageAccountId } | Select-Object Name, ResourceType, ResourceGroupName

Azure门户方法

方法1:存储账户依赖项视图

  1. 登录Azure门户,定位到目标存储账户。
  2. 在左侧菜单的「监视」分类下,打开依赖项页面,这里会展示直接关联的资源(如虚拟机托管磁盘、函数应用、逻辑应用等)。

方法2:Azure资源图 Explorer

  1. 在门户搜索栏输入「资源图 Explorer」并进入。
  2. 在查询编辑器中输入Kusto查询语句(替换为你的存储账户资源ID):
resources 
| where properties contains '<存储账户资源ID>'
| project name, type, resourceGroup
  1. 点击「运行查询」,即可获取所有关联资源的列表。

内容的提问来源于stack exchange,提问作者Christy

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.23 16:32:50