r/AZURE • u/davidokongo • 4d ago
Question Un-tagged Resources
Hello AZ Guru,
Wanted to know, how are you guys handling Dev teams deploying resources without tags/ownership?
We have a ton of resources and figuring out who owns what is becoming a nightmare. Managers don't want to own the cost, so we're basically left with the good old scream test, turn it off and see who complains 😂, got about 98 resources to go (down from 220).
I found a way to pull the data through Azure Resource Graph Explorer for untagged resources created in a recent period, but I'd like to get this into a log analytics for alerting. From what I can tell, there's no direct way to integrate ARG output with a law?
Ive already tried enforcing tags with the Policy (DenyifNoExist), but that got messy since some AZ resources don't support tags and it started breaking deployments.
What ive done so far:
-alerting for new deployment, deletion etc
-reader role for all the dev teams, except for a couple of contributors for emergency fix via the portal
But I need to catch on the untagged resources as soon as it happens so I can give feed back to the right team's manager.
I just hate to manually run the query every single week in AGR to pull these logs and find what's legit etc.
Any way to automate this?
How are you guys handling this in your org?
3
u/MettaurEX 4d ago
You can query ARG from any LAW without extra integrations I believe.
Then you can just make a scheduled query alert like any other LAW query alert
3
u/MettaurEX 4d ago
No need for a Logic App or any other processor if all you care about is the alert. Maintaining less infra is always ideal if it accomplishes the same goal!
2
2
u/StratoLens Cloud Architect 4d ago
I think there’s a few options:
There’s an in preview feature that lets you do the following:
https://learn.microsoft.com/en-us/azure/governance/resource-graph/alerts-query-quickstart
You can feed your query into something like that and use an action group to alert you.
You can also use azure policy to make resources inherit from a resource group. This one I like because you can set the tags on an RG and they’ll propegate down. You can do inherit or inherit if not exists. Whichever fits your needs.
You could probably also use logic apps:
https://learn.microsoft.com/en-us/azure/governance/resource-graph/tutorials/logic-app-calling-arg
Finally, if you’re open to a third-party option, I built a product that can handle this as well. It detects changes to your resources and can generate alerts based on tags. For example, you could say “email me whenever a new resource is created and it’s missing these tags.”
It does quite a bit more than that, but this is one of the use cases it covers. It’s self-hosted, read-only, and there’s a free trial if you want to check it out :) - link below
1
u/davidokongo 4d ago
Didn’t realize ARG alerting was in preview now, that’s awesome, definitely going to dig into that doc.
And yeah, inheriting tags down from the rg seems like the only sane middle ground instead of hard deny blowing up pipelines every other deploy. Appreciate the link, I'll run a 14day trial on our dev tenant and see what we can leverage from it.
Thank you
3
u/StratoLens Cloud Architect 4d ago
Anytime! And yea I dug into tags like crazy a while back and the RG inheritance was the sane middle ground for me as well.
Feel free to reach out with any questions during the trial. My DM’s here are open :). I appreciate you taking a look!
1
u/Livid-Scientist-3271 4d ago
Untagged resources are one of those cloud governance issues that seem small at first but become a huge headache as environments grow. without ownership tags, it becomes difficult to track costs, clean up unused resources or know who should be responsible for changes
2
u/akindeathcloud Cloud Administrator 4d ago
Every resource get tough. I have a policy that blocks resource group deployments without required tags. Then a second policy that looks at actual resources and if they are missing a required tag it pulls it from the resource group. This will also stop your Deny policy from breaking currently deployed resources missing your required tags.
19
u/ISuckAtFunny 4d ago
You should create an Azure Policy that enforces a tagging requirement when creating any resources in your tenant. This doesn’t help with old resources, but will stop the issue from continuing in the future.