# Access Azure VM and AWS EC2 Power Status Using DQL

**URL:** <https://community.dynatrace.com/t/access-azure-vm-and-aws-ec2-power-status-using-dql/50418>\
**Category:** DQL\
**Tags:** dql, azure\
**Created:** [February 24, 2025, 3:04pm UTC](https://community.dynatrace.com/t/access-azure-vm-and-aws-ec2-power-status-using-dql/50418 "2025-02-24T15:04:01Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![2181](https://avatars.discourse-cdn.com/v4/letter/2/90ced4/32.png) [@2181](https://community.dynatrace.com/u/2181)\
**Post date:** [February 24, 2025, 3:04pm UTC](https://community.dynatrace.com/t/access-azure-vm-and-aws-ec2-power-status-using-dql/50418/1 "2025-02-24T15:04:01Z")

</div>

Hi Community,  
Is it possible to access the cloud VM running status from DQL?

In the integration there is a staus field. This seems to be correct even if for some reason the platform-level metrics are not showing correctly. I would like to access this status with DQL to use in a dashboard that I’m building.  
The dt.entity.azure\_vm does not have such dimension, it is also not a metric. What is it?

 ![Screenshot 2025-02-24 at 14.55.57.png](https://global.discourse-cdn.com/dynatrace/original/2X/1/1457c3f4557be329aebf68aaffc7bac0ecca2219.png)

I would appreciate any help.

---

<div class="post-metadata">

**Author:** ![marco\_irmer](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/marco_irmer/32/3038_2.png) [@marco\_irmer](https://community.dynatrace.com/u/marco_irmer)\
**Post date:** [February 24, 2025, 6:34pm UTC](https://community.dynatrace.com/t/access-azure-vm-and-aws-ec2-power-status-using-dql/50418/2 "2025-02-24T18:34:53Z")

</div>

Use the lifetime field to determine if the lifetime[end] value is some distance in the past.

Example DQL for Azure VMs whose lifetime[end] is more than one hour in the past

```cpp
fetch dt.entity.azure_vm
| fieldsAdd lifetime[end]
| filter lifetime[end] < now() - 1h

```

---

<div class="post-metadata">

**Author:** ![2181](https://avatars.discourse-cdn.com/v4/letter/2/90ced4/32.png) [@2181](https://community.dynatrace.com/u/2181)\
**Post date:** [February 25, 2025, 11:51am UTC](https://community.dynatrace.com/t/access-azure-vm-and-aws-ec2-power-status-using-dql/50418/3 "2025-02-25T11:51:35Z")

</div>

Hi Marco,

Thank you for the suggestion.

I tried this approach, but if applied with long enough time window it will mix stopped VMs with the ones that no longer exist. It seems that it’s based exclusively on the last metric datapoint available to dynatrace for the given entity.&nbsp; I mentioned in my question that I observed a correct status (running)&nbsp; in Dynatrace even if the VM metrics were not available.

At the same time I observed a message like this in the activeGate log

```markup
<vtopology.provider>, VirtualMachineEntity] Received null or empty PowerState for VirtualMachine: VirtualMachineEntity{type=AZURE_VM, entityId=-524919XXXXXX, name=XXXX-XX-XX-01, resourceId=....

```

It suggests that Dynatrace makes API calls to get power status of the VMs

What I’m interested in is the power status. So as long as the VM exists it should be either running or stopped.  
Then if a VM is deleted the value would be null

---

<div class="post-metadata">

**Author:** ![izabelarokita](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/izabelarokita/32/41812_2.png) [@izabelarokita](https://community.dynatrace.com/u/izabelarokita)\
**Post date:** [December 18, 2025, 12:27pm UTC](https://community.dynatrace.com/t/access-azure-vm-and-aws-ec2-power-status-using-dql/50418/4 "2025-12-18T12:27:00Z")

</div>

Hey&nbsp;[@2181](https://community.dynatrace.com/user/84297)&nbsp;,  
I just wanted to check in and see if you still need help with this. If so, I’d be happy to look into it for you!&nbsp;:blush:  
Please let me know what works best for you.
