---
title: Microsoft Foundry AI Action
description: "Microsoft Foundry AI Action is a specific implementation of Document AI that uses Microsoft's AI models for document processing. This action type provides advanced extraction and classification capabilities through Microsoft's language models. This page describes the following configuration options: -…"
url: "https://extensionkit.unitfly.com/documentation/document-ai-microsoft-foundry-ai-action/"
updated: "2026-10-14"
category: Configurations / Document AI / Simple rule configuration
---

# Microsoft Foundry AI Action

Microsoft Foundry AI Action is a specific implementation of Document AI that uses Microsoft's AI models for document processing. This action type provides advanced extraction and classification capabilities through Microsoft's language models.

This page describes the following configuration options:

- [Common fields](https://extensionkit.unitfly.com/documentation/document-ai-microsoft-foundry-ai-action/#common-fields) for both action types (Extract and Classify)
- Options available when [Action type is set to Extract](https://extensionkit.unitfly.com/documentation/document-ai-microsoft-foundry-ai-action/#if-action-type-is-extract)
- Options available when [Action type is set to Classify](https://extensionkit.unitfly.com/documentation/document-ai-microsoft-foundry-ai-action/#if-action-type-is-classify)

---

## Common fields

## Action type

The type of AI action to perform.

- **Extract** (default): The model reads a document and returns specific field values (e.g. invoice number, date).
- **Classify**: The model reads a document and assigns it to one of the predefined classes that you provide in examples.

## Save response to file(s)

Save the AI service response as a file in M-Files. Enable 'Save full response to file' on each entry to save the complete AI response as a JSON file. Specify a filename including extension (e.g. 'response.json').

Expand the section and click on **Add AiSuggestedFile** to configure the following:

- **Label:** Unique set file action name. When ‘Save full response to file’ is disabled, this is also the AI suggestion name used to find the file content. Multiple file entries can be defined — each is processed independently. Entries with ‘Save full response to file’ enabled save the full AI response as JSON. Entries with it disabled match the AI suggestion (Query field) whose name equals this label and save its binary content.
- **Save full response to file:** If enabled, saves the entire AI service response as a JSON file instead of extracting a specific named suggestion. If disabled (default), the AI suggestion whose name matches the Label is found and its binary content is saved to the file.
- **Filename expression:** Filename expression returning filename and file extension. The file extension is required (e.g. ‘response.json’) — the file will not be saved if the extension is missing. When left empty and UpdateFile is set to true, the first file on the object will be updated.
- **Update file content:** Update file content if file already exists. The default value is set to No.

## Pages to process

Tells the AI model which pages of the document to process. Instead of sending the entire document to the AI model, you can limit processing to specific pages or ranges. Use a comma-separated list of page numbers and/or page ranges (e.g., '1,3-5,7'). Leave empty to process all pages.

---

## If Action type is Extract

Select **Extract** as the Action type to extract specific field values from documents using Microsoft Foundry models.

The following settings are available:

- Extraction model
- Extraction model system instructions
- Set properties
- Create object(s)

## Extraction model

Deployed model to use for extraction. Models are populated from your Azure AI Foundry project deployments.

If the list is empty:

- verify that you have deployed models in your Azure AI Foundry project
- confirm that your Extension Kit license is valid
- try restarting the M-Files Admin configuration

## Extraction model system instructions

System-level instructions sent to the model before the document. Use this to set the model's role, language expectations, or output constraints. The default works well in most cases.

## Set properties

Map fields extracted by the model to M-Files properties on the object. Within the section, configure the following fields:

- **Set property from response:** Choose whether to set the property from the model response or as a static property from existing objects in the vault. If set to **Yes**(default), the following configuration fields are available: Query field, Query field description, Result M-Files property type, Allow to overwrite existing value, and Result property. If set to **No**, the Static property section is available for configuring the property, values, conditions, and other options.
- **Query field:** The term the model should extract from the document. Use a plain name if extracting a single scalar value (e.g. ‘InvoiceNumber’). Use a name that ends with [] if extracting a list of values (e.g. ‘Tags[]’). Use dot notation to access a nested field inside an array of objects (e.g. ‘LineItems[].Description’). Multiple levels of nesting are supported (e.g. ‘Order.BillingAddress.City’).
- **Query field description:** Additional description for the query field to provide more context to the model, like the expected format or unit.
- **Result M-Files property type:** Specify what the result represents: simple value, object lookup or value list lookup.
- **Allow to overwrite existing value:** Defines whether rule is allowed to overwrite an existing property value on the object. If enabled, rule will update the property value even when a value already exists. If disabled, rule will not modify the property when it already contains a value.
- **Array to text behavior:** Displayed when Query field ends with [].Controls how an array result is mapped to a single-value M-Files property. ‘TakeFirst’ uses only the first element. ‘Concatenate’ joins all elements into one string separated by the configured separator.

## Create object(s)

Create new M-Files objects and populate their properties with values extracted by the model. Within the section, configure the following fields:

- **Label:** A unique name for this create-object action, used to identify it in logs and the configuration UI.
- **Object cardinality:** Controls how many objects are created.
  - **Single (default):** Creates exactly one object and maps scalar query field values to its properties.
  - **Array:** Creates one object per item in an array field extracted by the model — use this when the document contains a repeating list (e.g. invoice line items).
- **Object type:** The M-Files object type of the newly created object (e.g. Document, Customer).
- **Object class:** The M-Files class assigned to the newly created object. Leave empty to use the default class for the selected object type.
- **Set properties on new object:** Displayed if Object cardinality is Single. Map scalar model fields to properties on the single newly created object.
- **Duplicates detection:** When enabled, the system checks whether an object with identical property values already exists before creating a new one. Configure the matching rules in the Duplicates detection rules section.
- **Array query field:** Displayed if Object cardinality is Array. The query field name (without []) whose array value drives object creation. The model must return this field as an array — one new M-Files object is created per element. For example, enter ‘LineItems’ when the model returns a ‘LineItems[]’ array.
- **Set properties on new objects (array):** Displayed if Object cardinality is Array. Map fields from each array element to properties on the corresponding newly created object. Use the query field in the format ‘ArrayField[].SubField’ (e.g. ‘LineItems[].Description’) to address a specific sub-field of each item.

---

## If Action type is Classify

Select **Classify** as the Action type to classify documents using Microsoft Foundry models.

The following settings are available:

- Classifier model
- Classify examples
- Classifier system instructions
- Confidence threshold
- Map mode

## Classifier model

Deployed model to use for classification. Models are populated from your Azure AI Foundry project deployments. I

f the list is empty:

- verify that you have deployed models in your Azure AI Foundry project
- confirm that your Extension Kit license is valid
- try restarting the M-Files Admin configuration

## Classify examples

Examples tell the model what documents of specific classes look like.

How it works: every time a document is classified, the content of each example is extracted and included in the prompt sent to the model — alongside the class label it represents. The model uses this context to decide which label best fits the incoming document.

Keep examples small and focused: because example text is sent with every classification request, adding many or large examples increases prompt size, latency, and API cost. Aim for 1–2 short, representative documents per class. Use the 'Pages' setting on each example to include only the most identifying pages.

Requirements:

- Add at least one example per class label you want the model to assign.
- The class label comes from the 'Example class' field on each example entry.
- If no examples are provided, classification is skipped entirely.

Within the section, configure the following fields:

- **Example class:** The M-Files class this example document represents. The class name is used as the classification label — the model will assign this exact label to documents it considers similar to this example.
- **Example document source:** How to locate the example document.
  - **From source object** uses a file from the object that triggered the rule.
  - **From search** finds an object in the vault matching search conditions.
  - **From path** loads a file from the server’s file system (on-premise only).
- **Pages to process:** Limits which pages of the example document are sent to the model. Use a comma-separated list of page numbers and/or ranges (e.g. ‘1’, ‘1-2’, ‘1,3-5’). Leave empty to include all pages. Tip: limiting pages keeps the example concise — since example text is sent with every classification request, including only the most identifying pages reduces prompt size and improves performance.
- **OCR languages:** Languages used by OCR when this example document is a scanned image or a PDF without a text layer. Add multiple languages if the document contains text in more than one language. Leave empty to use the default (English). Note: only applies when the document requires OCR — documents with a selectable text layer are read directly.

## Classifier system instructions

Instructions that give the AI model additional context or constraints for classification. Leave as default unless you need to customize classification behavior.

## Confidence threshold

Minimum confidence required to apply the classification result. If the model's confidence is below this value, the class will not be set. Note: LLM-based classifiers (Microsoft Foundry) always return a confidence of 1.0, so this threshold has no effect and can be left at the default.

## Map mode

Determines where the classification result is written.

- **Class**: Sets the M-Files class property (default).
- **Property**: Writes the classification label to a specific property.
