My PowerShell(version 5.1.19041.906) command azsphere device-group list --tenant <GUID> give data as below
Result:
-------- -------- -------- -------- -------- -------- -------- --------
Id Name Descript ProductI OsFeedTy UpdatePo AllowCra CurrentD
ion d pe licy shDumpsC eploymen
ollectio t
n
=======================================================================
ba7fab67 Developm Default 556957b4 Retail Accept o False None
-5cd7-40 ent developm -aa39-4e nly syst
1a-9c88- ent devi 5a-aa4c- em softw
c4a2e88f ce group d3208c27 are upda
6932 7f3c tes. Don
't accep
-------- -------- -------- -------- -------- -------- -------- --------
45acb705 Field Te FieldTes 556957b4 Retail Accept a False d684d491
-a591-4e st t -aa39-4e ll updat -9229-48
41-ba1e- 5a-aa4c- es from 4f-a2eb-
4b3dd062 d3208c27 the Azur fda0168f
e1ec 7f3c e Sphere 7e27
Securit
-------- -------- -------- -------- -------- -------- -------- --------
07c76f21 Producti Default 556957b4 Retail Accept a False None
-773e-4e on producti -aa39-4e ll updat
0a-ad29- on devic 5a-aa4c- es from
569af4eb e group d3208c27 the Azur
24a8 7f3c e Sphere
Securit
-------- -------- -------- -------- -------- -------- -------- --------
0e2aed60 Producti Default 556957b4 RetailEv Accept a False None
-41ba-49 on OS Ev Producti -aa39-4e al ll updat
74-9bfb- aluation on OS Ev 5a-aa4c- es from
cdee6e1c aluation d3208c27 the Azur
0fc5 device 7f3c e Sphere
group Securit
-------- -------- -------- -------- -------- -------- -------- --------
8bb2b77c Field Te Default 556957b4 RetailEv Accept a False None
-3839-4b st OS Ev Field Te -aa39-4e al ll updat
09-b57d- aluation st OS Ev 5a-aa4c- es from
3f20081c aluation d3208c27 the Azur
d161 device 7f3c e Sphere
group Securit
-------- -------- -------- -------- -------- -------- -------- --------
From the above result, I want to get ID where Description is equal to FieldTest
I tried this command, it wont work, because, result is not in proper list format.
((azsphere device-group list --tenant $myTenantId) -split '\n') | Select-String -Pattern 'FieldTest'
Also tried doing something like this but no difference
((azsphere device-group list --tenant $myTenantId) -split '\n') | select -Skip 1 | Select-Object Id, Name | Format-Table -AutoSize -Wrap
When I use this command, nothing returns. Not sure what is the object returned by the azsphere exe
azsphere dev....... | Where-Object {$_.Description -eq 'FieldTest'}


azspherereturns? I mean prior to splitting on\n.azspherewas returning PSObjects you could do(azsphere dev....... | Where-Object {$_.Description -eq 'FieldTest'}).ID... Do you see an option to have it return a Csv?