Azure / Azure/azure-cli

`az ad app permission admin-consent` broken

Open
#25,257 4 comments 4 reactions 1 assignee Claimed by @jiasli View on GitHub
act-identity-squad Auto-Assign Azure CLI Team customer-reported feature-request Graph
Dominant language
Python
Stars
4.6k
Forks
3.5k
Avg merge
3d 2h
Merged PRs (30d)
60

Description

**Related command**
`az ad app permission admin-consent --id `

**Describe the bug**
Error:
```
Failed to connect to MSI. Please make sure MSI is configured correctly.
Get Token request returned:
```

**To Reproduce**
Create a service principal and assign tenant roles:
```bash
az ad sp create-for-rbac --name test-name \
--role owner \
--scopes /subscriptions/
```
```bash
az ad app permission add --id \
--api 00000003-0000-0000-c000-000000000000 \
--api-permissions e1fe6dd8-ba31-4d61-89e7-88639da4683d=Scope \
1bfefb4e-e0b5-418b-a88f-73c46d2cc8e9=Role \
62a82d76-70ea-41e2-9197-370581804d09=Role \
19dbc75e-c2e2-444c-a770-ec69d8559fc7=Role
```
```bash
az ad app permission admin-consent --id
```

**Expected behavior**
Creates the service principal, assigns API permissions, and then grants consent to those permissions.

## Environment Summary
```
Linux-5.4.0-1100-azure-x86_64-with-glibc2.35 (Cloud Shell), CBL-Mariner/Linux
Python 3.9.14
Installer: RPM

azure-cli 2.44.1

Extensions:
aks-preview 0.5.64
ai-examples 0.2.5
ml 2.12.1
ssh 1.1.3

Dependencies:
msal 1.20.0
azure-mgmt-resource 21.1.0b1
```

**Additional context**
I've read from other GitHub issues elsewhere that this command is being deprecated. But, I need a viable workaround ASAP because our entire company's onboarding system for Azure customers is dependent on being able to grant admin consent.

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.