AI prompts in Power Platform
How AI Builder and Copilot Studio promote prompts as a first-class artefact — prompt design, parameters, grounding, and the operational patterns that make AI prompts reliable in business apps.
Across the Power Platform, generative AI is exposed through AI prompts — reusable, parameterised templates that call an LLM with consistent instructions and structured inputs. Treating prompts as artefacts (versioned, ALM-deployed, tested) rather than ad-hoc strings is the difference between a flashy demo and a production-grade AI feature.
Where prompts live. Prompts can be authored in:
- AI Builder — the canonical home; "AI prompts" is a model type alongside form processors, classifiers, etc.
- Copilot Studio — embedded in topic logic and agents.
- Power Automate — invoked from flows.
- Power Apps — invoked from canvas apps directly.
The prompt itself is a Dataverse-stored asset, solutionable, exportable.
Prompt anatomy.
- Instruction text — the prompt body, with placeholders.
- Input parameters — typed values supplied at invocation.
- Output type — text, table, structured JSON.
- Model selection — GPT-4, GPT-4o, or other available models.
- Grounding data — knowledge sources the prompt can reference.
Designing a prompt. A production prompt typically has structure like:
- Role and context — "You are an expert in [domain]. Your job is to [task]."
- Input data — labelled values: "Customer message: . Account history: ."
- Instructions — what to produce, format constraints.
- Examples — few-shot examples showing desired output.
- Constraints and edge cases — what not to do, how to handle empty inputs.
Most prompt failures trace to vague instructions or missing examples. Iterate with real inputs until the output is reliable.
Output types.
- Text — free-form response. Easy to call, hard to parse downstream.
- Structured (JSON) — defined schema; the model is constrained to produce JSON matching the schema. Far more reliable for downstream automation.
Use structured outputs whenever the downstream step needs specific fields. Free-form text is fine for end-user display; downstream automation should rely on structured.
Grounding. A prompt can be grounded in:
- Specific Dataverse rows — pulled in at invocation.
- Documents — files in SharePoint, OneDrive, or AI Builder document collections.
- Knowledge sources — Copilot Studio knowledge.
- Search results — Microsoft Search or Bing.
Grounding reduces hallucinations and aligns output to authoritative data.
Invocation patterns.
- From a flow — the "Create text with GPT using a prompt" action.
- From a canvas app —
AIBuilder.PromptName.Predict({inputs})Power Fx call. - From a low-code plug-in — Power Fx call within plug-in logic.
- From a Copilot Studio agent — generative actions triggered by intent.
Versioning and ALM. Prompts are versioned in the maker portal. Solutions export the current version; consumers reference the prompt by ID. Promotion through dev → test → prod follows standard solution ALM. Be careful about referencing prompts by name vs by ID — name changes break references.
Testing. The prompt builder has a test pane:
- Provide sample inputs.
- See the model's output.
- Iterate.
Production prompts need more than UI testing — a small test harness in Power Automate or a Python script can regression-test prompts against a corpus of representative inputs.
Cost. Each prompt invocation costs AI credits per AI Builder licensing. Credits convert roughly to token usage. High-volume scenarios need careful cost modelling: a prompt firing on every Dataverse Create event at 10K events/day adds up.
Latency. LLM responses take seconds, not milliseconds. UX-blocking calls feel slow. Patterns:
- Async invocation — kick off the prompt, show "processing", display result when ready.
- Streaming output — display tokens as they arrive (where supported).
- Caching — same inputs → same output; cache aggressively.
Common pitfalls.
- Untested edge cases — empty inputs, very long inputs, unusual character sets break the prompt.
- Trust-on-first-use — outputs assumed correct without verification; hallucinations slip into production.
- No versioning hygiene — prompts edited live in prod; no rollback path.
- Free-form text downstream — parsing brittle; structured output is the fix.
- Cost overruns — high-volume invocation without monitoring; surprise bill.
- Prompt injection vulnerability — user input flowing into prompts without sanitisation; users craft inputs to override instructions.
Prompt injection mitigation.
- Treat user input as data, not instruction. Wrap user input in clear delimiters; instruct the model to ignore instructions in user input.
- Validate output before acting — even if the model is "told" not to produce certain outputs, treat outputs as untrusted.
- Limit privileges — a prompt that triggers an action shouldn't have full system permissions.
Operational guidance. Treat prompts like code: version, test, deploy through pipelines, monitor in production. The "type into a box and run it" feel of AI Builder makes it easy to skip these practices — and easy to ship fragile AI features that break under real usage. Discipline pays back.
Related guides
- AI Builder document automation, in depthHow AI Builder's document automation works — pre-built models, custom training, output structure, and the right way to integrate it with Dynamics 365.
- AI Builder explainedMicrosoft's no-code AI model library inside the Power Platform — pre-built models, custom training, and what AI Builder is good at.
- Building agents with Copilot StudioHow to design Copilot Studio agents — topics vs generative answers, knowledge grounding, actions, multi-turn dialogs, and operational patterns.
- Copilot agents vs Copilot StudioHow Microsoft's agent strategy splits — Copilot Studio for building custom agents, declarative agents in Microsoft 365 Copilot, autonomous agents — and how the pieces fit together.
- Copilot Studio for Dynamics 365Building AI agents on top of Dynamics 365 with Copilot Studio — topics, knowledge sources, generative answers, and Dataverse integration.