Repository: Azure/WALinuxAgent

Issue:
Telemetry Should Include Additional IMDS Metadata
The latest version of IMDS includes the following fields that should be considered for inclusion:

 1. zone
 1. vmScaleSetName

https://docs.microsoft.com/en-us/azure/virtual-machines/windows/instance-metadata-service#instance-metadata-data-categories


Discussion:

Patch:
diff --git a/azurelinuxagent/common/protocol/imds.py b/azurelinuxagent/common/protocol/imds.py
index 1748bd91..c0deb358 100644
--- a/azurelinuxagent/common/protocol/imds.py
+++ b/azurelinuxagent/common/protocol/imds.py
@@ -17,6 +17,10 @@ def get_imds_client():
 
 
 class ComputeInfo(DataContract):
+    @property
+    def image_info(self):
+        return "{0}:{1}:{2}:{3}".format(self.publisher, self.offer, self.sku, self.version)
+
     def __init__(self,
                  location=None,
                  name=None,
@@ -32,7 +36,9 @@ class ComputeInfo(DataContract):
                  tags=None,
                  version=None,
                  vmId=None,
-                 vmSize=None):
+                 vmSize=None,
+                 vmScaleSetName=None,
+                 zone=None):
         self.location = location
         self.name = name
         self.offer = offer
@@ -48,10 +54,8 @@ class ComputeInfo(DataContract):
         self.version = version
         self.vmId = vmId
         self.vmSize = vmSize
-
-    @property
-    def image_info(self):
-        return "{0}:{1}:{2}:{3}".format(self.publisher, self.offer, self.sku, self.version)
+        self.vmScaleSetName = vmScaleSetName
+        self.zone = zone
 
 
 class ImdsClient(object):


Test patch:
diff --git a/tests/protocol/test_imds.py b/tests/protocol/test_imds.py
index 3f8ac2ed..d0f65292 100644
--- a/tests/protocol/test_imds.py
+++ b/tests/protocol/test_imds.py
@@ -72,7 +72,9 @@ class TestImds(AgentTestCase):
         "tags": "Key1:Value1;Key2:Value2",
         "vmId": "f62f23fb-69e2-4df0-a20b-cb5c201a3e7a",
         "version": "UnitVersion",
-        "vmSize": "Standard_D1_v2"
+        "vmSize": "Standard_D1_v2",
+        "vmScaleSetName": "MyScaleSet",
+        "zone": "In"
         }'''
 
         data = json.loads(s, encoding='utf-8')
@@ -95,6 +97,8 @@ class TestImds(AgentTestCase):
         self.assertEqual('f62f23fb-69e2-4df0-a20b-cb5c201a3e7a', compute_info.vmId)
         self.assertEqual('UnitVersion', compute_info.version)
         self.assertEqual('Standard_D1_v2', compute_info.vmSize)
+        self.assertEqual('MyScaleSet', compute_info.vmScaleSetName)
+        self.assertEqual('In', compute_info.zone)
 
         self.assertEqual('UnitPublisher:UnitOffer:UnitSku:UnitVersion', compute_info.image_info)