question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

App Registration - App-Roles not updated when array with single app role is provided.

See original GitHub issue

Describe the bug

When updating an app registration trying to add an App Role providing a single app role in a json array file the command succeeds. but no app role is created in the App Reg Manifest. Providing two app roles in the array updates successfully.

Command Name az ad app update

Errors:

No Errors are produced but passing a single app-role in an array is not created

To Reproduce:

Steps to reproduce the behavior. Note that argument values have been redacted, as they may contain sensitive information.

  • Put any pre-requisite steps here… When running az ad app update --id <name> --app-roles <json array> with the below as the json content
    [
        {
            "allowedMemberTypes": [
                "Application"
            ],
            "description": "TestRol",
            "displayName": "TestRole",
            "id": "c94e8335-ab55-4589-ba7d-075b035605c5",
            "isEnabled": true,
            "origin": "Application",
            "value": "TestRole"
        }      
    ]

the command executes successfully but the App Role is NOT created\viewable in either the portal or via CLI.

If I add a second app role to the Json file


    [
        {
            "allowedMemberTypes": [
                "Application"
            ],
            "description": "TestRol",
            "displayName": "TestRole",
            "id": "c94e8335-ab55-4589-ba7d-075b035605c5",
            "isEnabled": true,
            "origin": "Application",
            "value": "TestRole"
        },
        {
            "allowedMemberTypes": [
                "Application"
            ],
            "description": "TestRol2",
            "displayName": "TestRole2",
            "id": "c94e8335-ab55-4581-ba7d-075b035605c5",
            "isEnabled": true,
            "origin": "Application",
            "value": "TestRole2"
        }         
    ]

The command executes successfully and both app roles are created

Expected Behavior

App Roles in App Registration should be created regardless of Array size (in this case 1 entry in the array)

Environment Summary

macOS-12.5-arm64-arm-64bit, Darwin 21.6.0
Python 3.10.6
Installer: HOMEBREW

azure-cli 2.39.0

Extensions:
account 0.2.3

Dependencies:
msal 1.18.0b1
azure-mgmt-resource 21.1.0b1

Additional Context

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
cbradshaw-nzcommented, Aug 22, 2022

wants to crawl into a hole and die

Yeah dynamic typing in Powershell got me - two entries makes it an array…

0reactions
jiaslicommented, Aug 22, 2022

Looks like you didn’t surround the app role with square brackets:

'--app-roles', '{\n  "allowedMemberTypes": [\n    "Application"\n  ],\n  "description": "TestRol",\n  "displayName": "TestRole",\n  "id": "c94e8335-ab55-4589-ba7d-075b035605c5",\n  "isEnabled": true,\n  "origin": "Application",\n  "value": "TestRole"\n}',

Could your surround it with [] and try again?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Add app roles and get them from a token - Microsoft Entra
Learn how to add app roles to an application registered in Azure Active Directory. Assign users and groups to these roles, and receive...
Read more >
appRole defined in AzureAD application not being included ...
This is the case with members of the current tenant as well as newly added guest users of type "Microsoft Account" for the...
Read more >
Using App Roles With Azure Active Directory and Blazor ...
Let's explore how we can use App Roles with Azure Active Directory and Blazor WASM Hosted apps to increase application security.
Read more >
App Roles to manage authorization in your application ...
This month's community call covered App Roles to manage authorization in your application including what is Authentication and Authorization ...
Read more >
AppRole Auth Method (API) - Vault - HashiCorp Developer
Since it is possible to enable auth methods at any location, please update your API calls accordingly. List Roles. This endpoint returns a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found