一般可以借助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
原文地址:https://www.cnblogs.com/lkun/p/10156015.html
时间: 2024-10-10 16:12:31