'Azure API management choose policy for restricting particular group
I am trying to restrict a group from accessing an operation. but having some error:
One or more fields contain incorrect values: Error in element 'choose' on line 15, column 6: Cannot convert lambda expression to type 'IGroup' because it is not a delegate type
Please find below code
<policies>
<inbound>
<choose>
<when condition="@(context.User.Groups.Contains(g => g.name == "audit"))">
<return-response>
<set-status code="403" reason="Unauthorized" />
<set-body>Users in group audit do not have access to this method. </set-body>
</return-response>
</when>
</choose>
<base />
</inbound>
<backend>
<base />
</backend>
<outbound>
<base />
</outbound>
<on-error>
<base />
</on-error>
</policies>
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
