azure - 如何使用 PowerShell 获取 Azure 资源的对象 ID
问题描述
如何使用 PowerShell cmdlet 获取 Azure 资源的对象 ID?
我尝试使用Get-AzureRmResource -ResourceName 'my-resource' | fl
但失败并出现错误:Parameter set cannot be resolved using the specified named parameters
我也尝试过使用Get-AzResource -Name 'my-resource'
,但在它检索到的信息中,它不包括对象 ID。
解决方案
In Azure, there is no such Object Id
for azure resources in the subscription, there is just a ResourceId
with the format /subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}
.
You can get it via Get-AzResource
you used, it returns the ResourceId
.
推荐阅读
- angular - 在 Kendo for Angular 中禁用打开上下文菜单
- node.js - 如何使用 Loopback 在模型中创建 CRUD 方法?
- nunit - 使用 NUnit GUI 运行器时 NUnit XML 输出在哪里?
- excel - 将 Pandas DataFrame 转换为 Excel 工作表
- regex - 匹配PowerShell正则表达式中的多个条件
- react-native - 什么是 React Native 的 jest-preset 中的“haste”配置
- r - 使用 R(DBI 包)从 SQL Server 表中删除行
- javascript - 将 ParticlesJs 集成到视图组件中
- python - AutoShardedBot 和普通 Bot 之间有什么重大差异吗?
- mysql - 为什么我在选择yes 再次播放后无法更新我的html 模型?