Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
7c4eedd
Add existing policy json to make review easier
vivsriaus Aug 24, 2017
cdf4468
Add policy set definition APIs
vivsriaus Aug 24, 2017
e9d9720
Merge branch 'current' of https://github.com/Azure/azure-rest-api-spe…
vivsriaus Aug 25, 2017
59a4fcc
Add examples for policySetDefinition APIs
vivsriaus Aug 25, 2017
ddd97a0
Add policySku to policy assignment
vivsriaus Aug 25, 2017
286e4a1
Merge branch 'current' of https://github.com/Azure/azure-rest-api-spe…
vivsriaus Aug 25, 2017
6b13491
Merge branch 'current' of https://github.com/Azure/azure-rest-api-spe…
vivsriaus Aug 28, 2017
ff2f6c8
Merge branch 'current' of https://github.com/Azure/azure-rest-api-spe…
vivsriaus Aug 30, 2017
139ee8d
Address feedback
vivsriaus Aug 30, 2017
28b7136
Merge branch 'current' of https://github.com/Azure/azure-rest-api-spe…
vivsriaus Sep 5, 2017
5721e81
Merge branch 'current' of https://github.com/Azure/azure-rest-api-spe…
vivsriaus Sep 6, 2017
2274b1c
Address more feedback
vivsriaus Sep 6, 2017
b37a167
Add parameter example
vivsriaus Sep 6, 2017
290fd9b
Fix incorrect example in listPSDefinitions
vivsriaus Sep 6, 2017
ddd44e0
Merge branch 'current' of https://github.com/Azure/azure-rest-api-spe…
vivsriaus Sep 7, 2017
0ceabfc
Remove policy definitions from latest api version
vivsriaus Sep 7, 2017
df1297f
Update policy definition and policy assignment for old api-version
vivsriaus Sep 7, 2017
ea7c1ed
Update readme.md to include multiple policy files for new policy api …
vivsriaus Sep 7, 2017
780cc26
Address more feedback
vivsriaus Sep 7, 2017
5bd98a3
Merge branch 'current' of https://github.com/Azure/azure-rest-api-spe…
vivsriaus Sep 11, 2017
f7776f4
Add example for 200
vivsriaus Sep 11, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add examples for policySetDefinition APIs
  • Loading branch information
vivsriaus committed Aug 25, 2017
commit 59a4fcc24f6924593e8c07a3cba82ad41809a17c
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"parameters": {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these example files need to be referenced in the swagger spec for them to show up in documentation, right? See https://github.com/pilor/azure-rest-api-specs/blob/current/documentation/x-ms-examples.md

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Of course they should! thanks for catching this

"subscriptionId": "subid",
"policySetDefinitionName": "costManagement",
"api-version": "2017-06-01-preview",
"parameters": {
"properties": {
"displayName": "VM and Storage Cost Management",
"description": "Policies required to minimize the risk of accidental cost overruns",
"metadata": {
"category": "Cost Management"
},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

example should include parameters since they are typically the most complex part of these objects

"policyDefinitions": [
{
"policyDefinitionId": "/subscriptions/subId/providers/Microsoft.Authorization/policyDefinitions/vmSkus"
}
]
}
}
},
"responses": {
"201": {
"headers": {},
"body": {
"id": "/subscriptions/subid/providers/Microsoft.Authorization/policySetDefinitions/costManagement",
"type": "Microsoft.Authorization/policySetDefinitions",
"name": "costManagement",
"properties": {
"displayName": "VM and Storage Cost Management",
"description": "Policies required to minimize the risk of accidental cost overruns",
"metadata": {
"category": "Cost Management"
},
"policyDefinitions": [
{
"policyDefinitionId": "/subscriptions/subid/providers/Microsoft.Authorization/policyDefinitions/vmSkus"
}
],
"policyType": "Custom"
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{
"parameters": {
"subscriptionId": "subid",
"policySetDefinitionName": "costManagement",
"api-version": "2017-06-01-preview"
},
"responses": {
"200": {
"headers": {},
"body": {
"id": "/subscriptions/subid/providers/Microsoft.Authorization/policySetDefinitions/costManagement",
"type": "Microsoft.Authorization/policySetDefinitions",
"name": "costManagement",
"properties": {
"displayName": "VM and Storage Cost Management",
"description": "Policies required to minimize the risk of accidental cost overruns",
"metadata": {
"category": "Cost Management"
},
"parameters": {
"allowedLocations": {
"type": "array",
"metadata": {
"description": "Regions that resources can be deployed to",
"displayName": "Valid Regions"
}
}
},
"policyDefinitions": [
{
"policyDefinitionId": "/subscriptions/subid/providers/Microsoft.Authorization/policyDefinitions/storageSkus",
"parameters": {
"listOfAllowedSKUs": {
"value": [
"�Standard_GRS�",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

both of these values should just have 1 "

"�Standard_LRS�"
]
}
}
},
{
"policyDefinitionId": "/subscriptions/subid/providers/Microsoft.Authorization/policyDefinitions/vmSkus"
},
{
"policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/policyDefinitionId",
"parameters": {
"listOfAllowedLocations": {
"value": "[parameters('allowedLocations')]"
}
}
}
],
"policyType": "Custom"
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
{
"parameters": {
"subscriptionId": "subid",
"api-version": "2017-06-01-preview"
},
"responses": {
"200": {
"headers": {},
"body": {
"value": [
{
"id": "/subscriptions/subid/providers/Microsoft.Authorization/policySetDefinitions/costManagement",
"type": "Microsoft.Authorization/policySetDefinitions",
"name": "costManagement",
"properties": {
"displayName": "VM and Storage Cost Management",
"description": "Policies required to minimize the risk of accidental cost overruns",
"metadata": {
"category": "Cost Management"
},
"parameters": {
"allowedLocations": {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

both policySets returned in this example are actually invalid. They have a parameter defined that is never used in a policyDefinition reference

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please elaborate? This is listing the policy sets, where is policyDefinition reference defined here?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The sets in this example have an "allowedLocations" parameter. In order for this to be a valid set definition that "allowedLocations" parameter needs to be referenced by one of the parameters in the "policyDefinitions" array. Similar to what getPolicySetDefinition example has:

{

  •          "policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/policyDefinitionId", 
    
  •          "parameters": { 
    
  •            "listOfAllowedLocations": { 
    
  •              "value": "[parameters('allowedLocations')]" 
    
  •            } 
    
  •          } 
    
  •        } 
    

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it! Thanks

"type": "array",
"metadata": {
"description": "Regions that resources can be deployed to",
"displayName": "Valid Regions"
}
}
},
"policyDefinitions": [
{
"policyDefinitionId": "/subscriptions/subid/providers/Microsoft.Authorization/policyDefinitions/storageSkus",
"parameters": {
"listOfAllowedSKUs": {
"value": [
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To make this clear and valid can you change this to "parameters": { "validLocations": { "value": "[parameters('allowedLocations')]" } }?

"�Standard_GRS�",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

single "

"�Standard_LRS�"
]
}
}
}
],
"policyType": "Custom"
}
},
{
"id": "/subscriptions/subid/providers/Microsoft.Authorization/policySetDefinitions/skuManagement",
"type": "Microsoft.Authorization/policySetDefinitions",
"name": "skuManagement",
"properties": {
"displayName": "VM Sku Management",
"description": "Policies required to minimize the risk of accidental cost overruns",
"metadata": {
"category": "Sku Management"
},
"parameters": {
"allowedLocations": {
"type": "array",
"metadata": {
"description": "Regions that resources can be deployed to",
"displayName": "Valid Regions"
}
}
},
"policyDefinitions": [
{
"policyDefinitionId": "/subscriptions/subid/providers/Microsoft.Authorization/policyDefinitions/vmSkus"
}
],
"policyType": "Custom"
}
}
]
}
}
}
}