0

I am trying to follow a MSFT documentation tutorial

(https://learn.microsoft.com/en-us/training/modules/connect-iot-hololens-azure-digital-twins-unity/5-exercise-create-deploy-arm-template) .

But I am stuck on the below command where I am not able to get $object id.

$objectid=$(az ad sp list --display-name $appreg --query [0].objectId --output tsv)

**

Edit:

** if I query

az ad sp list --display-name ${appreg}

enter image description hereNot sure why its not displaying the object id.

  • can you query this `az ad sp list --display-name ${appreg}` ? and show what is returning? – Jayendran Oct 02 '22 at 08:13
  • @Jayendran yes I can query and getting a json response. However I cant see any element named objectId. not sure how this [0].objectId is working in the query.. – Aniruddhya Dutta Oct 02 '22 at 08:22

1 Answers1

1

The property name has changed, it's no longer objectId. Instead, it was renamed to id. I confirmed it was still objectId in az CLI version 2.28.0, but after upgrading to 2.40, the property was different.

So instead of:

$objectid=$(az ad sp list --display-name ${appreg} --query [0].objectId --output tsv)

Try:

$objectid=$(az ad sp list --display-name ${appreg} --query [0].id --output tsv)
Matthijs van der Veer
  • 3,865
  • 2
  • 12
  • 22