Same policy have different behavior in azure apim

Akhila 0 Reputation points
2024-07-08T18:37:26.5966667+00:00

I have an Azure API Management policy that displays a warning when saved, but it functions correctly works for my needs.

User's image

But some clients encounter errors when saving, such as in the policy snippet below.

<set-variable name="labels" value="@{
                var labelsRaw = $"{{Labels}}".Split(',').Select(label => label.Trim().Split(':'));
                JObject labels = new JObject();
                foreach (string[] label in labelsRaw) {
                    if (label.Length == 2) {
                        labels.Add(label[0], label[1]);
                    }
                }
                if (labels.Count == 0) {
                    return "";
                }
                return $"\"labels\":{labels.ToString()},";
            }" />

User's image

Could you clarify why this issue happens?

Azure API Management
Azure API Management
An Azure service that provides a hybrid, multi-cloud management platform for APIs.
1,928 questions
Azure Policy
Azure Policy
An Azure service that is used to implement corporate governance and standards at scale for Azure resources.
825 questions
0 comments No comments
{count} votes