-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
New-AzureRmADApplication - Creating new SPNs from existing SPN fails #3215
Comments
@shuagarw please take a look |
I am also trying to have a SPN create other SPN's. Is this scenario supported? I get the same error mentioned above: "Resource not found for the segment 'me'" |
Same error if i run it form Visual Studio Team Services build/release pipeline. Resource not found for the segment 'me'. basically, registered AD app (VSTS) tries to create AD app. |
+1. I am trying to automate the creation of a SP from another SP and hitting this issue during a VSTS RM. Any workarounds? Thanks! |
@forrestcoward , @Make-Make , @donlockhart , @Hoppy7
Based on that, you just need to grant Company Administrator role to it and voila it'll be able to create other SPN and corresponding Principal. You can use below code to do it using Powershell:
|
The environments and customers I work with do not have the same amount of trust as @sebbrochet. Did anyone manage to figure out the least privilege approach to creating App Reg and Svc Principal through a VSTS Pipeline? |
My environments do not have the same amount of trust as @sebbrochet. Did anyone manage to figure out the least privilege approach to creating App Reg and Svc Principal through a VSTS Pipeline? |
Hi all, The Service Principal requires Owner permission to the subscription and the following API access: |
I have given the app registration that VSTS uses all of the permission that you have mentioned @teejam2, but I am still facing the same error message:
Any ideas? |
@BurgerVanDan has an account administrator confirmed the permissions? Is the service principal an owner of the target subscription? |
@teejam2 I have just realised that I dont not have permissions to 'grant' the app service the relevant permission as it is a customer subscription/AAD. I will see if I can persuade on the global administrators to grant them for me. I will check back in when I have an update! |
@teejam2 Thanks you, it worked !! |
Just a note, you don't need Owner permissions, you need only User Access Administrator role over Azure if you want to use your SPN to assign permissions |
Thank you @teejam2 I did some additional testing and as far as I can tell, the While testing which permissions were required, I found it helpful to execute the following powershell command after adding/removing a permission and granting admin consent: |
I still have this issue even when I added all API permission mentioned by @teejam2. I also made the SP as the subscription owner, tried Clear-AzContext, but no difference. The cmdlet used to create new SP with existing SP is CommandType Name Version Source Cmdlet New-AzADServicePrincipal 1.6.1 Az.Resources What else I can do to debug or workaround this issue? |
I managed to create App Registration and Service Principal using the Azure Active Directory Graph (Legacy API) With Application.ReadWrite.OwnedBy.
I tested all other suggestions here, but where only able to create App Registration, but not Service Principal. |
I want to confirm that adding Application.ReadWrite.OwnedBy from the LEGACY Azure Active Directory Graph API does seem to be the one permission required that allows this to work. However, granting the same permission (Application.ReadWrite.OwnedBy) through the new Microsoft Graph API DOES NOT WORK. There is now a deprecation warning message: "This application is using Azure AD Graph API, which is on a deprecation path. Starting June 30th, 2020 we will no longer add any new features to Azure AD Graph API. We strongly recommend that you upgrade your application to use Microsoft Graph API instead of Azure AD Graph API to access Azure Active Directory resources." Can anyone explain what the difference is between the permissions for "Application.ReadWrite.OwnedBy" when using the Legacy API vs the new one? It would also be great to know what appropriate permissions that should be granted via the new API instead. |
Greetings, As rharris-hs says - I was also able to conform the difference as well. As for the current answer in this thread; "Access directory as the signed in user" would mean it can revert to the user identity used to call the AzDevOps pipeline (which in our case has no privileges but shouldn't be part of the solution). Secondly its one that is automatically flagged for us as undesired. with kind regards, |
Hi, I don't know what that status of this is but this is still an outstanding problem for our org currently that we can't create a SP in Azure with another SP unless we grant it the |
Any update on this issue? Now that the "Azure Active Directory Graph" IS DEPRICATED, I cannot use it any more! Need to run Pipeline with Service Principle and create other SPs. |
@mail-lwang have you found the solution? Since Azure Active Directory Graph is deprecated my automation is also not working... Im receiving error Resource not found for the segment 'me' |
Cmdlet(s)
New-AzureRmADApplication
PowerShell Version
5.1.14393.206
Module Version
3.1.0
OS Version
10.0.14393.206
Description
I'd like to use one "master" SPN to be able to create new SPNs and rotate expiring SPN keys through automation. The master SPN is an owner of the subscription it's running from and has been granted all permissions to the AAD application. It is not able to create new SPNs or rotate expiring keys.
I've also tried authenticating as the SPN in which we would like to generate a new key for, and then attempt to generate a new key. This route also fails. I would think the SPN should be able to generate a new key for itself?
Is either of these scenarios possible running from a SPN? I can create new SPNs and generate new keys using my own credentials just fine.
Error:
New-AzureRmADApplication : Resource not found for the segment 'me'.
Debug Output
Script/Steps for Reproduction
The text was updated successfully, but these errors were encountered: