Azure / Azure/azure-cli

az eventgrid system-topic update: Request body is empty when using --mi-user-assigned or --mi-system-assigned parameter

Open
#27,108 5 comments 2 reactions 1 assignee Claimed by @SaurabhSharma-MSFT View on GitHub
act-codegen-extensibility-squad Auto-Assign bug customer-reported Event Grid Service Attention
Dominant language
Python
Stars
4.6k
Forks
3.5k
Avg merge
3d 2h
Merged PRs (30d)
60

Description

### Describe the bug

The request body is empty to update EventGrid system topic with user assigned identity or system assigned identity. This issue is only reproducible in Azure CLI cmdlet. The REST API is working as expected.

The CLI command is - https://learn.microsoft.com/en-us/cli/azure/eventgrid/system-topic?view=azure-cli-latest#az-eventgrid-system-topic-update-examples.

az eventgrid system-topic update -g Storage --name **--mi-user-assigned** /subscriptions//resourcegroups/tmpresources/providers/Microsoft.ManagedIdentity/userAssignedIdentities/egst-identity

Both the parameter are in preview and not really sending any request body to update the system topic.
parameters:
--mi-user-assigned

--mi-system-assigned

Please help resolve this issue.

### Related command

az eventgrid system-topic update -g Storage --name adlsdemos-e83fb0a9-193a-4c4a-81e3-431a71327a5c **--mi-user-assigned** /subscriptions//resourcegroups/tmpresources/providers/Microsoft.ManagedIdentity/userAssignedIdentities/egst-identity --debug

### Errors

The request body is empty when you attempt to update the Event Grid system topic with user assigned identity. See Debug output in "Issue script & Debug output" section below.

### Issue script & Debug output

az eventgrid system-topic update -g Storage --name adlsdemos-e83fb0a9-193a-4c4a-81e3-431a71327a5c --mi-user-assigned /subscriptions//resourcegroups/tmpresources/providers/Microsoft.ManagedIdentity/userAssignedIdentities/egst-identity --debug
cli.knack.cli: Command arguments: ['eventgrid', 'system-topic', 'update', '-g', 'Storage', '--name', 'adlsdemos-e83fb0a9-193a-4c4a-81e3-431a71327a5c', '--mi-user-assigned', '/subscriptions//resourcegroups/tmpresources/providers/Microsoft.ManagedIdentity/userAssignedIdentities/egst-identity', '','', '--debug']
cli.knack.cli: __init__ debug log:
Enable color in terminal.
cli.knack.cli: Event: Cli.PreExecute []
cli.knack.cli: Event: CommandParser.OnGlobalArgumentsCreate [, , ]
cli.knack.cli: Event: CommandInvoker.OnPreCommandTableCreate []
cli.azure.cli.core: Modules found from index for 'eventgrid': ['azure.cli.command_modules.eventgrid']
cli.azure.cli.core: Loading command modules:
cli.azure.cli.core: Name Load Time Groups Commands
cli.azure.cli.core: eventgrid 0.019 25 96
cli.azure.cli.core: Total (1) 0.019 25 96
cli.azure.cli.core: These extensions are not installed and will be skipped: ['azext_next']
cli.azure.cli.core: Loading extensions:
cli.azure.cli.core: Name Load Time Groups Commands Directory
cli.azure.cli.core: ai-examples 0.125 1 1 /usr/lib/python3.9/site-packages/azure-cli-extensions/ai-examples
cli.azure.cli.core: Total (1) 0.125 1 1
cli.azure.cli.core: Loaded 26 groups, 97 commands.
cli.azure.cli.core: Found a match in the command table.
cli.azure.cli.core: Raw command : eventgrid system-topic update
cli.azure.cli.core: Command table: eventgrid system-topic update
cli.knack.cli: Event: CommandInvoker.OnPreCommandTableTruncate []
cli.azure.cli.core.azlogging: metadata file logging enabled - writing logs to '/home/ivan/.azure/commands/2023-08-07.16-26-12.eventgrid_system-topic_update.622.log'.
az_command_data_logger: command args: eventgrid system-topic update -g {} --name {} --mi-user-assigned {} {} {} --debug
cli.knack.cli: Event: CommandInvoker.OnPreArgumentLoad [.add_subscription_parameter at 0x7fd3ed7df040>]
cli.knack.cli: Event: CommandInvoker.OnPostArgumentLoad []
cli.knack.cli: Event: CommandInvoker.OnPostCommandTableCreate [.add_ids_arguments at 0x7fd3ed7df310>, .add_cache_arguments at 0x7fd3ed7eeee0>]
cli.knack.cli: Event: CommandInvoker.OnCommandTableLoaded []
cli.knack.cli: Event: CommandInvoker.OnPreParseArgs []
msrest.serialization: principalId is not a known attribute of class and will be ignored
msrest.serialization: clientId is not a known attribute of class and will be ignored
cli.knack.cli: Event: CommandInvoker.OnPostParseArgs [, , .parse_ids_arguments at 0x7fd3ed7eee50>]
Argument '--mi-user-assigned' is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus
cli.azure.cli.core.commands.client_factory: Getting management service client client_type=EventGridManagementClient
urllib3.connectionpool: Starting new HTTP connection (1): localhost:50342
urllib3.connectionpool: http://localhost:50342 "POST /oauth2/token HTTP/1.1" 200 2417
msrestazure.azure_active_directory: MSI: Retrieving a token from http://localhost:50342/oauth2/token, with payload {'resource': 'https://management.core.windows.net/'}
cli.azure.cli.core.auth.adal_authentication: MSIAuthenticationWrapper.get_token: scopes=('https://management.core.windows.net//.default',), kwargs={}
urllib3.connectionpool: Starting new HTTP connection (1): localhost:50342
urllib3.connectionpool: http://localhost:50342 "POST /oauth2/token HTTP/1.1" 200 2417
msrestazure.azure_active_directory: MSI: Retrieving a token from http://localhost:50342/oauth2/token, with payload {'resource': 'https://management.core.windows.net/'}
cli.azure.cli.core.auth.adal_authentication: Normalize expires_on: '1691426645' -> 1691426645
cli.azure.cli.core.sdk.policies: Request URL: 'https://management.azure.com/subscriptions/82435244-8fc9-4176-bc75-0580b93de975/resourceGroups/Storage/providers/Microsoft.EventGrid/systemTopics/adlsdemos-e83fb0a9-193a-4c4a-81e3-431a71327a5c?api-version=2021-10-15-preview'
cli.azure.cli.core.sdk.policies: Request method: 'PATCH'
cli.azure.cli.core.sdk.policies: Request headers:
cli.azure.cli.core.sdk.policies: 'Content-Type': 'application/json'
cli.azure.cli.core.sdk.policies: 'Content-Length': '2'
cli.azure.cli.core.sdk.policies: 'Accept': 'application/json'
cli.azure.cli.core.sdk.policies: 'x-ms-client-request-id': '1f9af71c-353f-11ee-bbbf-bad6fe77bd74'
cli.azure.cli.core.sdk.policies: 'CommandName': 'eventgrid system-topic update'
cli.azure.cli.core.sdk.policies: 'ParameterSetName': '-g --name --mi-user-assigned --debug'
cli.azure.cli.core.sdk.policies: 'User-Agent': 'AZURECLI/2.51.0 (RPM) azsdk-python-mgmt-eventgrid/10.2.0b2 Python/3.9.14 (Linux-5.4.0-1109-azure-x86_64-with-glibc2.35) cloud-shell/1.0'
cli.azure.cli.core.sdk.policies: 'Authorization': '*****'
### **cli.azure.cli.core.sdk.policies: Request body:**
### **cli.azure.cli.core.sdk.policies: {}**
urllib3.connectionpool: Starting new HTTPS connection (1): management.azure.com:443
urllib3.connectionpool: https://management.azure.com:443 "PATCH /subscriptions//resourceGroups/Storage/providers/Microsoft.EventGrid/systemTopics/adlsdemos-e83fb0a9-193a-4c4a-81e3-431a71327a5c?api-version=2021-10-15-preview HTTP/1.1" 200 None
cli.azure.cli.core.sdk.policies: Response status: 200
cli.azure.cli.core.sdk.policies: Response headers:
cli.azure.cli.core.sdk.policies: 'Cache-Control': 'no-cache'
cli.azure.cli.core.sdk.policies: 'Pragma': 'no-cache'
cli.azure.cli.core.sdk.policies: 'Transfer-Encoding': 'chunked'
cli.azure.cli.core.sdk.policies: 'Content-Type': 'application/json; charset=utf-8'
cli.azure.cli.core.sdk.policies: 'Content-Encoding': 'gzip'
cli.azure.cli.core.sdk.policies: 'Expires': '-1'
cli.azure.cli.core.sdk.policies: 'Vary': 'Accept-Encoding'
cli.azure.cli.core.sdk.policies: 'Strict-Transport-Security': 'max-age=31536000; includeSubDomains'
cli.azure.cli.core.sdk.policies: 'x-ms-request-id': 'a7375130-07a1-45b1-8e35-2442befd4140'
cli.azure.cli.core.sdk.policies: 'Server': 'Microsoft-HTTPAPI/2.0'
cli.azure.cli.core.sdk.policies: 'x-ms-ratelimit-remaining-subscription-writes': '1199'
cli.azure.cli.core.sdk.policies: 'x-ms-correlation-request-id': '43f3919f-8ae6-4241-8916-883df9d5f45a'
cli.azure.cli.core.sdk.policies: 'x-ms-routing-request-id': 'WESTUS:20230807T162613Z:43f3919f-8ae6-4241-8916-883df9d5f45a'
cli.azure.cli.core.sdk.policies: 'X-Content-Type-Options': 'nosniff'
cli.azure.cli.core.sdk.policies: 'Date': 'Mon, 07 Aug 2023 16:26:12 GMT'
cli.azure.cli.core.sdk.policies: Response content:
cli.azure.cli.core.sdk.policies: {"properties":{"provisioningState":"Succeeded","source":"/subscriptions//resourceGroups/Storage/providers/Microsoft.Storage/storageAccounts/adlsdemos","topicType":"microsoft.storage.storageaccounts","metricResourceId":"fe203f41-83b4-4273-8129-5a7d3c2c733e"},"systemData":null,"identity":{"type":"None","principalId":null,"tenantId":null,"userAssignedIdentities":null},"location":"centralus","tags":{"Dept":"IT"},"id":"/subscriptions//resourceGroups/Storage/providers/Microsoft.EventGrid/systemTopics/adlsdemos-e83fb0a9-193a-4c4a-81e3-431a71327a5c","name":"adlsdemos-e83fb0a9-193a-4c4a-81e3-431a71327a5c","type":"Microsoft.EventGrid/systemTopics"}
cli.knack.cli: Event: CommandInvoker.OnTransformResult [, ]
cli.knack.cli: Event: CommandInvoker.OnFilterResult []
{
"id": "/subscriptions//resourceGroups/Storage/providers/Microsoft.EventGrid/systemTopics/adlsdemos-e83fb0a9-193a-4c4a-81e3-431a71327a5c",
"identity": {
"principalId": null,
"tenantId": null,
"type": "None",
"userAssignedIdentities": null
},
"location": "centralus",
"metricResourceId": "fe203f41-83b4-4273-8129-5a7d3c2c733e",
"name": "adlsdemos-e83fb0a9-193a-4c4a-81e3-431a71327a5c",
"provisioningState": "Succeeded",
"resourceGroup": "Storage",
"source": "/subscriptions//resourceGroups/Storage/providers/Microsoft.Storage/storageAccounts/adlsdemos",
"systemData": null,
"tags": {
"Dept": "IT"
},
"topicType": "microsoft.storage.storageaccounts",
"type": "Microsoft.EventGrid/systemTopics"
}
cli.knack.cli: Event: Cli.SuccessfulExecute []
cli.knack.cli: Event: Cli.PostExecute []
az_command_data_logger: exit code: 0
cli.__main__: Command ran in 1.125 seconds (init: 0.138, invoke: 0.988)
telemetry.main: Begin splitting cli events and extra events, total events: 1
telemetry.client: Accumulated 0 events. Flush the clients.
telemetry.main: Finish splitting cli events and extra events, cli events: 1
telemetry.save: Save telemetry record of length 3481 in cache
telemetry.main: Begin creating telemetry upload process.
telemetry.process: Creating upload process: "/usr/bin/python3.9 /usr/lib/az/lib/python3.9/site-packages/azure/cli/telemetry/__init__.py /home/ivan/.azure"
telemetry.process: Return from creating process
telemetry.main: Finish creating telemetry upload process.

### Expected behavior

The Event Grid system topic should be updated with user assigned managed identity using the following command:

az eventgrid system-topic update -g Storage --name adlsdemos-e83fb0a9-193a-4c4a-81e3-431a71327a5c **--mi-user-assigned** /subscriptions//resourcegroups/tmpresources/providers/Microsoft.ManagedIdentity/userAssignedIdentities/egst-identity

The same expected result for system assigned managed identity.

### Environment Summary

azure-cli 2.51.0

core 2.51.0
telemetry 1.1.0

Extensions:
ai-examples 0.2.5
ml 2.19.1
ssh 2.0.1

Dependencies:
msal 1.24.0b1
azure-mgmt-resource 23.1.0b2

Python location '/usr/bin/python3.9'
Extensions directory '/home/ivan/.azure/cliextensions'
Extensions system directory '/usr/lib/python3.9/site-packages/azure-cli-extensions'

Python (Linux) 3.9.14 (main, Feb 8 2023, 03:39:52)
[GCC 11.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.