az eventgrid system-topic event-subscription create `
--source-resource-id $storageId `
--name $eventGridSubscriptionName `
--resource-group $resourceGroupName `
--system-topic-name $eventGridTopicName `
--endpoint $serviceBusTopicEndpoint `
--subject-begins-with $eventGridSubjectStart `
--subject-ends-with $eventGridSubjectEnd `
--endpoint-type servicebustopic `
--included-event-types Microsoft.Storage.BlobCreated `
--delivery-attribute-mapping Label static demo_subscription false
PS /home/sudharsan/Documents/Github/demo> ./demo.ps1
/subscriptions/SUBSCRIPTION-ID/resourceGroups/MyResourceGroup/providers/Microsoft.Storage/storageAccounts/devstorage
Creating the event grid system topic subscription: test-activities-subscription
cli.knack.cli: Command arguments: ['eventgrid', 'system-topic', 'event-subscription', 'create', '--name', 'test-activities-subscription', '--resource-group', 'MyResourceGroup', '--system-topic-name', 'test-activities', '--endpoint', '/subscriptions/SUBSCRIPTION-ID/resourceGroups/MyResourceGroup/providers/Microsoft.ServiceBus/namespaces/contoso-dev-service-bus/topics/contoso-service-bus', '--subject-begins-with', '/blobServices/default/containers/my-activities/blobs/process/output', '--subject-ends-with', '.json', '--endpoint-type', 'servicebustopic', '--included-event-types', 'Microsoft.Storage.BlobCreated', '--delivery-attribute-mapping', 'Label', 'static', 'test-activities-subscription', '--debug']
cli.knack.cli: __init__ debug log:
Enable color in terminal.
cli.knack.cli: Event: Cli.PreExecute []
cli.knack.cli: Event: CommandParser.OnGlobalArgumentsCreate [<function CLILogging.on_global_arguments at 0x7cbb009e0040>, <function OutputProducer.on_global_arguments at 0x7cbb0098e160>, <function CLIQuery.on_global_arguments at 0x7cbb009c3c40>]
cli.knack.cli: Event: CommandInvoker.OnPreCommandTableCreate []
cli.azure.cli.core: Modules found from index for 'eventgrid': ['azext_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.003 25 96
cli.azure.cli.core: Total (1) 0.003 25 96
cli.azure.cli.core: These extensions are not installed and will be skipped: ['azext_ai_examples', 'azext_next']
cli.azure.cli.core: Loading extensions:
cli.azure.cli.core: Name Load Time Groups Commands Directory
cli.azure.cli.core: eventgrid 0.100 24 80 /home/sudharsan/.azure/cliextensions/eventgrid
cli.azure.cli.core: Total (1) 0.100 24 80
cli.azure.cli.core: Loaded 31 groups, 115 commands.
cli.azure.cli.core: Found a match in the command table.
cli.azure.cli.core: Raw command : eventgrid system-topic event-subscription create
cli.azure.cli.core: Command table: eventgrid system-topic event-subscription create
cli.knack.cli: Event: CommandInvoker.OnPreCommandTableTruncate [<function AzCliLogging.init_command_file_logging at 0x7cbaffb01bc0>]
cli.azure.cli.core.azlogging: metadata file logging enabled - writing logs to '/home/sudharsan/.azure/commands/2024-03-12.18-04-44.eventgrid_system-topic_event-subscription_create.39604.log'.
az_command_data_logger: command args: eventgrid system-topic event-subscription create --name {} --resource-group {} --system-topic-name {} --endpoint {} --subject-begins-with {} --subject-ends-with {} --endpoint-type {} --included-event-types {} --delivery-attribute-mapping {} {} {} --debug
cli.knack.cli: Event: CommandInvoker.OnPreArgumentLoad [<function register_global_subscription_argument.<locals>.add_subscription_parameter at 0x7cbaff909ee0>]
cli.knack.cli: Event: CommandInvoker.OnPostArgumentLoad []
cli.knack.cli: Event: CommandInvoker.OnPostCommandTableCreate [<function register_ids_argument.<locals>.add_ids_arguments at 0x7cbaff909f80>, <function register_cache_arguments.<locals>.add_cache_arguments at 0x7cbaff90a0c0>]
cli.knack.cli: Event: CommandInvoker.OnCommandTableLoaded []
cli.knack.cli: Event: CommandInvoker.OnPreParseArgs []
cli.azure.cli.core.command_recommender: "--delivery-attribute-mapping" is an invalid parameter for command "eventgrid system-topic event-subscription create".
urllib3.connectionpool: Starting new HTTPS connection (1): app.aladdin.microsoft.com:443
urllib3.connectionpool: https://app.aladdin.microsoft.com:443 "GET /api/v1.0/suggestions?query=%7B%22command%22%3A+%22eventgrid+system-topic+event-subscription+create%22%2C+%22parameters%22%3A+%22%22%7D&clientType=AzureCli&context=%7B%22versionNumber%22%3A+%222.58.0%22%2C+%22errorType%22%3A+%22UnrecognizedArguments%22%2C+%22correlationId%22%3A+%225faf738f-6d3c-4595-820e-b8d79173f2a6%22%2C+%22subscriptionId%22%3A+%22a86d47f8-8b44-4f46-9d88-29b61245b740%22%2C+%22eventId%22%3A+%227cb8c420-850d-404b-a192-8e493206326d%22%7D HTTP/1.1" 200 None
cli.azure.cli.core.command_recommender: "--delivery-attribute-mapping" is an invalid parameter for command "eventgrid system-topic event-subscription create".
cli.azure.cli.core.azclierror: NoneType: None
cli.azure.cli.core.azclierror: unrecognized arguments: --delivery-attribute-mapping Label static test-activities-subscription
az_command_data_logger: unrecognized arguments: --delivery-attribute-mapping Label static test-activities-subscription
Examples from AI knowledge base:
az eventgrid system-topic event-subscription create --endpoint /subscriptions/{SubID}/resourceGroups/{RG}/providers/Microsoft.Web/sites/{functionappname}/functions/{functionname} --endpoint-type webhook --included-event-types Microsoft.Storage.BlobCreated Microsoft.Storage.BlobDeleted --name es1 --resource-group rg1 --system-topic-name systemtopic1
Create a new event subscription for a system topic (autogenerated)
az eventgrid system-topic event-subscription create --endpoint /subscriptions/{SubID}/resourceGroups/{RG}/providers/Microsoft.Web/sites/{functionappname}/functions/{functionname} --endpoint-type webhook --event-delivery-schema eventgridschema --included-event-types Microsoft.Storage.BlobCreated Microsoft.Storage.BlobDeleted --name es1 --resource-group rg1 --system-topic-name systemtopic1
Create a new event subscription for a system topic (autogenerated)
https://docs.microsoft.com/en-US/cli/azure/eventgrid/system-topic/event-subscription#az_eventgrid_system_topic_event_subscription_create
Read more about the command in reference docs
cli.knack.cli: Event: Cli.PostExecute [<function AzCliLogging.deinit_cmd_metadata_logging at 0x7cbaffb01e40>]
az_command_data_logger: exit code: 2
cli.__main__: Command ran in 0.616 seconds (init: 0.107, invoke: 0.509)
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 4579 in cache
telemetry.main: Begin creating telemetry upload process.
telemetry.process: Creating upload process: "/opt/az/bin/python3 /opt/az/lib/python3.11/site-packages/azure/cli/telemetry/__init__.py /home/sudharsan/.azure"
telemetry.process: Return from creating process
telemetry.main: Finish creating telemetry upload process.
Successfully created the event grid system topic: test-activities
PS /home/sudharsan/Documents/Github/demo>
> az --version
azure-cli 2.58.0
core 2.58.0
telemetry 1.1.0
Extensions:
azure-devops 1.0.0
eventgrid 1.0.0b1
storage-blob-preview 0.7.2
Dependencies:
msal 1.26.0
azure-mgmt-resource 23.1.0b2
Python location '/opt/az/bin/python3'
Extensions directory '/home/sudharsan/.azure/cliextensions'
Python (Linux) 3.11.7 (main, Feb 29 2024, 02:08:19) [GCC 11.4.0]
Legal docs and information: aka.ms/AzureCliLegal
Your CLI is up-to-date.
Describe the bug
I am trying to create an event grid System topic that
Related command
Errors
Issue script & Debug output
Expected behavior
It should successfully append the Delivery properties to the subscription using
--delivery-attribute-mappingargumentEnvironment Summary
Additional context
I was referring to the documentation https://learn.microsoft.com/en-us/azure/event-grid/delivery-properties#setting-dynamic-header-values to update the Event grid delivery properties.