Cannot Create App Registrations

Hasan Özgür Güçlü 0 Reputation points
2023-03-28T09:51:38.6866667+00:00

Hi,
I want to add an app registrations with a service principal auth on command line. But it gives me error below.

Insufficient privileges to complete the operation.

I login on powershell like below

az login --service-principal -u $env:AZUREPORTAL_SERVICEPRINCIPALFORAPP_APPID -p $env:AZUREPORTAL_SERVICEPRINCIPALFORAPP_SECRETVALUE --tenant $env:AZUREPORTAL_TENANTID

my service principal user: apps-ozgur-service-principal

it is Contributor.

User's image

it has these api permissions:

User's image

it has Cloud Application Administrator role

User's image

and users are allowed to register apps

User's image

But still it gives the error.

User's image

Azure Role-based access control
Azure Role-based access control
An Azure service that provides fine-grained access management for Azure resources, enabling you to grant users only the rights they need to perform their jobs.
{count} votes

2 answers

Sort by: Most helpful
  1. Anonymous
    2023-03-29T21:21:54.2233333+00:00

    Hi Hasan Özgür Güçlü ,The error message "Insufficient privileges to complete the operation" indicates that the service principal does not have the necessary permissions to complete the operation. You can try to grant the service principal the required permissions by assigning the "Owner" role to it.

    To assign the "Owner" role to the service principal, you can use the following command:

    az role assignment create --assignee <service-principal-object-id> --role Owner
    

    Replace <service-principal-object-id> with the object ID of the service principal. You can find the object ID of the service principal using the following command:

    az ad sp show --id <service-principal-app-id> --query objectId

    Replace <service-principal-app-id> with the application ID of the service principal.

    Please let me know if this works or if you have any questions.

    If this answer helped you please mark it as "Verified" so other users can reference it.

    Thank you,

    James


  2. Alexandru Silivestru 0 Reputation points
    2023-09-12T07:17:18.8066667+00:00

    Hi @James Hamil , Hasan Özgür Güçlü What was the fix for that issue? I encounter the same problem.

    Thank you!


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.