title: What permission do I need to assign managed identities to app roles?
body: <p>I want to authorize several Logic Apps to access operations on an API secured by an app registration, which has several app roles describing different operations. Currently a directory administrator is doing this manually using <code>New-AzureADServiceAppRoleAssignment</code> once the Logic Apps are created, because the associated service principal doesn't exist until then.</p>
  
  <p>I'd rather this were automated, because especially in development, the manual work of asking a directory administrator to re-run this script is very tedious. However I don't know how to grant the scripting account - a service principal linked to a DevOps service connection - only the permissions to do this, and not make it a directory administrator able to do anything. If the service connection is a directory administrator, developers would be able to supply it scripts to tell it to create or delete any combination of role assignments, enabling them to let themselves into anything, and also shut out people who should be able to prevent this. This is an unacceptable security hole.</p>
  
  <p>What is the minimal permission needed to allow an automated process to script the creation of app role assignments but nothing else, and where is this documented?</p>