azure-sdk-for-net
azure-sdk-for-net copied to clipboard
[BUG] ResourceManager: Type Error
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
Thank you for your feedback. Tagging and routing to the team member best able to assist.
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 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.
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: |
|
Milestone: | - |
@armleads-azure please help check the type of assignPermissions in policyDefinitions.json. It is defined as boolean in swagger, but service accepts/returns string.
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.