码迷,mamicode.com
首页 > 系统相关 > 详细

Azure按订阅,资源组,资源类型导出所有资源powershell命令

时间:2018-12-21 16:04:41      阅读:282      评论:0      收藏:0      [点我收藏+]

标签:shell   upn   ros   res   contex   compute   source   shel   xxxxxx   

一般可以借助powershell命令来读取资源:
例如:
1, 读取某个订阅下的资源:
$subscriptionID = "xxxxxxxx"
Set-AzureRmContext $subscriptionID
Get-AzureRMResource  | export-csv allresource.csv
2, 读取某个订阅下的某个资源组下的所有资源:
$subscriptionID = "xxxxxxxx"
Set-AzureRmContext $subscriptionID
$resourcegroup = "xxxx"
Get-AzureRMResource -ResourceGroupName $resourcegroup | export-csv resourceinRG.csv
3,  读取某个订阅下的某个资源组下的特定类型的资源(例如:virtual machine):
$subscriptionID = "xxxxxxxx"
Set-AzureRmContext $subscriptionID
$resourcegroup = "xxxx"
$resourcetype = "Microsoft.Compute/virtualMachines"
Get-AzureRMResource -ResourceGroupName $resourcegroup -ResourceType $resourcetype | export-csv VMresource.csv

Azure按订阅,资源组,资源类型导出所有资源powershell命令

标签:shell   upn   ros   res   contex   compute   source   shel   xxxxxx   

原文地址:https://www.cnblogs.com/lkun/p/10156015.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!