Skip to content

Commit 35a9996

Browse files
authored
{Core} Add deviceId in CLI telemetry to share with VS code (#30803)
* Add deviceId to share with VS code telemetry * align property name with vscode
1 parent d761767 commit 35a9996

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

src/azure-cli-core/azure/cli/core/telemetry.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ def _get_base_properties(self):
158158
'Context.Default.VS.Core.Distro.Id': _get_distro_id(), # eg. 'centos'
159159
'Context.Default.VS.Core.Distro.Version': _get_distro_version(), # eg. '8.4.2105'
160160
'Context.Dafault.VS.Core.Istty': str(sys.stdin.isatty()),
161+
'Context.Default.VS.Core.DevDeviceId': _get_device_id(),
161162
'Context.Default.VS.Core.User.Id': _get_installation_id(),
162163
'Context.Default.VS.Core.User.IsMicrosoftInternal': 'False',
163164
'Context.Default.VS.Core.User.IsOptedIn': 'True',
@@ -571,6 +572,13 @@ def _get_core_version():
571572
return core_version
572573

573574

575+
@decorators.suppress_all_exceptions(fallback_return=None)
576+
def _get_device_id():
577+
# This is a shared id with VS code telemetry
578+
from deviceid import get_device_id
579+
return get_device_id()
580+
581+
574582
@decorators.suppress_all_exceptions(fallback_return=None)
575583
def _get_installation_id():
576584
return _get_profile().get_installation_id()

src/azure-cli-core/setup.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
'humanfriendly~=10.0',
5353
'jmespath',
5454
'knack~=0.11.0',
55+
'microsoft-security-utilities-secret-masker~=1.0.0b2',
5556
'msal-extensions==1.2.0',
5657
'msal[broker]==1.31.2b1',
5758
'msrestazure~=0.6.4',
@@ -61,8 +62,8 @@
6162
'psutil>=5.9; sys_platform != "cygwin"',
6263
'PyJWT>=2.1.0',
6364
'pyopenssl>=17.1.0', # https://github.com/pyca/pyopenssl/pull/612
65+
'py-deviceid',
6466
'requests[socks]',
65-
'microsoft-security-utilities-secret-masker~=1.0.0b2',
6667
]
6768

6869
with open('README.rst', 'r', encoding='utf-8') as f:

0 commit comments

Comments
 (0)