Code Monkey home page Code Monkey logo

Comments (6)

isra-fel avatar isra-fel commented on July 18, 2024

Hi thanks for reporting! I'll loop in the developers of the module but it seems New-AzEventGridAdvancedFilterObject is the way to go. Pass its returned value to -FilterAdvancedFilter

from azure-powershell.

microsoft-github-policy-service avatar microsoft-github-policy-service commented on July 18, 2024

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @jfggdl.

from azure-powershell.

catalingurgu avatar catalingurgu commented on July 18, 2024

Hi thanks for reporting! I'll loop in the developers of the module but it seems New-AzEventGridAdvancedFilterObject is the way to go. Pass its returned value to -FilterAdvancedFilter

Thanks for the reply, indeed, I thought that I can use New-AzEventGridAdvancedFilterObject to define the filter, but its output is of type AdvancedFilter, which has only Key and OperatorType properties, see AdvancedFilter Class
In the previous version (1.6.1) the filter definition was a hashtable array, the keys from a hashtable element being Operator, Key and Value(s) Learn Link
So the problem with the 2.0.0 version for me is the missing "value" or "values" property from the AdvancedFilter class.
I think it needs to be there, in my understanding the purpose of the advanced filter is to look for values in the Key using the operator specified with the OperationType property.
Or maybe there's an alternative method to do this, but I didn't find one in the documentation.
Thanks!

from azure-powershell.

isra-fel avatar isra-fel commented on July 18, 2024

Hi @catalingurgu after checking with team member we believe this was a code defect. There should have been cmdlets for you to create filter objects and pass them to Update-AzEventGridSubscription.
Use this as a workaround - create the filter objects with .NET APIs

$filter = New-Object -TypeName "Microsoft.Azure.PowerShell.Cmdlets.EventGrid.Models.StringBeginsWithAdvancedFilter" -Property @{Key = "KEY"; Value = @("VALUE1", "VALUE2")}

For a complete list of filter types please refer to the "Derived" part of IAdvancedFilter Interface

from azure-powershell.

isra-fel avatar isra-fel commented on July 18, 2024

@jfggdl please note that the root cause was polymorphism wasn't handled correctly. According to the development guide, model classes should be created from the child classes, i.e. the concrete Filter classes instead of AdvancedFilter.

from azure-powershell.

catalingurgu avatar catalingurgu commented on July 18, 2024

@isra-fel, Thanks for the solution!
For anyone trying to implement the .NET API workaround in an Azure Automation Account PowerShell Runbook: I had to explicitly import the Az.EventGrid module in the runbook (Import-Module -Name Az.EventGrid), without this the .NET assembly doesn't seem to be available and the type is not recognized.

from azure-powershell.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.