Skip to content

[Resource] PolicySet test will not re-record and does not unwrap service error #6008

@tjprescott

Description

@tjprescott

The test test_resource_policyset will not re-record. It fails on Bad Request when trying to create the policy assignment with the newly created set-definition. The test has been marked with @live_only to unblock unrelated changes in Network.

There are two issues:

  1. The policy assignment create step in the test fails.
  2. The command does not properly unwrap the error from the service. Running the command manually with --debug I got the following error trace:
msrest.http_logger : b'{"error":{"code":"InvalidPolicySku","message":"The policy assignment \'<null>\' is 
invalid because it references a policy set definition (\'/subscriptions/0b1f6471-1bf0-4dda-aec3-
cb9272f09590/providers/Microsoft.Authorization/policySetDefinitions/test-policy1\') and has missing or 
unsupported Sku: \'{\\"name\\":\\"A0\\",\\"tier\\":\\"Free\\"}\'. To assign a policy set definition, use one 
of the following SKUs which support this feature: \'[{\\"name\\":\\"A1\\",\\"tier\\":\\"Standard\\"}]\'."}}'
msrest.exceptions : Operation returned an invalid status code 'Bad Request'

So the test should be fixed, but also the exception handler should be fixed to unwrap and expose this error.


Environment summary

Install Method (e.g. pip, interactive script, apt-get, Docker, MSI, edge build) / CLI version (az --version) / OS version / Shell Type (e.g. bash, cmd.exe, Bash on Windows)

Metadata

Metadata

Assignees

Labels

ARMaz resource/group/lock/tag/deployment/policy/managementapp/account management-groupTest Framework

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions