'EndpointType' parameters not found while running automation script for Event grid subscription

Viral Soni 0 Reputation points
2025-07-25T07:17:18.9133333+00:00

Hi,

I am trying to automate storage account creation with stroage queue and also configuring Event Grid subscription to forward events. But when the script tries to create event grid, the script fails with a 'parameter not found' error when configuring the Event Grid subscription with a storage queue as the endpoint type. Basically it is unable to found the parameter name 'EndpointType'. Below is the part of my script where I have automated to create event grid subscription with endpoint type as storage queue. Can someone help me on this.

# Create System Topic Subscription with Storage Queue endpoint
New-AzEventGridSystemTopicEventSubscription `
    -ResourceGroupName $resourceGroup `
    -SystemTopicName $systemTopicName `
    -EventSubscriptionName $eventSubscriptionName `
    -EndpointType StorageQueue `
    -Endpoint $queueName `
    -IncludedEventType $eventTypes `
    -StorageQueueMessageTtlInSeconds 300 `
    -StorageAccountResourceId $storageAccountId

Thanks in advance.

Azure Event Grid
Azure Event Grid
An Azure event routing service designed for high availability, consistent performance, and dynamic scale.
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Alex Burlachenko 13,640 Reputation points Volunteer Moderator
    2025-07-25T11:26:31.2066667+00:00

    hi Viral Soni,

    looks like u hit a snag with that 'endpointtype' parameter, mon ami )) no worries, alright, so the issue here is that the 'new-azeventgridsystemtopiceventsubscription' cmdlet has evolved a bit )) the 'endpointtype' parameter got a makeover in newer versions of the azure powershell module. instead of specifying it directly, u now need to define the endpoint configuration differently. here's how u can fix it )) u gotta use the 'storagequeue' object to define the endpoint now. here's the updated snippet for u ))

    # create system topic subscription with storage queue endpoint  
    $storageQueueEndpoint = @{  
        queueName = $queueName  
        resourceId = $storageAccountId  
    }  
    
    new-azeventgridsystemtopiceventsubscription `  
        -resourcegroupname $resourcegroup `  
        -systemtopicname $systemtopicname `  
        -eventsubscriptionname $eventsubscriptionname `  
        -storagequeuemessagettlinseconds 300 `  
        -includedeventtype $eventtypes `  
        -storagequeueendpoint $storageQueueEndpoint  
    

    check the official docs for more deets https://docs.microsoft.com/en-us/powershell/module/az.eventgrid/new-azeventgridsystemtopiceventsubscription. they explain the new way to set up endpoints ))

    this kinda change happens sometimes when apis get updated. worth keeping an eye on the module version u're using. run 'get-installedmodule -name az' to see if u're on the latest. if not, 'update-module -name az' might save u some headaches later ))

    also, if u're automating a lot of azure stuff, consider using az cli or bicep for some tasks. they sometimes handle these transitions smoother ))

    if u ever get stuck with parameter names, 'get-command -syntax new-azeventgridsystemtopiceventsubscription' will show u how the cmdlet expects things. lifesaver, i tell u ) hope this sorts it out for u )) if not, hit me back

    Best regards,

    Alex

    and "yes" if you would follow me at Q&A - personaly thx.
    P.S. If my answer help to you, please Accept my answer
    

    https://ctrlaltdel.blog/


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.