-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Add policy set definition commands #4515
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
df4c539
69ec6d6
98c4048
cf9fe45
9ba706e
e78019c
9988cc6
613f40b
bea8810
26b629d
25188b8
878fe46
0af53b1
dfc1e15
588b86f
c510185
52c9e91
b44f552
820856d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -172,7 +172,7 @@ | |
| } | ||
| } | ||
| } | ||
| """ | ||
| """ | ||
| helps['policy definition delete'] = """ | ||
| type: command | ||
| short-summary: Delete a policy definition. | ||
|
|
@@ -189,6 +189,43 @@ | |
| type: command | ||
| short-summary: List policy definitions. | ||
| """ | ||
| helps['policy set-definition'] = """ | ||
| type: group | ||
| short-summary: Manage resource policy set definitions. | ||
| """ | ||
| helps['policy set-definition create'] = """ | ||
| type: command | ||
| short-summary: Create a policy set definition. | ||
| parameters: | ||
| - name: --definitions | ||
| type: string | ||
| short-summary: Policy definitions in JSON format, or a path to a file containing JSON rules. | ||
| examples: | ||
| - name: Create a policy set definition. | ||
| text: | | ||
| az policy setdefinition create -n readOnlyStorage --definitions \\ | ||
| [ \\ | ||
| { \\ | ||
| "policyDefinitionId": "/subscriptions/mySubId/providers/Microsoft.Authorization/policyDefinitions/storagePolicy" \\ | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is a policy set just a collection of IDs, or is there more to it? If it is, it seems you could get away from the JSON object approach and just accepts a list of names and/or IDs to assemble the set definition.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not just IDs, it can have the entire policy rule as json as well.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Got it
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm sorry I misspoke above. The policy set cannot contain entire policy rule, but it can have a multiples of policyDefinitionId and parameters (which is json object), so either way, this is a complex object that requires file handling |
||
| } \\ | ||
| ] | ||
| """ | ||
| helps['policy set-definition delete'] = """ | ||
| type: command | ||
| short-summary: Delete a policy set definition. | ||
| """ | ||
| helps['policy set-definition show'] = """ | ||
| type: command | ||
| short-summary: get a policy set definition. | ||
| """ | ||
| helps['policy set-definition update'] = """ | ||
| type: command | ||
| short-summary: Update a policy set definition. | ||
| """ | ||
| helps['policy set-definition list'] = """ | ||
| type: command | ||
| short-summary: List policy set definitions. | ||
| """ | ||
| helps['policy assignment'] = """ | ||
| type: group | ||
| short-summary: Manage resource policy assignments. | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Recommendations: 1) don't accept JSON unless you truly have to. 2) If you do need this to be JSON, then just accept the JSON string. The help text would look like
JSON string containing the policy definition. Use @{file} to load from a file.We are trying to move away from sniffing whether an input is JSON or a path through the @ symbol (which loads the contents of the file).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be a json, since it takes a json array which can have:
With regards to help, the definitions can also be a uri that points to a valid json file, just like the rules in policy definition
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since you are going for parity with
policy definition createthen disregard my comment. However, do make sure the help and behavior is consistent.