Azure / Azure/azure-cli

Delete role assignment by ID does not use the correct URI and fails with MissingSubscription

Open
#31,109 2 comments 0 reactions 1 assignee Claimed by @jiasli View on GitHub
act-identity-squad ARM Auto-Assign Azure CLI Team question RBAC Similar-Issue
Dominant language
Python
Stars
4.6k
Forks
3.5k
Avg merge
3d 2h
Merged PRs (30d)
60

Description

### Describe the bug

az role assignment delete fails with "MissingSubscription" when --ids parameter is provided with GUIDs rather than fully-qualified resource ids.

### Related command

az role assignment delete

### Errors

MissingSubscription

### Issue script & Debug output

az role assignment delete --ids ae44cb62-f719-4c45-9bb4-878311fcf9e2 --verbose
[...]
msrestazure.azure_active_directory: MSI: Token retrieved
cli.azure.cli.command_modules.role.custom: option '--scope' will be ignored due to use of '--ids'.
cli.azure.cli.core.auth.adal_authentication: MSIAuthenticationWrapper.get_token: scopes=('[https://management.core.windows.net//.default',)](https://management.core.windows.net//.default%27,)), kwargs={}
msrestazure.azure_active_directory: MSI: token is found in cache.
cli.azure.cli.core.auth.adal_authentication: Normalize expires_on: '1742599775' -> 1742599775
cli.azure.cli.core.sdk.policies: Request URL: '[https://management.azure.com/ae44cb62-f719-4c45-9bb4-878311fcf9e2?api-version=2022-04-01'](https://management.azure.com/ae44cb62-f719-4c45-9bb4-878311fcf9e2?api-version=2022-04-01%27)
cli.azure.cli.core.sdk.policies: Request method: 'DELETE'
cli.azure.cli.core.sdk.policies: Request headers:
cli.azure.cli.core.sdk.policies: 'Accept': 'application/json'
cli.azure.cli.core.sdk.policies: 'x-ms-client-request-id': 'cc5e6ed8-068b-11f0-905b-00155dffb2e6'
...

### Expected behavior

I would expect it to fill in the subscription from my `az account` if not provided.

If I run `az role assignment delete --ids /subscription/xxx/providers/Microsoft.Authorizaton/roleAssignments/ae44cb62-f719-4c45-9bb4-878311fcf9e2 it works.

### Environment Summary

root [ / ]# az --version
azure-cli 2.70.0

core 2.70.0
telemetry 1.1.0

Dependencies:
msal 1.31.2b1
azure-mgmt-resource 23.1.1

Python location '/usr/bin/python3.12'
Config directory '/root/.azure'
Extensions directory '/root/.azure/cliextensions'

Python (Linux) 3.12.9 (main, Mar 11 2025, 15:30:57) [GCC 13.2.0]

Legal docs and information: aka.ms/AzureCliLegal


Your CLI is up-to-date.

### Additional context

_No response_

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.