Skip to main content

policy_fragment

Creates, updates, deletes, gets or lists a policy_fragment resource.

Overview

Namepolicy_fragment
TypeResource
Idazure.api_management.policy_fragment

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
idstringFully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.
namestringThe name of the resource.
descriptionstringPolicy fragment description.
formatstringFormat of the policy fragment content. Known values are: "xml" and "rawxml". (xml, rawxml)
provisioningStatestringThe provisioning state.
systemDataobjectAzure Resource Manager metadata containing createdBy and modifiedBy information.
typestringThe type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts".
valuestringContents of the policy fragment. Required.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectresource_group_name, service_name, id, subscription_idformatGets a policy fragment.
list_by_serviceselectresource_group_name, service_name, subscription_id$filter, $orderby, $top, $skipGets all policy fragments.
create_or_updateinsertresource_group_name, service_name, id, subscription_idCreates or updates a policy fragment.
create_or_updatereplaceresource_group_name, service_name, id, subscription_idCreates or updates a policy fragment.
deletedeleteresource_group_name, service_name, id, subscription_idDeletes a policy fragment.
get_entity_tagexecresource_group_name, service_name, id, subscription_idGets the entity state (Etag) version of a policy fragment.
list_referencesexecresource_group_name, service_name, id, subscription_id$top, $skipLists policy resources that reference the policy fragment.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
idstringA resource identifier. Required.
resource_group_namestringThe name of the resource group. The name is case insensitive. Required.
service_namestringThe name of the API Management service. Required.
subscription_idstring
$filterstring| Field | Usage | Supported operators | Supported functions ||-------------|-------------|-------------|-------------|| name | filter, orderBy | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith || description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith || value | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |. Default value is None.
$orderbystringOData order by query option. Default value is None.
$skipintegerNumber of records to skip. Default value is None.
$topintegerNumber of records to return. Default value is None.
formatstringPolicy fragment content format. Known values are: "xml" and "rawxml". Default value is None.

SELECT examples

Gets a policy fragment.

SELECT
id,
name,
description,
format,
provisioningState,
systemData,
type,
value
FROM azure.api_management.policy_fragment
WHERE resource_group_name = '{{ resource_group_name }}' -- required
AND service_name = '{{ service_name }}' -- required
AND id = '{{ id }}' -- required
AND subscription_id = '{{ subscription_id }}' -- required
AND format = '{{ format }}'
;

INSERT examples

Creates or updates a policy fragment.

INSERT INTO azure.api_management.policy_fragment (
properties,
resource_group_name,
service_name,
id,
subscription_id
)
SELECT
'{{ properties }}',
'{{ resource_group_name }}',
'{{ service_name }}',
'{{ id }}',
'{{ subscription_id }}'
RETURNING
id,
name,
properties,
systemData,
type
;

REPLACE examples

Creates or updates a policy fragment.

REPLACE azure.api_management.policy_fragment
SET
properties = '{{ properties }}'
WHERE
resource_group_name = '{{ resource_group_name }}' --required
AND service_name = '{{ service_name }}' --required
AND id = '{{ id }}' --required
AND subscription_id = '{{ subscription_id }}' --required
RETURNING
id,
name,
properties,
systemData,
type;

DELETE examples

Deletes a policy fragment.

DELETE FROM azure.api_management.policy_fragment
WHERE resource_group_name = '{{ resource_group_name }}' --required
AND service_name = '{{ service_name }}' --required
AND id = '{{ id }}' --required
AND subscription_id = '{{ subscription_id }}' --required
;

Lifecycle Methods

Gets the entity state (Etag) version of a policy fragment.

EXEC azure.api_management.policy_fragment.get_entity_tag 
@resource_group_name='{{ resource_group_name }}' --required,
@service_name='{{ service_name }}' --required,
@id='{{ id }}' --required,
@subscription_id='{{ subscription_id }}' --required
;