# Sentinel policy to check VM agents getting deployed using custom-data/user-data

**URL:** <https://discuss.hashicorp.com/t/sentinel-policy-to-check-vm-agents-getting-deployed-using-custom-data-user-data/23431>\
**Category:** Sentinel\
**Tags:** azure\
**Created:** [April 21, 2021, 12:21pm UTC](https://discuss.hashicorp.com/t/sentinel-policy-to-check-vm-agents-getting-deployed-using-custom-data-user-data/23431 "2021-04-21T12:21:37Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jhabikal21](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/jhabikal21/32/18788_2.png) [@jhabikal21](https://discuss.hashicorp.com/u/jhabikal21)\
**Post date:** [April 21, 2021, 12:21pm UTC](https://discuss.hashicorp.com/t/sentinel-policy-to-check-vm-agents-getting-deployed-using-custom-data-user-data/23431/1 "2021-04-21T12:21:37Z")

</div>

Hi Team,

Can we write sentinel Policies to check specific VM agents are getting installed or not using user-data on AWS, custom data on VMs? I can still check if an extension I want is added to VM using azurerm\_virtual\_machine\_extension but this still doesn’t help me to parse the init file for a specific agent lookup.

Based on security compliance, want to create a policy to evaluate all VMs before provisioning must have the required set of agents to be installed. And they can only do it either with custom data or with azurerm\_virtual\_machine\_extension.

Can you help on this?

---

<div class="post-metadata">

**Author:** ![hcrhall](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/hcrhall/32/968_2.png) [@hcrhall](https://discuss.hashicorp.com/u/hcrhall)\
**Post date:** [April 22, 2021, 1:59am UTC](https://discuss.hashicorp.com/t/sentinel-policy-to-check-vm-agents-getting-deployed-using-custom-data-user-data/23431/2 "2021-04-22T01:59:00Z")

</div>

Hi @jhabikal21,

I’m sure the implementation between the two cloud providers vary but here is an [example](https://play.sentinelproject.io/p/hjwRgUQIvxX) of how you could use the base64 import to decode the value of the custom\_data that has been supplied in the terraform configuration. Then it’s a case of performing some regex magic to look for unsupported configuration.

I’m not sure if this is the best way of doing it, but it may give you some ideas.

---

<div class="post-metadata">

**Author:** ![lizaclarraa](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/lizaclarraa/32/41556_2.png) [@lizaclarraa](https://discuss.hashicorp.com/u/lizaclarraa)\
**Post date:** [May 15, 2024, 4:53am UTC](https://discuss.hashicorp.com/t/sentinel-policy-to-check-vm-agents-getting-deployed-using-custom-data-user-data/23431/18 "2024-05-15T04:53:56Z")

</div>

Thanks for sharing these insights mate as I found it very much useful and informative.

---

<div class="post-metadata">

**Author:** ![CraigW](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/craigw/32/23448_2.png) [@CraigW](https://discuss.hashicorp.com/u/CraigW)\
**Post date:** [September 9, 2024, 6:28pm UTC](https://discuss.hashicorp.com/t/sentinel-policy-to-check-vm-agents-getting-deployed-using-custom-data-user-data/23431/22 "2024-09-09T18:28:07Z")

</div>

Closed on September 9, 2024, 6:28pm UTC


