Invalid operation when adding service principal to AD group
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
- Create an AD security group, get the object ID as
GROUP_ID - Create a service principal, get the object ID as
SP_ID 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
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!
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?
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 .