Skip to content
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

Add built in policy definition/set definition paths #1788

Merged
merged 10 commits into from
Oct 4, 2017
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
}
},
"paths": {
"/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policydefinitions/{policyDefinitionName}": {
"/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}": {
"put": {
"tags": [
"PolicyDefinitions"
Expand Down Expand Up @@ -137,7 +137,39 @@
}
}
},
"/providers/Microsoft.Management/managementgroups/{managementGroupId}/providers/Microsoft.Authorization/policydefinitions/{policyDefinitionName}": {
"/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}": {
"get": {
"tags": [
"PolicyDefinitions"
],
"operationId": "PolicyDefinitions_GetBuiltIn",
"description": "Gets the built in policy definition.",
"parameters": [
{
"name": "policyDefinitionName",
"in": "path",
"required": true,
"type": "string",
"description": "The name of the built in policy definition to get."
},
{
"$ref": "#/parameters/ApiVersionParameter"
}
],
"responses": {
"200": {
Copy link
Contributor

Choose a reason for hiding this comment

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

404 should be valid response correct?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yep

"description": "OK - Returns information about the built in policy definition.",
"schema": {
"$ref": "#/definitions/PolicyDefinition"
}
},
"404": {
"description": "Not Found - the built in policy definition was not found."
}
}
}
},
"/providers/Microsoft.Management/managementgroups/{managementGroupId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}": {
"put": {
"tags": [
"PolicyDefinitions"
Expand All @@ -164,9 +196,6 @@
{
"$ref": "#/parameters/ApiVersionParameter"
},
{
"$ref": "#/parameters/SubscriptionIdParameter"
},
{
"$ref": "#/parameters/ManagementGroupIdParameter"
}
Expand Down Expand Up @@ -197,9 +226,6 @@
{
"$ref": "#/parameters/ApiVersionParameter"
},
{
"$ref": "#/parameters/SubscriptionIdParameter"
},
{
"$ref": "#/parameters/ManagementGroupIdParameter"
}
Expand Down Expand Up @@ -230,9 +256,6 @@
{
"$ref": "#/parameters/ApiVersionParameter"
},
{
"$ref": "#/parameters/SubscriptionIdParameter"
},
{
"$ref": "#/parameters/ManagementGroupIdParameter"
}
Expand All @@ -247,21 +270,14 @@
}
}
},
"/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policydefinitions": {
"/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyDefinitions": {
"get": {
"tags": [
"PolicyDefinitions"
],
"operationId": "PolicyDefinitions_List",
"description": "Gets all the policy definitions for a subscription.",
"parameters": [
{
"name": "$filter",
Copy link
Member

Choose a reason for hiding this comment

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

So this was not supported and here by mistake?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, apparently, only policy assignment list supports filter. Not policy definitions and set definitions

Copy link
Member

Choose a reason for hiding this comment

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

ok, this was exposed in the CLI, I create an issue for that

Copy link
Member

Choose a reason for hiding this comment

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

"in": "query",
"required": false,
"type": "string",
"description": "The filter to apply on the operation."
},
{
"$ref": "#/parameters/ApiVersionParameter"
},
Expand All @@ -279,31 +295,45 @@
},
"x-ms-pageable": {
"nextLinkName": "nextLink"
}
}
},
"/providers/Microsoft.Authorization/policyDefinitions": {
"get": {
"tags": [
"PolicyDefinitions"
],
"operationId": "PolicyDefinitions_ListBuiltIn",
"description": "Gets all the built in policy definitions.",
"parameters": [
{
"$ref": "#/parameters/ApiVersionParameter"
}
],
"responses": {
"200": {
"description": "OK - Returns an array of built in policy definitions.",
"schema": {
"$ref": "#/definitions/PolicyDefinitionListResult"
}
}
},
"x-ms-odata": "#/definitions/PolicyDefinition"
"x-ms-pageable": {
"nextLinkName": "nextLink"
}
}
},
"/providers/Microsoft.Management/managementgroups/{managementGroupId}/providers/Microsoft.Authorization/policydefinitions": {
"/providers/Microsoft.Management/managementgroups/{managementGroupId}/providers/Microsoft.Authorization/policyDefinitions": {
"get": {
"tags": [
"PolicyDefinitions"
],
"operationId": "PolicyDefinitions_ListByManagementGroup",
"description": "Gets all the policy definitions for a subscription at management group level.",
"parameters": [
{
"name": "$filter",
Copy link
Member

Choose a reason for hiding this comment

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

Same question, not supported?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, not supported

"in": "query",
"required": false,
"type": "string",
"description": "The filter to apply on the operation."
},
{
"$ref": "#/parameters/ApiVersionParameter"
},
{
"$ref": "#/parameters/SubscriptionIdParameter"
},
{
"$ref": "#/parameters/ManagementGroupIdParameter"
}
Expand All @@ -318,8 +348,7 @@
},
"x-ms-pageable": {
"nextLinkName": "nextLink"
},
"x-ms-odata": "#/definitions/PolicyDefinition"
}
}
}
},
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{
"parameters": {
"policySetDefinitionName": "costManagement",
"api-version": "2017-06-01-preview"
},
"responses": {
"200": {
"headers": {},
"body": {
"id": "/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": "/providers/Microsoft.Authorization/policyDefinitions/storageSkus",
"parameters": {
"listOfAllowedSKUs": {
"value": [
"Standard_GRS",
"Standard_LRS"
]
}
}
},
{
"policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/vmSkus"
},
{
"policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/policyDefinitionId",
"parameters": {
"listOfAllowedLocations": {
"value": "[parameters('allowedLocations')]"
}
}
}
],
"policyType": "Custom"
}
}
},
"404": {}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
"policyType": "Custom"
}
}
}
},
"404": {}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
{
"parameters": {
"api-version": "2017-06-01-preview"
},
"responses": {
"200": {
"headers": {},
"body": {
"value": [
{
"id": "/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": "/providers/Microsoft.Authorization/policyDefinitions/storageSkus",
"parameters": {
"locations": {
"value": "[parameters('allowedLocations')]"
}
}
}
],
"policyType": "Custom"
}
},
{
"id": "/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"
},
"policyDefinitions": [
{
"policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/vmSkus"
}
],
"policyType": "Custom"
}
}
]
}
}
}
}
Loading