-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
possibility of adding service principal owners with the cli #9250
Comments
It seems this should have been part of microsoftgraph/microsoft-graph-docs#7578, which says it "Graph: support add/remove/list owners on app, sp, and group". The PR did this for app and group, but appears to have forgotten to include code for sp. Looking at the commits in that PR it only removes a comment under "ad sp owner": "# TODO: Add support for 'add' and 'remove'", but doesn't add code to actually add and remove owners from service principals. |
Okay, i will follow up to onboard the support since we have the ask now. |
Any progress on this? |
The related API is missing in the spec. Before it gets fixed, you can use az rest --method post --uri https://graph.windows.net/<tenantId>/servicePrincipals/<object id of the service principal>/$links/owners?api-version=1.6 --body "{\"url\":\"https://graph.windows.net/<tenantId>/directoryObjects/<owner's object id>\"}" |
Yugangw-msft, I don't suppose you know the az rest command to remove a owner?? |
I ran into the same issue of having to add an additional owner to an existing SP. Unfortunately the API responds with "bad request": My first suspicion was a permission problem, but I would expect a proper response then. Any ideas? |
I tried this, but the owners are not added if the call succeeds. When is the release for the cli ad sp scheduled to be released? |
@miicahjardine, I've found the following works to delete owners:
|
Can we close this issue? |
Is this fixed I tried using "az rest ..." and also got the "Unsupported resource type 'DirectoryObject' for operation 'Create'." error. |
@23min i've always use User which inherits directoryObjects, agree docs are strange, fwiw u linked the beta docs...but even the 1.0 docs example shows using beta for the post target...so weird
|
Hi folks, as for the behavior of Microsoft Graph API, you may reach out to AAD support by creating a support ticket. A support engineer will gladly help you with it. |
I also would like for this to be implemented in az cli as well. Why is this issue closed? One should not have to use the rest API with az. Please reopen! Also, using MS Graph is not an option because would give permission to use it in our environment. |
I will reopen this issue and mark it as feature request.
As AD Graph has been deprecated, using Microsoft Graph is the only option.
Thanks for the feedback. Personally, I also like the idea to share login context between Azure tools (tracked by #16460). |
Is this in the works? It has been requested a long time ago. |
This is such a ... limitation, why SP cannot be owner of other application regardless of initial creator responding with bad request? |
I really wish this gets implemented soon. It has been so loooooooong. |
@yugangw-msft when shall we expect advancement in Ability to assign AD application as an owner to existing AD application, e.g. not necessarily actually created by that application? |
bump, wish i could do this |
@saldroubi @notaturkey It is possible to make application registration to be owner of other application registration. Requirements:
From the main page of application registration of the future owner navigate to the link under "Managed application in local directory" description - it will redirect you to enterprise application page, copy object ID Perform next cmdlet It should allow you to manage app under another app.
So we always interested to grant enterprise app (SPN) of future owner, |
Yes you certainly can use powershell to add sp’s as owners, but this ticket is about az cli not ps module |
What the heck, four years later and it's not in there yet? |
bumpy bump bump |
BUMPPPP |
Would be very nice to be able to manage owners of a service principle by the Azure CLI... |
Hi there, am currently trying to assign SPN owner to enterprise application using microsoft graph but not seems to working. From the portal is only allowing to add user only. Is there any solution to fix it? |
bump |
2 similar comments
bump |
bump |
While this is still missing from AZ CLI native as of today, wanted to drop in the command that currently works for me via AZ REST. Not sure if BETA endpoint is still required but its what I am currently using. Azure Service Principal to be owned by Azure Service Principal:
I was previously having trouble as I missed the escape of $ for $ref. |
Please implement this... pretty unbelievable that 4 years later this is not in place. |
+1 |
Thanks a lot for the command, that is working well.
Hope that helps.. |
Thanks for sharing! Unfortunately, I struggled getting this run in a foreach loop in a powershell script. I'm sharing that others may not be struggling with syntax issues for the body as I did (and, funnily, MS Copilot was of no use here!).
Btw. deleting an owner works similarly:
Hope that helps. |
running into this issue when using terraform if you import a existing app reg, you need this to be able to set the sp (terraform) owner. |
"az ad sp owner add" would be nice to have. we currently add owners as a manual step after the environment build completes. Is there something similar in the CLI package ?
Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
The text was updated successfully, but these errors were encountered: