Skip to content

az ad returns a Graph object without objectId property #22328

@ausfestivus

Description

@ausfestivus

Related command

az ad user list --filter "startswith(userPrincipalName, '[email protected]') or startswith(userPrincipalName, '[email protected]') or startswith(userPrincipalName, '[email protected]')" --query '[].objectId' -o tsv

Describe the bug
The output of the command changes depending on whether the GA CLI or Beta CLI is used.

To Reproduce

  1. Run the above command with the GA CLI and see results:
az version
{
  "azure-cli": "2.36.0",
  "azure-cli-core": "2.36.0",
  "azure-cli-telemetry": "1.0.6",
  "extensions": {}
}

az ad user list --filter "startswith(userPrincipalName, '[email protected]') or startswith(userPrincipalName, '[email protected]') or startswith(userPrincipalName, '[email protected]')" --query '[].objectId' -o tsv
The underlying Active Directory Graph API will be replaced by Microsoft Graph API in Azure CLI 2.37.0. Please carefully review all breaking changes introduced during this migration: https://docs.microsoft.com/cli/azure/microsoft-graph-migration
55f14c0d-7328-4495-aafa-608529099711
3ba298b6-3bc4-4ecb-ba91-5d937b27f1b5
0023964f-42ce-4b3e-b51f-0d583e99512a
  1. Run the above command with the Beta CLI and see results:
az version
{
  "azure-cli": "2.36.0.post20220505034434",
  "azure-cli-core": "2.36.0.post20220505034434",
  "azure-cli-telemetry": "1.0.6.post20220402024323",
  "extensions": {}
}

az ad user list --filter "startswith(userPrincipalName, '[email protected]') or startswith(userPrincipalName, '[email protected]') or startswith(userPrincipalName, '[email protected]')" --query '[].objectId' -o tsv
The underlying Active Directory Graph API will be replaced by Microsoft Graph API in Azure CLI 2.37.0. Please carefully review all breaking changes introduced during this migration: https://docs.microsoft.com/cli/azure/microsoft-graph-migration

Note that with the Beta CLI the command returns no results.

Expected behavior

The results returned should not change depending on which version of the CLI is used.

Environment summary

Additional context

If I remove the --query parameter from the beta cli I get:

az ad user list --filter "startswith(userPrincipalName, '[email protected]') or startswith(userPrincipalName, '[email protected]') or startswith(userPrincipalName, '[email protected]')" -o tsv

The underlying Active Directory Graph API will be replaced by Microsoft Graph API in Azure CLI 2.37.0. Please carefully review all breaking changes introduced during this migration: https://docs.microsoft.com/cli/azure/microsoft-graph-migration
1       Flintstone, Fred    Fred  55f14c0d-7328-4495-aafa-608529099711    Company Contractor      [email protected]        +61 000 000 000 None    None    Flintstone    [email protected]
1       Flintstone, Dino    Dino    3ba298b6-3bc4-4ecb-ba91-5d937b27f1b5    IT Advisor      [email protected]        +61 000 000 000 None    None    Flintstone  [email protected]
1       Flintstone, Pebbles     Pebbles 0023964f-42ce-4b3e-b51f-0d583e99512a    IT Manager      [email protected]      +61 000 000 000 None    None    Flintstone   [email protected]

Metadata

Metadata

Assignees

Labels

Auto-AssignAuto assign by botGraphaz adcommon issuecustomer-reportedIssues that are reported by GitHub users external to the Azure organization.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions