I'm trying to get to Azure user extension properties which are synced via AADC (Azure AD Connect) from on-prem to target tenant. As a pre-reading -> good article here : https://www.xtseminars.co.uk/post/azure-ad-schema-and-directory-extensions.
The issue is that those extensions might be or not populated on target user object. So let assume that with single REST API call (https://graph.microsoft.com/beta/users?$select=id,extension_c16821412f864d419a92205ad4820f0c_something&$top=5) I get following response:
$json = '{
"value": [
{
"id": "91c0b90e-4ed0-4c69-8b96-b67c07bbb061"
},
{
"id": "fdcd34dc-e7ab-4045-881d-0fee024c2b55",
"extension_c16821412f864d419a92205ad4820f0c_something": "INXXXXXX213423"
},
{
"id": "90ebc867-6a67-4cf0-a5d9-e4c07c9d3905"
},
{
"id": "80134f5f-892f-4800-9087-924a0c69b7f1"
},
{
"id": "36fae4de-c685-4da5-9458-e165d99fe670"
}
]
}'
Question is - how to nicely get to note properties which are defined 'optionally' ? As below gives just id:
PS> ($json | ConvertFrom-Json).value
id
--
91c0b90e-4ed0-4c69-8b96-b67c07bbb061
fdcd34dc-e7ab-4045-881d-0fee024c2b55
90ebc867-6a67-4cf0-a5d9-e4c07c9d3905
80134f5f-892f-4800-9087-924a0c69b7f1
36fae4de-c685-4da5-9458-e165d99fe670
Or in general - is it even doable with ConvertFrom-JSON() ?