Export Azure Resource list using Powershell.
Frederickson Fernandaz
Architecture Specialist | Azure DevOps Services, IaaS,PaaS
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
}