| title | Azure API Management policy reference - include-fragment | Microsoft Docs |
|---|---|
| description | Reference for the include-fragment policy available for use in Azure API Management. Provides policy usage, settings, and examples. |
| services | api-management |
| author | dlepow |
| ms.service | azure-api-management |
| ms.topic | reference |
| ms.date | 07/23/2024 |
| ms.author | danlep |
[!INCLUDE api-management-availability-all-tiers]
The include-fragment policy inserts the contents of a previously created policy fragment in the policy definition. A policy fragment is a centrally managed, reusable XML policy snippet that can be included in policy definitions in your API Management instance.
The policy inserts the policy fragment as-is at the location you select in the policy definition.
[!INCLUDE api-management-policy-generic-alert]
<include-fragment fragment-id="fragment" />| Attribute | Description | Required | Default |
|---|---|---|---|
| fragment-id | A string. Specifies the identifier (name) of a policy fragment created in the API Management instance. Policy expressions aren't allowed. | Yes | N/A |
- Policy sections: inbound, outbound, backend, on-error
- Policy scopes: global, workspace, product, API, operation
- Gateways: classic, v2, consumption, self-hosted, workspace
In the following example, the policy fragment named myFragment is added in the inbound section of a policy definition.
<inbound>
<include-fragment fragment-id="myFragment" />
<base />
</inbound>
[...][!INCLUDE api-management-policy-ref-next-steps]