We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Azure VM - We are not getting power state
The VM data we are getting back does not tell you if the VM is running or not.

I think perhaps you have to tell the `list_all` api what you want - we want `instanceview`

https://docs.microsoft.com/en-us/rest/api/compute/virtualmachines/instanceview

Not sure how this happens via SDK.

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `tools/c7n_azure/c7n_azure/resources/vm.py`
Content:
```
1 # Copyright 2018 Capital One Services, LLC
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 # http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14 
15 from c7n_azure.query import QueryResourceManager
16 from c7n_azure.provider import resources
17 from c7n.filters.core import ValueFilter, type_schema
18 
19 @resources.register('vm')
20 class VirtualMachine(QueryResourceManager):
21 
22     class resource_type(object):
23         service = 'azure.mgmt.compute'
24         client = 'ComputeManagementClient'
25         enum_spec = ('virtual_machines', 'list_all')
26         id = 'id'
27         name = 'name'
28         default_report_fields = (
29             'name',
30             'location',
31             'resourceGroup',
32             'properties.hardwareProfile.vmSize',
33         )
34
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/tools/c7n_azure/c7n_azure/resources/vm.py b/tools/c7n_azure/c7n_azure/resources/vm.py
--- a/tools/c7n_azure/c7n_azure/resources/vm.py
+++ b/tools/c7n_azure/c7n_azure/resources/vm.py
@@ -31,3 +31,15 @@
             'resourceGroup',
             'properties.hardwareProfile.vmSize',
         )
+
+@VirtualMachine.filter_registry.register('instance-view')
+class InstanceViewFilter(ValueFilter):
+    schema = type_schema('instance-view', rinherit=ValueFilter.schema)
+
+    def __call__(self, i):
+        if 'instanceView' not in i:
+            client = self.manager.get_client()
+            instance = client.virtual_machines.get(i['resourceGroup'], i['name'], expand='instanceview').instance_view
+            i['instanceView'] = instance.serialize()
+
+        return super(InstanceViewFilter, self).__call__(i['instanceView'])

{"golden_diff": "diff --git a/tools/c7n_azure/c7n_azure/resources/vm.py b/tools/c7n_azure/c7n_azure/resources/vm.py\n--- a/tools/c7n_azure/c7n_azure/resources/vm.py\n+++ b/tools/c7n_azure/c7n_azure/resources/vm.py\n@@ -31,3 +31,15 @@\n             'resourceGroup',\n             'properties.hardwareProfile.vmSize',\n         )\n+\n+@VirtualMachine.filter_registry.register('instance-view')\n+class InstanceViewFilter(ValueFilter):\n+    schema = type_schema('instance-view', rinherit=ValueFilter.schema)\n+\n+    def __call__(self, i):\n+        if 'instanceView' not in i:\n+            client = self.manager.get_client()\n+            instance = client.virtual_machines.get(i['resourceGroup'], i['name'], expand='instanceview').instance_view\n+            i['instanceView'] = instance.serialize()\n+\n+        return super(InstanceViewFilter, self).__call__(i['instanceView'])\n", "issue": "Azure VM - We are not getting power state\nThe VM data we are getting back does not tell you if the VM is running or not.\r\n\r\nI think perhaps you have to tell the `list_all` api what you want - we want `instanceview`\r\n\r\nhttps://docs.microsoft.com/en-us/rest/api/compute/virtualmachines/instanceview\r\n\r\nNot sure how this happens via SDK.\n", "before_files": [{"content": "# Copyright 2018 Capital One Services, LLC\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nfrom c7n_azure.query import QueryResourceManager\nfrom c7n_azure.provider import resources\nfrom c7n.filters.core import ValueFilter, type_schema\n\n@resources.register('vm')\nclass VirtualMachine(QueryResourceManager):\n\n    class resource_type(object):\n        service = 'azure.mgmt.compute'\n        client = 'ComputeManagementClient'\n        enum_spec = ('virtual_machines', 'list_all')\n        id = 'id'\n        name = 'name'\n        default_report_fields = (\n            'name',\n            'location',\n            'resourceGroup',\n            'properties.hardwareProfile.vmSize',\n        )\n", "path": "tools/c7n_azure/c7n_azure/resources/vm.py"}], "after_files": [{"content": "# Copyright 2018 Capital One Services, LLC\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nfrom c7n_azure.query import QueryResourceManager\nfrom c7n_azure.provider import resources\nfrom c7n.filters.core import ValueFilter, type_schema\n\n@resources.register('vm')\nclass VirtualMachine(QueryResourceManager):\n\n    class resource_type(object):\n        service = 'azure.mgmt.compute'\n        client = 'ComputeManagementClient'\n        enum_spec = ('virtual_machines', 'list_all')\n        id = 'id'\n        name = 'name'\n        default_report_fields = (\n            'name',\n            'location',\n            'resourceGroup',\n            'properties.hardwareProfile.vmSize',\n        )\n\n@VirtualMachine.filter_registry.register('instance-view')\nclass InstanceViewFilter(ValueFilter):\n    schema = type_schema('instance-view', rinherit=ValueFilter.schema)\n\n    def __call__(self, i):\n        if 'instanceView' not in i:\n            client = self.manager.get_client()\n            instance = client.virtual_machines.get(i['resourceGroup'], i['name'], expand='instanceview').instance_view\n            i['instanceView'] = instance.serialize()\n\n        return super(InstanceViewFilter, self).__call__(i['instanceView'])\n", "path": "tools/c7n_azure/c7n_azure/resources/vm.py"}]}