Azure Kubernetes Service tags not propagated to underlying resources

11/26/2018

when creating AKS cluster - Azure is creating additional resource group - "cluster resource group", however the "new" resource group is not applying / propagating tags from the AKS resource.

is there any easy way of propagating the tags to all resources created in "cluster resource group" (e.q. disk / VM's / LB)?

-- ar0
azure
azure-aks
azure-kubernetes
kubernetes

1 Answer

11/28/2018

No, there is no built-in way to do that. You could create a simple powershell script to do that, something like this:

$q = Get-AzResource -ResourceGroupName 'fin-dev-eu'
$tags=(desired tags go here)
$q.foreach{
    $localtags = $_.tags
    if ($localtags.keys -contains 'schedule') {
        $localtags.resourceType = $tags.resourceType
        $localtags.resourceName = $tags.resourceName
    }
    else { $localtags = $tags }
    Set-AzResource -ResourceId $_.resourceId -Tag $localtags -Force
}
-- 4c74356b41
Source: StackOverflow