Export Azure Resource list using Powershell.

CMD: az login


CMD: Set-AzContext "Subscription"


CMD : listresources.ps1


Open the notepad and save as listresources.ps1

Add this script in the file

try {

$rgs = Get-AzResourceGroup

foreach ($rg in $rgs.ResourceGroupName)

{

Write-Output "Checking Resource Group: $rg"

Get-AzResource -ResourceGroupName $rg | Select Name, ResourceGroupName, Type, Location | Export-Csv .\AzureResources.csv -Append -Force -NoTypeInformation

} }

catch {

Write-Host "$($_.Exception.Message)" -BackgroundColor DarkRed

}



要查看或添加评论,请登录

Frederickson Fernandaz的更多文章

社区洞察

其他会员也浏览了