How to add App Role for API

Keith Viking 20 Reputation points
2023-05-06T08:47:56.3533333+00:00

I'm creating an API using .Net 6 (Core project). I need to setup our Azure account with a client credential. I followed the steps from a tutorial and can't find the option to create a role.

I found a possible solution which is to add the following into the Manifest file

"appRoles": [
  {
    "allowedMemberTypes": ["Member"],
    "displayName": "Access 1",
    "id": "1",
    "isEnabled": true,
    "description": "Description"
  },

This didn't allow me to save. I saved the details EXACTLY as I've posted above so I don't know if it was expecting actual value for it to save in which case I didn't know where to look for those values.

How do I add an app role for my WebApi Application in Azure?

Do I need to host my application within Azure or can I have the application on our server but use App Registration to hold the client credentials and other details but host the application on my server

Developer technologies ASP.NET ASP.NET Core
Microsoft Security Microsoft Entra Microsoft Entra ID
Developer technologies C#
{count} votes

Accepted answer
  1. Akshay-MSFT 17,951 Reputation points Microsoft Employee Moderator
    2023-05-09T10:48:29.89+00:00

    @Keith Viking

    Answer to the below query is :

    When i add

    { "allowedMemberTypes": [ "User" ], "description": "Can read data", "displayName": "Read", "id": "9e34523e-f6dd-4821-8788-39af5d6cf579", "isEnabled": true, "value": "Data.Read" },

    
    
    
    
    
    > This saves with any ID but then Application permission is not available see this thread for the issue im facing https://stackoverflow.com/questions/57379397/why-is-application-permissions-disabled-in-azure-ads-request-api-permissions
    
    > If i change
    > ```
    "allowedMemberTypes": [
    
    "User"
      ],
    
    

    To Application (from User to Application to grant the API access) then it wont save and i get the error "One or more properties contains invalid values."

    • Once added the roles in manifest could not be removed directly, kindly follow the given steps:
    1. Add a new role with "allowedMemberTypes" to "Application" and disable the existing role:
    2. User's image
    3. Now remove the disabled role and save the Manifest, this is because and existing role could not be removed without being disabled, this would let you save the updated role:

    User's image

    1. Application permission will then be available to assigned:

    User's image

    Please do let me know if you have any queries in the comments section, we could connect offline to get this fixed for you.

    Thanks,

    Akshay Kaushik

    Please "Accept the answer" (Yes), and share your feedback if the suggestion answers you’re your query. This will help us and others in the community as well.


0 additional answers

Sort by: Most helpful

Your answer

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