azure-cli icon indicating copy to clipboard operation
azure-cli copied to clipboard

Invalid operation when adding service principal to AD group

Open isobit opened this issue 8 years ago • 3 comments

Describe the bug Attempting to add a service principal to an active directory group results in the following error:

An invalid operation was included in the following modified references: 'members'.

To Reproduce

  1. Create an AD security group, get the object ID as GROUP_ID
  2. Create a service principal, get the object ID as SP_ID
  3. az ad group add member --group $GROUP_ID --member-id $SP_ID

Expected behavior Service principal should be added to AD group.

Environment summary

  • Install method: pip
  • CLI version: 2.0.47
  • OS: CentOS 7
  • Shell: zsh
  • Python version: 3.6

isobit avatar Oct 19 '18 19:10 isobit

Are you sure you used the correct SP_ID?

Should be the objectId that is returned by az ad sp list - note this is different to the object ID that you see in the portal!

mattops avatar Oct 26 '18 15:10 mattops

Oh, I did not realize those were different things. I used the object ID from az ad sp list and that worked just fine. Thanks!

Although it is fairly confusing that both the CLI and the portal have something called an Object ID even though they're different. It would be helpful to include a note in the docs to clarify that... would it make sense to open an issue on this page?

isobit avatar Oct 29 '18 15:10 isobit

i too experienced this issue where SP object id showed in the console is not adding into group. i got object id using az ad sp show --id <application_id> and then added in group .

kgopi05 avatar Oct 30 '19 12:10 kgopi05