Azure / Azure/azure-cli

Allow AD app/sp object ids to be provided as a parameter instead of performing a lookup by name

Open
#17,954 1 comment 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

**Is your feature request related to a problem? Please describe.**

The **az ad app credential reset** and **az ad spn credential reset** commands require extra permissions (the ability to read all applications) simply to find the object id of the app. The lookup is hard-coded into the module:

- [reset_service_principal_credential](https://github.com/Azure/azure-cli/blob/5baced969bb96d4138d8886661f302f142942255/src/azure-cli/azure/cli/command_modules/role/custom.py#L1591)
- [reset_application_credential](https://github.com/Azure/azure-cli/blob/5baced969bb96d4138d8886661f302f142942255/src/azure-cli/azure/cli/command_modules/role/custom.py#L1682)

**Describe the solution you'd like**
I would like a parameter set that allows the object id of to be directly provided rather than looked up by name so that the account performing the reset action does not need access to all applications. Example:

```
az ad app credential reset --object-id --end-date --create-cert --append
az ad sp credential reset --object-id --end-date --create-cert --append
```

**Describe alternatives you've considered**
There does not appear to be a feasible workaround within az cli, but this functionality exists within the Az PowerShell module. Unfortunately the Az module lacks the ability of generating a certificate, resulting in significantly more overhead.

[New-AzADAppCredential](https://docs.microsoft.com/en-us/powershell/module/az.resources/new-azadappcredential?view=azps-5.8.0)
[New-AzADSpCredential](https://docs.microsoft.com/en-us/powershell/module/az.resources/new-azadspcredential?view=azps-5.8.0)

**Additional context**
The end goal is to automate the rotation of app/sp credentials while applying the principle of least privilege. The account orchestrating the automation should only require access to the account that it is resetting, not all of them.

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.