# Restrict metric access via IAM policy

**URL:** <https://community.dynatrace.com/t/restrict-metric-access-via-iam-policy/49751>\
**Category:** Open Q&A\
**Tags:** user-management, dynatrace-managed\
**Created:** [January 16, 2025, 9:06am UTC](https://community.dynatrace.com/t/restrict-metric-access-via-iam-policy/49751 "2025-01-16T09:06:03Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![avdveen](https://avatars.discourse-cdn.com/v4/letter/a/ed8c4c/32.png) [@avdveen](https://community.dynatrace.com/u/avdveen)\
**Post date:** [January 16, 2025, 9:06am UTC](https://community.dynatrace.com/t/restrict-metric-access-via-iam-policy/49751/1 "2025-01-16T09:06:03Z")

</div>

Hi, is it possible to restrict user access to specific metrics via IAM policies? Based on the documentation, specifically the [storage:metric.key](https://docs.dynatrace.com/docs/shortlink/iam-policystatements#storage-metrics-read), it seems it is, but I’m curious if anyone’s done it before and if so, what would the syntax look like?

The client wants to restrict access to e.g., Azure firewall metrics so that only certain people can see them and the datapoints.

Thanks in advance,  
André

---

<div class="post-metadata">

**Author:** ![PacoPorro](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/pacoporro/32/36087_2.png) [@PacoPorro](https://community.dynatrace.com/u/PacoPorro)\
**Post date:** [January 16, 2025, 11:33am UTC](https://community.dynatrace.com/t/restrict-metric-access-via-iam-policy/49751/2 "2025-01-16T11:33:18Z")

</div>

Please check the ABAC approach in the documentation.

> **[ABAC implementation in your Dynatrace - Upgrade role-based permissions to...](https://docs.dynatrace.com/docs/manage/identity-access-management/permission-management/manage-user-permissions-policies/advanced/migrate-roles#abac-implementation-in-your-dynatrace)**
>
> Dynatrace version 1.266+ | Manage access to a Dynatrace environment using security policies.

The overall idea is to apply a boundary to a policy.

> **[Policy boundaries](https://docs.dynatrace.com/docs/manage/identity-access-management/permission-management/manage-user-permissions-policies/iam-policy-boundaries)**
>
> Restrict security policies with policy boundaries to provide tailored access to your users.

---

<div class="post-metadata">

**Author:** ![avdveen](https://avatars.discourse-cdn.com/v4/letter/a/ed8c4c/32.png) [@avdveen](https://community.dynatrace.com/u/avdveen)\
**Post date:** [January 16, 2025, 3:57pm UTC](https://community.dynatrace.com/t/restrict-metric-access-via-iam-policy/49751/3 "2025-01-16T15:57:54Z")

</div>

Thanks [@PacoPorro](https://community.dynatrace.com/user/40713), I reviewed the docs before posting here 😉  
The config I applied doesn’t seem to work in my case, hence me hoping for an example or someone confirming it is actually possible to do it for specific metrics 🙂

Here’s my policy and boundary syntax, perhaps I’m doing it wrong? I’ve applied the policy and boundary to my group, and added the user to the group.

Policy: ALLOW storage:metrics:read WHERE storage:metric.key=‘fragmentation.percentage’;  
Boundary: storage:metric.key=‘fragmentation.percentage’;

---

<div class="post-metadata">

**Author:** ![DanielS](https://avatars.discourse-cdn.com/v4/letter/d/3ab097/32.png) [@DanielS](https://community.dynatrace.com/u/DanielS)\
**Post date:** [January 20, 2025, 8:14pm UTC](https://community.dynatrace.com/t/restrict-metric-access-via-iam-policy/49751/4 "2025-01-20T20:14:01Z")

</div>

Hi [@andre\_vdveen](https://community.dynatrace.com/user/11931) I copy an example of what I have configured and it is working as expected. Hope it helps you.

 ![DanielS_0-1737403997795.png](https://global.discourse-cdn.com/dynatrace/original/3X/d/9/d979f2dd576c66a477362e085e8822093710c7e8.png)

---

<div class="post-metadata">

**Author:** ![avdveen](https://avatars.discourse-cdn.com/v4/letter/a/ed8c4c/32.png) [@avdveen](https://community.dynatrace.com/u/avdveen)\
**Post date:** [January 21, 2025, 10:20am UTC](https://community.dynatrace.com/t/restrict-metric-access-via-iam-policy/49751/5 "2025-01-21T10:20:49Z")

</div>

Hi&nbsp;[@DanielS](https://community.dynatrace.com/user/35788)&nbsp;thanks for sharing.

I’ve set it up exactly as you have it there in the screenshots, and applied the policy to my group, then added my user to the group (allow access) and made sure my other user (test user, no access) is not in that group, but the test user still has access to the metric 😞

I must be doing something wrong here, clearly…

---

<div class="post-metadata">

**Author:** ![PacoPorro](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/pacoporro/32/36087_2.png) [@PacoPorro](https://community.dynatrace.com/u/PacoPorro)\
**Post date:** [January 21, 2025, 10:25am UTC](https://community.dynatrace.com/t/restrict-metric-access-via-iam-policy/49751/6 "2025-01-21T10:25:43Z")

</div>

Is it possible that the test user has unrestricted access to the metric storage?

---

<div class="post-metadata">

**Author:** ![avdveen](https://avatars.discourse-cdn.com/v4/letter/a/ed8c4c/32.png) [@avdveen](https://community.dynatrace.com/u/avdveen)\
**Post date:** [January 21, 2025, 11:07am UTC](https://community.dynatrace.com/t/restrict-metric-access-via-iam-policy/49751/7 "2025-01-21T11:07:46Z")

</div>

Most likely, yes but I thought custom metrics like in my case, would not fall under the scope for a user that is only a member of the ‘Monitoring viewer’ group, no other.

---

<div class="post-metadata">

**Author:** ![DanielS](https://avatars.discourse-cdn.com/v4/letter/d/3ab097/32.png) [@DanielS](https://community.dynatrace.com/u/DanielS)\
**Post date:** [January 22, 2025, 3:24am UTC](https://community.dynatrace.com/t/restrict-metric-access-via-iam-policy/49751/8 "2025-01-22T03:24:47Z")

</div>

Look, [@andre\_vdveen](https://community.dynatrace.com/user/11931) This is a test group, same policy as previous post, and if I remove everything except the monitoring viewer and keep/remove metrics permissions, the user loses or gains access.

 ![DanielS_0-1737516130854.png](https://global.discourse-cdn.com/dynatrace/original/3X/8/b/8b5aaa3a2cce89eab216ab8f47314e254e2f42be.png)

---

<div class="post-metadata">

**Author:** ![avdveen](https://avatars.discourse-cdn.com/v4/letter/a/ed8c4c/32.png) [@avdveen](https://community.dynatrace.com/u/avdveen)\
**Post date:** [January 22, 2025, 7:52am UTC](https://community.dynatrace.com/t/restrict-metric-access-via-iam-policy/49751/9 "2025-01-22T07:52:20Z")

</div>

Thanks&nbsp;[@DanielS](https://community.dynatrace.com/user/35788), does that work in the Data Explorer too though? I think that’s where the difference comes in, I was looking there 😉

I’ve tested it again via Notebooks and it works as you’ve explained…yet in Data Explorer, the user can still see and access the metric. That’s a bit of a problem, since some users who’re not yet comfortable with Notebooks, will revert to using Data Explorer and still have access to the metrics they’re not supposed to.

---

<div class="post-metadata">

**Author:** ![DanielS](https://avatars.discourse-cdn.com/v4/letter/d/3ab097/32.png) [@DanielS](https://community.dynatrace.com/u/DanielS)\
**Post date:** [January 22, 2025, 1:11pm UTC](https://community.dynatrace.com/t/restrict-metric-access-via-iam-policy/49751/10 "2025-01-22T13:11:30Z")

</div>

That’s right [@andre\_vdveen](https://community.dynatrace.com/user/11931) for everything under the scope of the Classic Dynatrace I’ve managed everything with Management Zones and I allow or disallow metrics with the following rules:

 ![DanielS_0-1737551091647.png](https://global.discourse-cdn.com/dynatrace/original/2X/9/92678583ea2746d8cac5261a2b0c0e793e11ffea.png)

Grail data access policies do not work with the classic schema, so during the transition it is necessary to manage both schemas. It may be a bit cumbersome but today we must coexist with both worlds.

---

<div class="post-metadata">

**Author:** ![Maheedhar\_T](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/maheedhar_t/32/155_2.png) [@Maheedhar\_T](https://community.dynatrace.com/u/Maheedhar_T)\
**Post date:** [January 27, 2025, 5:19am UTC](https://community.dynatrace.com/t/restrict-metric-access-via-iam-policy/49751/11 "2025-01-27T05:19:49Z")

</div>

Hey [@andre\_vdveen](https://community.dynatrace.com/user/11931)&nbsp;, [@DanielS](https://community.dynatrace.com/user/35788)&nbsp;Kind of interesting discussion here.. Never noticed that because I often use DQL even for metrics but have you tried adding that metric to a MZ and then try restricting the user access based on MZs ?  
Kind of always works&nbsp;:slightly\_smiling\_face: or even exploring segments might be a better option as this might replace MZs in far future&nbsp;:winking\_face\_with\_tongue:

---

<div class="post-metadata">

**Author:** ![DanielS](https://avatars.discourse-cdn.com/v4/letter/d/3ab097/32.png) [@DanielS](https://community.dynatrace.com/u/DanielS)\
**Post date:** [January 27, 2025, 6:29pm UTC](https://community.dynatrace.com/t/restrict-metric-access-via-iam-policy/49751/12 "2025-01-27T18:29:09Z")

</div>

Hi [@Maheedhar\_T](https://community.dynatrace.com/user/76275)&nbsp; that’s right, for all Dynatrace Classic, working with MZ is the way to restrict access. But under the scope of the Latest Dynatrace, the approach is different.&nbsp; Thanks for joining the discussion.

---

<div class="post-metadata">

**Author:** ![Maheedhar\_T](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/maheedhar_t/32/155_2.png) [@Maheedhar\_T](https://community.dynatrace.com/u/Maheedhar_T)\
**Post date:** [January 28, 2025, 6:26am UTC](https://community.dynatrace.com/t/restrict-metric-access-via-iam-policy/49751/13 "2025-01-28T06:26:06Z")

</div>

Yeah&nbsp;[@DanielS](https://community.dynatrace.com/user/35788)&nbsp;,  
Agreed. That’s where using segments would be an alternative approach but again, we have to come back to using IAM to control the access of segments too.
