一般可以借助powershell命令来读取资源:
例如:
1, 读取某个订阅下的资源:
$subscriptionID = "xxxxxxxx"
Set-AzureRmContext $subscriptionID
Get-AzureRMResource | export-csv allresource.csv
例如:
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
$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
$subscriptionID = "xxxxxxxx"
Set-AzureRmContext $subscriptionID
$resourcegroup = "xxxx"
$resourcetype = "Microsoft.Compute/virtualMachines"
Get-AzureRMResource -ResourceGroupName $resourcegroup -ResourceType $resourcetype | export-csv VMresource.csv