azure-sdk-for-net icon indicating copy to clipboard operation
azure-sdk-for-net copied to clipboard

[BUG] ResourceManager: Type Error

Open stevengiannakopoulos opened this issue 2 years ago • 5 comments

Library name and version

Azure.ResourceManager.Resources 1.2.0

Describe the bug

When using the ARM Client, under the default subscription, GetSubscriptionPolicySetDefinitions() (or GetSubscriptionPolicySetDefinitions().GetAll()) throws an error: 'System.InvalidOperationException' in Azure.ResourceManager.dll ("The requested operation requires an element of type 'Boolean', but the target element has type 'String'.

Expected behavior

Return a list of policy set definitions instead of an exception

Actual behavior

Throws an exception every time: 'System.InvalidOperationException' in Azure.ResourceManager.dll ("The requested operation requires an element of type 'Boolean', but the target element has type 'String'.

Reproduction Steps

var test = new ArmClient(new DefaultAzureCredential(),"SUBSCRIPTIONID").GetDefaultSubscription().GetSubscriptionPolicySetDefinitions().GetAll().ToList()

Environment

No response

stevengiannakopoulos avatar Jul 14 '22 20:07 stevengiannakopoulos

Thank you for your feedback. Tagging and routing to the team member best able to assist.

jsquire avatar Jul 14 '22 21:07 jsquire

By checking the data types in PolicyDefinitionData recursively, I only found one boolean property: AssignPermissions @stevengiannakopoulos do you know if any of your policies has set AssignPermissions? This looks like a service issue, it should return boolean instead of string.

fengzhou-msft avatar Jul 28 '22 03:07 fengzhou-msft

@fengzhou-msft Revisiting this as I now understand what is happening. The AssignPermissions property in either the policy or policy initiative parameters metadata should be a boolean. I see instances where this property is accepted by Azure policy as a string. Please see image below from the Azure portal (with redacted information). If this property exists as a string within Azure, policies cannot be listed, or this specific policy/ initiative can't be retrieved by the ArmClient. image

stevengiannakopoulos avatar Nov 10 '22 18:11 stevengiannakopoulos

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

Issue Details

Library name and version

Azure.ResourceManager.Resources 1.2.0

Describe the bug

When using the ARM Client, under the default subscription, GetSubscriptionPolicySetDefinitions() (or GetSubscriptionPolicySetDefinitions().GetAll()) throws an error: 'System.InvalidOperationException' in Azure.ResourceManager.dll ("The requested operation requires an element of type 'Boolean', but the target element has type 'String'.

Expected behavior

Return a list of policy set definitions instead of an exception

Actual behavior

Throws an exception every time: 'System.InvalidOperationException' in Azure.ResourceManager.dll ("The requested operation requires an element of type 'Boolean', but the target element has type 'String'.

Reproduction Steps

var test = new ArmClient(new DefaultAzureCredential(),"SUBSCRIPTIONID").GetDefaultSubscription().GetSubscriptionPolicySetDefinitions().GetAll().ToList()

Environment

No response

Author: stevengiannakopoulos
Assignees: fengzhou-msft
Labels:

ARM, Service Attention, Mgmt, customer-reported, question, needs-team-attention

Milestone: -

ghost avatar Jan 10 '23 09:01 ghost

@armleads-azure please help check the type of assignPermissions in policyDefinitions.json. It is defined as boolean in swagger, but service accepts/returns string.

fengzhou-msft avatar Jan 10 '23 09:01 fengzhou-msft

Since this issue is related to the service side and not the SDK side, so we are not able to help you with it. Therefore, we are closing this issue for now. If you need more assistance, please open an Azure support request. We apologize for any inconvenience this may cause you.

We value your feedback and we want to make sure that your problem is solved. If you think that we have misunderstood your issue or closed it incorrectly, please feel free to comment on this thread and reopen the issue. We will be happy to assist you further. Thank you for your understanding and cooperation.

ArthurMa1978 avatar Aug 15 '23 04:08 ArthurMa1978