Exporting the Specific Tags applied at the subscription level

444 Views Asked by At

We wish to Export a specific Tags applied at all our subscriptions to a CSV File. As Tags parameter for the subscription is not available in PowerShell, is there any other way to do it. Ex : A Tag called department and value in some subscriptions which needs to be exported with the values.

We have used the below code to extract all the Tags in the subscriptions but not a specific Tag.

PowerShell :

$Tags = @() 
$Subscriptions = Get-AzSubscription
foreach ($sub in $Subscriptions)
{
Get-AzSubscription -SubscriptionName $sub.Name 
$Tags += Get-AzTag -ResourceId /Subscriptions/$sub
}
$Tags 

Any Help will be highly Appreciated.

Thanks

0

There are 0 best solutions below