{
  "swagger": "2.0",
  "schemes": [
    "https"
  ],
  "host": "management.azure.com",
  "info": {
    "description": "To manage and control access to your resources, you can define customized policies and assign them at a scope.",
    "title": "PolicyClient",
    "version": "2016-12-01",
    "x-apisguru-categories": [
      "cloud"
    ],
    "x-logo": {
      "url": "https://api.apis.guru/v2/cache/logo/https_assets.onestore.ms_cdnfiles_onestorerolling-1606-01000_shell_v3_images_logo_microsoft.png"
    },
    "x-origin": [
      {
        "format": "swagger",
        "url": "https://raw.githubusercontent.com/Azure/azure-rest-api-specs/master/specification/resources/resource-manager/Microsoft.Authorization/stable/2016-12-01/policyDefinitions.json",
        "version": "2.0"
      }
    ],
    "x-preferred": false,
    "x-providerName": "azure.com",
    "x-serviceName": "resources-policyDefinitions",
    "x-tags": [
      "Azure",
      "Microsoft"
    ]
  },
  "consumes": [
    "application/json",
    "text/json"
  ],
  "produces": [
    "application/json",
    "text/json"
  ],
  "securityDefinitions": {
    "azure_auth": {
      "authorizationUrl": "https://login.microsoftonline.com/common/oauth2/authorize",
      "description": "Azure Active Directory OAuth2 Flow",
      "flow": "implicit",
      "scopes": {
        "user_impersonation": "impersonate your user account"
      },
      "type": "oauth2"
    }
  },
  "security": [
    {
      "azure_auth": [
        "user_impersonation"
      ]
    }
  ],
  "parameters": {
    "ApiVersionParameter": {
      "description": "The API version to use for the operation.",
      "in": "query",
      "name": "api-version",
      "required": true,
      "type": "string"
    },
    "ManagementGroupIdParameter": {
      "description": "The ID of the management group.",
      "in": "path",
      "name": "managementGroupId",
      "required": true,
      "type": "string",
      "x-ms-parameter-location": "method"
    },
    "SubscriptionIdParameter": {
      "description": "The ID of the target subscription.",
      "in": "path",
      "name": "subscriptionId",
      "required": true,
      "type": "string"
    }
  },
  "paths": {
    "/providers/Microsoft.Authorization/policyDefinitions": {
      "get": {
        "description": "Gets all the built in policy definitions.",
        "operationId": "PolicyDefinitions_ListBuiltIn",
        "parameters": [
          {
            "$ref": "#/parameters/ApiVersionParameter"
          }
        ],
        "responses": {
          "200": {
            "description": "OK - Returns an array of built in policy definitions.",
            "schema": {
              "$ref": "#/definitions/PolicyDefinitionListResult"
            }
          }
        },
        "tags": [
          "PolicyDefinitions"
        ],
        "x-ms-pageable": {
          "nextLinkName": "nextLink"
        }
      }
    },
    "/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}": {
      "get": {
        "description": "Gets the built in policy definition.",
        "operationId": "PolicyDefinitions_GetBuiltIn",
        "parameters": [
          {
            "description": "The name of the built in policy definition to get.",
            "in": "path",
            "name": "policyDefinitionName",
            "required": true,
            "type": "string"
          },
          {
            "$ref": "#/parameters/ApiVersionParameter"
          }
        ],
        "responses": {
          "200": {
            "description": "OK - Returns information about the built in policy definition.",
            "schema": {
              "$ref": "#/definitions/PolicyDefinition"
            }
          }
        },
        "tags": [
          "PolicyDefinitions"
        ]
      }
    },
    "/providers/Microsoft.Management/managementgroups/{managementGroupId}/providers/Microsoft.Authorization/policyDefinitions": {
      "get": {
        "description": "Gets all the policy definitions for a subscription at management group level.",
        "operationId": "PolicyDefinitions_ListByManagementGroup",
        "parameters": [
          {
            "$ref": "#/parameters/ApiVersionParameter"
          },
          {
            "$ref": "#/parameters/ManagementGroupIdParameter"
          }
        ],
        "responses": {
          "200": {
            "description": "OK - Returns ana array of policy definitions.",
            "schema": {
              "$ref": "#/definitions/PolicyDefinitionListResult"
            }
          }
        },
        "tags": [
          "PolicyDefinitions"
        ],
        "x-ms-pageable": {
          "nextLinkName": "nextLink"
        }
      }
    },
    "/providers/Microsoft.Management/managementgroups/{managementGroupId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}": {
      "delete": {
        "description": "Deletes a policy definition at management group level.",
        "operationId": "PolicyDefinitions_DeleteAtManagementGroup",
        "parameters": [
          {
            "description": "The name of the policy definition to delete.",
            "in": "path",
            "name": "policyDefinitionName",
            "required": true,
            "type": "string"
          },
          {
            "$ref": "#/parameters/ApiVersionParameter"
          },
          {
            "$ref": "#/parameters/ManagementGroupIdParameter"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          },
          "204": {
            "description": "No Content"
          }
        },
        "tags": [
          "PolicyDefinitions"
        ]
      },
      "get": {
        "description": "Gets the policy definition at management group level.",
        "operationId": "PolicyDefinitions_GetAtManagementGroup",
        "parameters": [
          {
            "description": "The name of the policy definition to get.",
            "in": "path",
            "name": "policyDefinitionName",
            "required": true,
            "type": "string"
          },
          {
            "$ref": "#/parameters/ApiVersionParameter"
          },
          {
            "$ref": "#/parameters/ManagementGroupIdParameter"
          }
        ],
        "responses": {
          "200": {
            "description": "OK - Returns information about the policy definition.",
            "schema": {
              "$ref": "#/definitions/PolicyDefinition"
            }
          }
        },
        "tags": [
          "PolicyDefinitions"
        ]
      },
      "put": {
        "description": "Creates or updates a policy definition at management group level.",
        "operationId": "PolicyDefinitions_CreateOrUpdateAtManagementGroup",
        "parameters": [
          {
            "description": "The name of the policy definition to create.",
            "in": "path",
            "name": "policyDefinitionName",
            "required": true,
            "type": "string"
          },
          {
            "description": "The policy definition properties.",
            "in": "body",
            "name": "parameters",
            "required": true,
            "schema": {
              "$ref": "#/definitions/PolicyDefinition"
            }
          },
          {
            "$ref": "#/parameters/ApiVersionParameter"
          },
          {
            "$ref": "#/parameters/ManagementGroupIdParameter"
          }
        ],
        "responses": {
          "201": {
            "description": "Created - Returns information about the policy definition.",
            "schema": {
              "$ref": "#/definitions/PolicyDefinition"
            }
          }
        },
        "tags": [
          "PolicyDefinitions"
        ]
      }
    },
    "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyDefinitions": {
      "get": {
        "description": "Gets all the policy definitions for a subscription.",
        "operationId": "PolicyDefinitions_List",
        "parameters": [
          {
            "$ref": "#/parameters/ApiVersionParameter"
          },
          {
            "$ref": "#/parameters/SubscriptionIdParameter"
          }
        ],
        "responses": {
          "200": {
            "description": "OK - Returns ana array of policy definitions.",
            "schema": {
              "$ref": "#/definitions/PolicyDefinitionListResult"
            }
          }
        },
        "tags": [
          "PolicyDefinitions"
        ],
        "x-ms-pageable": {
          "nextLinkName": "nextLink"
        }
      }
    },
    "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}": {
      "delete": {
        "description": "Deletes a policy definition.",
        "operationId": "PolicyDefinitions_Delete",
        "parameters": [
          {
            "description": "The name of the policy definition to delete.",
            "in": "path",
            "name": "policyDefinitionName",
            "required": true,
            "type": "string"
          },
          {
            "$ref": "#/parameters/ApiVersionParameter"
          },
          {
            "$ref": "#/parameters/SubscriptionIdParameter"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          },
          "204": {
            "description": "No Content"
          }
        },
        "tags": [
          "PolicyDefinitions"
        ]
      },
      "get": {
        "description": "Gets the policy definition.",
        "operationId": "PolicyDefinitions_Get",
        "parameters": [
          {
            "description": "The name of the policy definition to get.",
            "in": "path",
            "name": "policyDefinitionName",
            "required": true,
            "type": "string"
          },
          {
            "$ref": "#/parameters/ApiVersionParameter"
          },
          {
            "$ref": "#/parameters/SubscriptionIdParameter"
          }
        ],
        "responses": {
          "200": {
            "description": "OK - Returns information about the policy definition.",
            "schema": {
              "$ref": "#/definitions/PolicyDefinition"
            }
          }
        },
        "tags": [
          "PolicyDefinitions"
        ]
      },
      "put": {
        "description": "Creates or updates a policy definition.",
        "operationId": "PolicyDefinitions_CreateOrUpdate",
        "parameters": [
          {
            "description": "The name of the policy definition to create.",
            "in": "path",
            "name": "policyDefinitionName",
            "required": true,
            "type": "string"
          },
          {
            "description": "The policy definition properties.",
            "in": "body",
            "name": "parameters",
            "required": true,
            "schema": {
              "$ref": "#/definitions/PolicyDefinition"
            }
          },
          {
            "$ref": "#/parameters/ApiVersionParameter"
          },
          {
            "$ref": "#/parameters/SubscriptionIdParameter"
          }
        ],
        "responses": {
          "201": {
            "description": "Created - Returns information about the policy definition.",
            "schema": {
              "$ref": "#/definitions/PolicyDefinition"
            }
          }
        },
        "tags": [
          "PolicyDefinitions"
        ]
      }
    }
  },
  "definitions": {
    "PolicyDefinition": {
      "description": "The policy definition.",
      "properties": {
        "id": {
          "description": "The ID of the policy definition.",
          "readOnly": true,
          "type": "string"
        },
        "name": {
          "description": "The name of the policy definition.",
          "readOnly": true,
          "type": "string"
        },
        "properties": {
          "$ref": "#/definitions/PolicyDefinitionProperties",
          "description": "The policy definition properties.",
          "x-ms-client-flatten": true
        }
      },
      "x-ms-azure-resource": true
    },
    "PolicyDefinitionListResult": {
      "description": "List of policy definitions.",
      "properties": {
        "nextLink": {
          "description": "The URL to use for getting the next set of results.",
          "type": "string"
        },
        "value": {
          "description": "An array of policy definitions.",
          "items": {
            "$ref": "#/definitions/PolicyDefinition"
          },
          "type": "array"
        }
      }
    },
    "PolicyDefinitionProperties": {
      "description": "The policy definition properties.",
      "properties": {
        "description": {
          "description": "The policy definition description.",
          "type": "string"
        },
        "displayName": {
          "description": "The display name of the policy definition.",
          "type": "string"
        },
        "metadata": {
          "description": "The policy definition metadata.",
          "type": "object"
        },
        "mode": {
          "description": "The policy definition mode. Possible values are NotSpecified, Indexed, and All.",
          "enum": [
            "NotSpecified",
            "Indexed",
            "All"
          ],
          "type": "string",
          "x-ms-enum": {
            "modelAsString": true,
            "name": "policyMode"
          }
        },
        "parameters": {
          "description": "Required if a parameter is used in policy rule.",
          "type": "object"
        },
        "policyRule": {
          "description": "The policy rule.",
          "type": "object"
        },
        "policyType": {
          "description": "The type of policy definition. Possible values are NotSpecified, BuiltIn, and Custom.",
          "enum": [
            "NotSpecified",
            "BuiltIn",
            "Custom"
          ],
          "type": "string",
          "x-ms-enum": {
            "modelAsString": true,
            "name": "policyType"
          }
        }
      }
    }
  }
}