Hi Guys,
is there a way to export output from below script into excel, subscription wise ? or diff excels for each subscription ?
$resources = Get-AzureRmResource
foreach($resource in $resources)
{
if ($resource.Tags -eq $null)
{
echo $resource.Name, $resource.ResourceType
}
}
Try something like this:
Get-AzureRmResource | #Return all Resources (if you can filter tags here, it is better)
Where-Object -FilterScript {!($_.Tags)} | #if you can't filter at the command, you can filter with Where-Object, ! or -not NULL, which translates to IS NULL
Select-Object -Property Name, Resource | # Get the properties you care about
Export-CSV -Path C:\AzureResource.csv -NoTypeInformation #Export to a CSV