Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filters do not work / ResourceGraphQuerys for advanced Filters #20

Open
AndreasMWalter opened this issue Aug 30, 2024 · 2 comments
Open

Comments

@AndreasMWalter
Copy link

AndreasMWalter commented Aug 30, 2024

First of I assume the additional filters do not work, since you encountered issues upon implementing them.
I noticed that the REST API does not support all odata Filter options that one would assume that it should.

Microsoft has created resource graph for performant resource exploration
Using the Resource Graph Go Module should give the ability to both use advanced filters as well as looking up resources based on a management group such as for example a sandbox management group where the janitor would work on resources that are in the subscriptions below that management group removing the necessity to configure the janitor call each time a new sandbox subscription is added to that management group.

Example Query

	results, err := resGraphClient.Resources(ctx,
		armresourcegraph.QueryRequest{
			Query: to.Ptr("ResourceContainers | where type=='microsoft.resources/subscriptions/resourcegroups' | where tags['ttl'] and tags['ttl_excluded'] | project name, tags"),
			Subscriptions: []*string{
				to.Ptr(subscriptionId)},
		},
		nil)
@mblaschke
Copy link
Member

what filters do you need for the janitor?

@AndreasMWalter
Copy link
Author

For our usecase we wanted to have additional tags to filter on, or mark specific resource groups.
We have so far solved this issue by using azure policy to only add the ttl tag to the resource groups we want gone...

So I do have a workaround for the problem, but wanted to leave the reference to resource graph so that the filters could be implemented as possibly were intended?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants