{
  "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": "2015-10-01-preview",
    "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/preview/2015-10-01-preview/policy.json",
        "version": "2.0"
      }
    ],
    "x-preferred": false,
    "x-providerName": "azure.com",
    "x-serviceName": "resources-policy",
    "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"
    },
    "SubscriptionIdParameter": {
      "description": "The ID of the target subscription.",
      "in": "path",
      "name": "subscriptionId",
      "required": true,
      "type": "string"
    }
  },
  "paths": {
    "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyassignments": {
      "get": {
        "description": "Gets all the policy assignments for a subscription.",
        "operationId": "PolicyAssignments_List",
        "parameters": [
          {
            "description": "The filter to apply on the operation.",
            "in": "query",
            "name": "$filter",
            "required": false,
            "type": "string"
          },
          {
            "$ref": "#/parameters/ApiVersionParameter"
          },
          {
            "$ref": "#/parameters/SubscriptionIdParameter"
          }
        ],
        "responses": {
          "200": {
            "description": "OK - Returns an array of policy assignments.",
            "schema": {
              "$ref": "#/definitions/PolicyAssignmentListResult"
            }
          }
        },
        "tags": [
          "PolicyAssignments"
        ],
        "x-ms-odata": "#/definitions/PolicyAssignment",
        "x-ms-pageable": {
          "nextLinkName": "nextLink"
        }
      }
    },
    "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policydefinitions": {
      "get": {
        "description": "Gets all the policy definitions for a subscription.",
        "operationId": "PolicyDefinitions_List",
        "parameters": [
          {
            "description": "The filter to apply on the operation.",
            "in": "query",
            "name": "$filter",
            "required": false,
            "type": "string"
          },
          {
            "$ref": "#/parameters/ApiVersionParameter"
          },
          {
            "$ref": "#/parameters/SubscriptionIdParameter"
          }
        ],
        "responses": {
          "200": {
            "description": "OK - Returns ana array of policy definitions.",
            "schema": {
              "$ref": "#/definitions/PolicyDefinitionListResult"
            }
          }
        },
        "tags": [
          "PolicyDefinitions"
        ],
        "x-ms-odata": "#/definitions/PolicyDefinition",
        "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"
        ]
      }
    },
    "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/policyAssignments": {
      "get": {
        "description": "Gets policy assignments for the resource group.",
        "operationId": "PolicyAssignments_ListForResourceGroup",
        "parameters": [
          {
            "description": "The name of the resource group that contains policy assignments.",
            "in": "path",
            "maxLength": 90,
            "minLength": 1,
            "name": "resourceGroupName",
            "pattern": "^[-\\w\\._\\(\\)]+$",
            "required": true,
            "type": "string"
          },
          {
            "description": "The filter to apply on the operation.",
            "in": "query",
            "name": "$filter",
            "required": false,
            "type": "string",
            "x-ms-skip-url-encoding": true
          },
          {
            "$ref": "#/parameters/ApiVersionParameter"
          },
          {
            "$ref": "#/parameters/SubscriptionIdParameter"
          }
        ],
        "responses": {
          "200": {
            "description": "OK - Returns an array of policy assignments.",
            "schema": {
              "$ref": "#/definitions/PolicyAssignmentListResult"
            }
          }
        },
        "tags": [
          "PolicyAssignments"
        ],
        "x-ms-pageable": {
          "nextLinkName": "nextLink"
        }
      }
    },
    "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/policyassignments": {
      "get": {
        "description": "Gets policy assignments for a  resource.",
        "operationId": "PolicyAssignments_ListForResource",
        "parameters": [
          {
            "description": "The name of the resource group containing the resource. The name is case insensitive.",
            "in": "path",
            "maxLength": 90,
            "minLength": 1,
            "name": "resourceGroupName",
            "pattern": "^[-\\w\\._\\(\\)]+$",
            "required": true,
            "type": "string"
          },
          {
            "description": "The namespace of the resource provider.",
            "in": "path",
            "name": "resourceProviderNamespace",
            "required": true,
            "type": "string"
          },
          {
            "description": "The parent resource path.",
            "in": "path",
            "name": "parentResourcePath",
            "required": true,
            "type": "string",
            "x-ms-skip-url-encoding": true
          },
          {
            "description": "The resource type.",
            "in": "path",
            "name": "resourceType",
            "required": true,
            "type": "string",
            "x-ms-skip-url-encoding": true
          },
          {
            "description": "The name of the resource with policy assignments.",
            "in": "path",
            "name": "resourceName",
            "required": true,
            "type": "string"
          },
          {
            "description": "The filter to apply on the operation.",
            "in": "query",
            "name": "$filter",
            "required": false,
            "type": "string"
          },
          {
            "$ref": "#/parameters/ApiVersionParameter"
          },
          {
            "$ref": "#/parameters/SubscriptionIdParameter"
          }
        ],
        "responses": {
          "200": {
            "description": "OK - Returns an array of policy assignments.",
            "schema": {
              "$ref": "#/definitions/PolicyAssignmentListResult"
            }
          }
        },
        "tags": [
          "PolicyAssignments"
        ],
        "x-ms-odata": "#/definitions/PolicyAssignment",
        "x-ms-pageable": {
          "nextLinkName": "nextLink"
        }
      }
    },
    "/{policyAssignmentId}": {
      "delete": {
        "description": "When providing a scope for the assignment, use '/subscriptions/{subscription-id}/' for subscriptions, '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for resource groups, and '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider-namespace}/{resource-type}/{resource-name}' for resources.",
        "operationId": "PolicyAssignments_DeleteById",
        "parameters": [
          {
            "description": "The ID of the policy assignment to delete. Use the format '/{scope}/providers/Microsoft.Authorization/policyAssignments/{policy-assignment-name}'.",
            "in": "path",
            "name": "policyAssignmentId",
            "required": true,
            "type": "string",
            "x-ms-skip-url-encoding": true
          },
          {
            "$ref": "#/parameters/ApiVersionParameter"
          }
        ],
        "responses": {
          "200": {
            "description": "OK - Returns information about the policy assignment.",
            "schema": {
              "$ref": "#/definitions/PolicyAssignment"
            }
          }
        },
        "summary": "Deletes a policy assignment by ID.",
        "tags": [
          "PolicyAssignments"
        ]
      },
      "get": {
        "description": "When providing a scope for the assignment, use '/subscriptions/{subscription-id}/' for subscriptions, '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for resource groups, and '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider-namespace}/{resource-type}/{resource-name}' for resources.",
        "operationId": "PolicyAssignments_GetById",
        "parameters": [
          {
            "description": "The ID of the policy assignment to get. Use the format '/{scope}/providers/Microsoft.Authorization/policyAssignments/{policy-assignment-name}'.",
            "in": "path",
            "name": "policyAssignmentId",
            "required": true,
            "type": "string",
            "x-ms-skip-url-encoding": true
          },
          {
            "$ref": "#/parameters/ApiVersionParameter"
          }
        ],
        "responses": {
          "200": {
            "description": "OK - Returns information about the policy assignment.",
            "schema": {
              "$ref": "#/definitions/PolicyAssignment"
            }
          }
        },
        "summary": "Gets a policy assignment by ID.",
        "tags": [
          "PolicyAssignments"
        ]
      },
      "put": {
        "description": "Policy assignments are inherited by child resources. For example, when you apply a policy to a resource group that policy is assigned to all resources in the group. When providing a scope for the assignment, use '/subscriptions/{subscription-id}/' for subscriptions, '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for resource groups, and '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider-namespace}/{resource-type}/{resource-name}' for resources.",
        "operationId": "PolicyAssignments_CreateById",
        "parameters": [
          {
            "description": "The ID of the policy assignment to create. Use the format '/{scope}/providers/Microsoft.Authorization/policyAssignments/{policy-assignment-name}'.",
            "in": "path",
            "name": "policyAssignmentId",
            "required": true,
            "type": "string",
            "x-ms-skip-url-encoding": true
          },
          {
            "description": "Parameters for policy assignment.",
            "in": "body",
            "name": "parameters",
            "required": true,
            "schema": {
              "$ref": "#/definitions/PolicyAssignment"
            }
          },
          {
            "$ref": "#/parameters/ApiVersionParameter"
          }
        ],
        "responses": {
          "201": {
            "description": "Created - Returns information about the policy assignment.",
            "schema": {
              "$ref": "#/definitions/PolicyAssignment"
            }
          }
        },
        "summary": "Creates a policy assignment by ID.",
        "tags": [
          "PolicyAssignments"
        ]
      }
    },
    "/{scope}/providers/Microsoft.Authorization/policyassignments/{policyAssignmentName}": {
      "delete": {
        "description": "Deletes a policy assignment.",
        "operationId": "PolicyAssignments_Delete",
        "parameters": [
          {
            "description": "The scope of the policy assignment.",
            "in": "path",
            "name": "scope",
            "required": true,
            "type": "string",
            "x-ms-skip-url-encoding": true
          },
          {
            "description": "The name of the policy assignment to delete.",
            "in": "path",
            "name": "policyAssignmentName",
            "required": true,
            "type": "string"
          },
          {
            "$ref": "#/parameters/ApiVersionParameter"
          }
        ],
        "responses": {
          "200": {
            "description": "OK - Returns information about the deleted assignment.",
            "schema": {
              "$ref": "#/definitions/PolicyAssignment"
            }
          }
        },
        "tags": [
          "PolicyAssignments"
        ]
      },
      "get": {
        "description": "Gets a policy assignment.",
        "operationId": "PolicyAssignments_Get",
        "parameters": [
          {
            "description": "The scope of the policy assignment.",
            "in": "path",
            "name": "scope",
            "required": true,
            "type": "string",
            "x-ms-skip-url-encoding": true
          },
          {
            "description": "The name of the policy assignment to get.",
            "in": "path",
            "name": "policyAssignmentName",
            "required": true,
            "type": "string"
          },
          {
            "$ref": "#/parameters/ApiVersionParameter"
          }
        ],
        "responses": {
          "200": {
            "description": "OK - Returns information about the policy assignment.",
            "schema": {
              "$ref": "#/definitions/PolicyAssignment"
            }
          }
        },
        "tags": [
          "PolicyAssignments"
        ]
      },
      "put": {
        "description": "Policy assignments are inherited by child resources. For example, when you apply a policy to a resource group that policy is assigned to all resources in the group.",
        "operationId": "PolicyAssignments_Create",
        "parameters": [
          {
            "description": "The scope of the policy assignment.",
            "in": "path",
            "name": "scope",
            "required": true,
            "type": "string",
            "x-ms-skip-url-encoding": true
          },
          {
            "description": "The name of the policy assignment.",
            "in": "path",
            "name": "policyAssignmentName",
            "required": true,
            "type": "string"
          },
          {
            "description": "Parameters for the policy assignment.",
            "in": "body",
            "name": "parameters",
            "required": true,
            "schema": {
              "$ref": "#/definitions/PolicyAssignment"
            }
          },
          {
            "$ref": "#/parameters/ApiVersionParameter"
          }
        ],
        "responses": {
          "201": {
            "description": "Created - Returns information about the new policy assignment.",
            "schema": {
              "$ref": "#/definitions/PolicyAssignment"
            }
          }
        },
        "summary": "Creates a policy assignment.",
        "tags": [
          "PolicyAssignments"
        ]
      }
    }
  },
  "definitions": {
    "PolicyAssignment": {
      "description": "The policy assignment.",
      "properties": {
        "id": {
          "description": "The ID of the policy assignment.",
          "type": "string"
        },
        "name": {
          "description": "The name of the policy assignment.",
          "type": "string"
        },
        "properties": {
          "$ref": "#/definitions/PolicyAssignmentProperties",
          "description": "Properties for the policy assignment.",
          "x-ms-client-flatten": true
        },
        "type": {
          "description": "The type of the policy assignment.",
          "type": "string"
        }
      },
      "x-ms-azure-resource": true
    },
    "PolicyAssignmentListResult": {
      "description": "List of policy assignments.",
      "properties": {
        "nextLink": {
          "description": "The URL to use for getting the next set of results.",
          "type": "string"
        },
        "value": {
          "description": "An array of policy assignments.",
          "items": {
            "$ref": "#/definitions/PolicyAssignment"
          },
          "type": "array"
        }
      }
    },
    "PolicyAssignmentProperties": {
      "description": "The policy assignment properties.",
      "properties": {
        "displayName": {
          "description": "The display name of the policy assignment.",
          "type": "string"
        },
        "policyDefinitionId": {
          "description": "The ID of the policy definition.",
          "type": "string"
        },
        "scope": {
          "description": "The scope for the policy assignment.",
          "type": "string"
        }
      }
    },
    "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. If you do not specify a value for name, the value is inferred from the name value in the request URI.",
          "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"
        },
        "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"
          }
        }
      }
    }
  }
}