Azure / Azure/azure-cli

Throws error when there is both an enterprise application and a managed identity present

Open
#17,951 6 comments 0 reactions 1 assignee Claimed by @jiasli View on GitHub
act-identity-squad feature-request Graph
Dominant language
Python
Stars
4.6k
Forks
3.5k
Avg merge
3d 2h
Merged PRs (30d)
60

Description

## Describe the bug

**Command Name**
`az ad app credential reset`

**Errors:**
```
more than one entry matches the name, please provide unique names like app id guid, or app id uri
```

## To Reproduce:

1. Create an app registration
2. Create a secret for that app registration via the portal
3. Create a user assigned managed identity for that application
4. Try and modify the secret

The OData query executed under the hood is:

```
$filter=servicePrincipalNames/any(x:x eq '[APP_ID]') or displayName eq '[APP_ID]'
```

To ensure only service principals of type 'Application' are having their credentials targeted by this command the query should be modified to the following:

```
$filter=(servicePrincipalNames/any(x:x eq '[APP_ID]') or displayName eq '[APP_ID]') and servicePrincipalType eq 'Application'
```

## Expected Behavior

The credential of the application should be reset

## Environment Summary
```
Windows-10-10.0.19041-SP0
Python 3.6.8
Installer: MSI

azure-cli 2.20.0 *

Extensions:
azure-devops 0.18.0
interactive 0.4.4

```
## Additional Context

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.